# Boost and buck-boost: step up, and turn the output negative

A boost makes a higher voltage from a lower one; a buck-boost makes a negative one. You simulate the boost example, let the Design panel size its inductor and capacitor, and then build an inverting buck-boost from a template. About 15 minutes.

Pictures: a numbered red box is what you click or read, `[Run]` is a button, `Design › Design Steps › Converter` a menu path, `F5` a key (`⌘` is Cmd on a Mac, Ctrl elsewhere).

## 1. Open the boost example

Choose `File › Open Example › DC-DC › Boost converter`.

![The File menu open at Open Example, DC-DC, Boost converter, marked 1 to 4](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/01-open-example.png)

1. `File`.
2. `Open Example`.
3. `DC-DC`.
4. `Boost converter`.

## 2. Read the circuit

The parts are those of the buck, in another order: the inductor now sits at the input and the switch shorts its far end to ground.

![The boost schematic with its six power parts, marked 1 to 6](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/02-schematic.png)

1. `Vin`: the 12 V input.
2. `L1`: 200 µH. It stores energy while the switch is on.
3. `S1`: the switch, driven by `PWM` at 50 kHz with a duty of 0.5.
4. `D1`: passes the stored energy to the output while the switch is off.
5. `C1`: 220 µF output capacitor.
6. `R1`: the 24 Ω load.

## 3. Run it

Click `[▶ Run]` in the toolbar or press `F5`.

![The scope: v(out) rings round 24 V, i(L1) round 2 A, marked 1 to 2](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/03-run.png)

1. `v(out)`: the output averages 24 V, as `Vout = Vin / (1 − D)` says.
2. `i(L1)`: the inductor current averages 2 A, twice the 1 A load, because the input power equals the output power.

**Result:** both traces ring at about 380 Hz and the ringing dies away slowly. Nothing controls this circuit (it is open loop), so the LC filter rings after every disturbance; the [closed-loop tutorial](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/02-closed-loop-buck/) shows how a compensator damps it. Over the last 0.1 ms the inductor ripple is 0.62 A peak to peak, close to the textbook `ΔI = Vin·D / (L·fsw)` = 0.6 A.

## 4. Open the converter design

Open the `Design` menu.

![The Design menu with Converter, marked 1](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/04-design-menu.png)

1. `Converter`.

## 5. Check the fields

Choose `Converter`. The Design tab opens with its fields filled in.

![The Design panel on the Converter task, marked 1 to 3](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/05-converter.png)

1. `Converter` is the task. It sizes L and C for a buck, a boost or an inverting buck-boost.
2. `from circuit`: the output voltage, the load current and the switching frequency were read from the circuit. The ripple targets are defaults: 20 % of the inductor current and 1 % of the output voltage.
3. `[Design again]`: the panel has already designed L and C from these fields, and this runs the design again. It reads `[Run]` once you change a field.

## 6. Design L and C

Click `[Design again]`.

![The design: inductor, output and input capacitor, and the changes it proposes, marked 1 to 3](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/06-converter-result.png)

1. `Inductor` 300 µH, `Output capacitor` 41.67 µF, `Input capacitor` 8.333 µF. The plot shows how L and C shrink as the switching frequency rises.
2. `Changes to apply`: `L1` from 200 µH to 300 µH and `C1` from 220 µF to 41.67 µF. The duty stays 0.5.
3. `[Apply]` writes them into the circuit.

## 7. Apply and read the check

Click `[Apply]`. The changes are one undo step (`⌘Z`). The panel then simulates the new circuit. Collapse the bottom panel (`↓` at its top right) to see the whole check.

![Verified: the measured ripples are within their targets, marked 1 to 3](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/07-verified.png)

1. `✔ Verified`: every check passed.
2. `Verification` lists the checks.
3. The inductor ripple is 0.400 A against a 0.46 A limit, the output ripple 0.243 V against 0.276 V, and the mean output is 23.99 V.

## 8. Make a buck-boost from a template

Close the Design page with the `×` on its tab, so the schematic is back. Then press `⌘K` to open Quick Open and type `template`.

![Quick Open with Circuit From Template, marked 1](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/08-palette.png)

1. `Circuit From Template`.

## 9. Ask for a buck-boost

Choose `Circuit From Template`. In the form, set `Topology` to `buck boost`.

![The template form with the buck-boost topology chosen, marked 1 to 2](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/09-template.png)

1. The topology. Fields left empty use the template's defaults: 12 V in, −24 V out, 1 A, 100 kHz.
2. `[Create Circuit]` builds the circuit.

## 10. Read the new circuit

Click `[Create Circuit]`. A new tab opens with a laid-out buck-boost. Its values are circuit variables (`Vin`, `D`, `Lf`, `Cf`, `Rload`), sized by the template's equations.

![The buck-boost: switch on top, inductor to ground, diode reversed, marked 1 to 5](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/10-schematic.png)

1. `S1`: the switch, now in series with the input.
2. `L1`: 133.3 µH, from the switch node to ground.
3. `D1`: points away from the output, so the output charges negative.
4. `C1`: 27.78 µF.
5. `R1`: the 24 Ω load.

## 11. Run the buck-boost

Press `F5`, then click the `Scope` tab of the panel (the Design tab stays in front while it is open) and `Maximize` at the panel's top right for a larger plot.

![The buck-boost output settles at −23.72 V, marked 1 to 2](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/boost-buck-boost/11-run.png)

1. `v(out)` settles at −23.72 V. The duty is 0.667, so `Vout = −Vin·D / (1 − D)` = −24 V; the input source resistance and the switch take the last 0.28 V.
2. `i(L1)` averages 2.96 A: the input current plus the load current.

## The same steps from a script

```sh
powercraft-cli run \
    --cmd file.openExample  --params '{"name":"boost"}' \
    --cmd simulation.run    --params '{}' \
    --cmd scope.measure     --params '{"signals":["v(out)","i(L1)"],"t0":"9.9m"}' \
    --cmd design.converter  --params '{"apply":true}' \
    --cmd circuit.template  --params '{"topology":"buckBoost"}' \
    --cmd simulation.run    --params '{}' \
    --cmd scope.measure     --params '{"signals":["v(out)","i(L1)"],"t0":"2.67m"}'
```

Next: [the full-bridge inverter](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/05-full-bridge-inverter/).
