To build a single switching buck supply, as show in the circuit below, you will need the following parts (about $15):
1 x 22uF Cap - Link
2 x 1000uF Cap - Link
1 x 680uH Inductor - Link
1 x 10k Res - Link
2 x 100k Res - Link
1 x IRF9Z34N PMOS - Link
2 x 1N5818 Diode - Link
1 x LT1632 Opamp - Link
You have the option of building two supplies. You'll need to double the above order if you want to build two supplies.
Your supply will need to drive a load. We suggest first starting with resistors to ensure that the circuit is working properly. Please be aware of Ohms law and avoid using loads which are not rated for the wattage that will appear across them... unless you love the smell of magic smoke. Use good judgment.
You will additionally need the following:
1 x breadboard to assemble the circuits on - Link
1 x Ardunio Uno (will work with other Ardunio distributions, but code modification is up to you) - Link
1 x laptop charger / wall wart with a Vout between 14 and 20V (most chargers) at a minimum of 3A - Link
Lots of cabling (wires, alligator clips, etc as you need) to make the connections
You may also want:
Heat shrink & a heat shrink gun
Multimeter (for testing)
Oscilliscope (for testing)
This Instructable was made as a class project for EE 122A at Stanford University under Professor Greg Kovacs. The team included Michael Digman and Christian Elder.
Step 1: Laptop Adapter Selection and Modification
Now that we have a power adapter, we need to alter it for use with the breadboard. Although you can choose to use a female barrel plug adapter, we chose to remove the barrel plug. We should take the time now to note that this probably voids the adapter’s warranty, so if you’re thinking of ever returning the adapter, you probably should buy a barrel plug adapter.
Removing the barrel plug entailed cutting the cord below the plug, stripping the outermost plastic shielding, and grouping the ground wires, which surround the inner plastic shielding. After grouping the ground wires into a bundle, we strip the inner plastic shielding, making sure to avoid letting the ground wires contact the inner power wires. With the two bundles of wires separated, we soldered each bundle to a wire, red for the power (inner) wires and black for the ground (outer) wires. For additional safety, we used electrical tape to separate the two wires. Now we can build our power supply circuit.
Step 2: PWM Signal Amplifier
- Short the rails, red to red (positive), blue to blue (ground) (see first image)
- Place the op amp across the middle of the breadboard.
- Connect pin 8 (V+) to the positive rail and pin 4 (V-) to ground
- Connect the 10 kOhm resistor from pin 2 to ground (Note: the image incorrectly connects the resistor to the positive rail. This is amended in later images)
- Connect the 100 kOhm resistor from pin 2 to pin 1 (see second image)
Step 3: Power Supply Circuit - Part 1/3
- the gate pin to the output of the LT1632 (pin 1)
- the source pin to the positive rail
Step 4: Power Supply Circuit - Step 2/3
- one terminal of the inductor to the drain pin of the IRF9X34N
- cathode of 1N5818 diode to the same terminal of the inductor, anode to ground
- anode of a second 1N5818 diode to the other terminal of the inductor
- the two 1000 uF capacitors in parallel from the cathode of the second diode to ground
- the 22 uF capacitor from the positive rail to ground
Step 5: Power Supply Circuit - Part 3/3
- one side of the 300 kOhm resistor to the output node, the other to a floating node
- one side of the 100 kOhm resistor to the floating node, the other to ground
We then connect:
- the other ‘analog in’ ground terminal to the ground rail on the breadboard
- PWM pin 9 to pin 3 of the LT1632 op amp
- A1 to the middle node of the voltage divider
We have now built a power supply circuit. Before connecting it to the laptop adapter, let’s look at the code controlling the supply.
Step 6: Arduino Code
- Download and install the Arduino “language”
- Download and unzip the Arduino code, arduino_2src.zip (attached below)
- Open arduino_2src/arduino_2src.ino
- Adjust the variable 'inputVoltage' to the voltage rating of your laptop adapter (see first image)
- Connect Arduino Uno to computer via USB and record its serial port
- Select Tools > Serial Port > /dev/tty.usbmodemXXXX (see second image)
- Write down this serial port designation for the next step
The Arduino is now controlling the PWM signal, defaulting to the “Off” state, in which the output voltage of the power supply is 0. We will set the output voltage using a GUI which communicates with the Arduino over the serial port.
Step 7: GUI Code
- Download and install the Processing language
- Download and unzip the GUI code, processing_gui.zip (attached below)
- Open processing_gui/processing_gui.pde
If we try to run the GUI code at this point, we see that we need to install the g4p_controls library.
(SEE FIRST IMAGE)
- Install g4p_controls library
- Select Sketch > Import Library… > Add Library… (see second image)
- Search for ‘g4p_controls’
- Install ‘G4P’ (see third image)
- select the desired output voltage from the drop-down menu
- press 'On'
Step 8: Connect Laptop Adapter
Remember that laptop adapter we made you modify in the first step? Go ahead and connect it to the rails of the breadboard now.
Remember to attach a test load resistance between the output node and ground. As mentioned before, ensure that the resistor can handle the power drop you intend to put across it. Hook up your multimeter to the output of the supply and change the voltage of 'Source 1' in the GUI. The reading on the multimeter should adjust to the voltage you set.
You now have a working digitally-controlled 0-12V power supply!! Congrats!
Step 9: Building Dual Supplies
1) Both supplies must share the same Vin rails (V+ and ground)
2) PWM pin 10 to pin 3 of the LT1632 op amp
3) A2 to the middle node of the voltage divider
For comparison with the first source:
Source 1 must be driven by a PWM generator on pin 9 and must read in source 1's feedback voltage in A1
Source 2 must be driven by a PWM generator on pin 10 and must read in source 2's feedback voltage in A2
That's it! The picture shows two supplies built on separate breadboards, but two supplies can easily be built on a single breadboard. The Ardunio code and Processing GUI are already setup to handle two sources.
Step 10: Closing Notes
- Each supply can source about 0.6A. We do not suggest going above this as the sag in the output voltage increases with smaller Rload.
- There is at most a sag of 0.2V and this occurs in a two source configuration at driving 12V when both sources are connected to small Rloads.
- The worst supply ripple observed is about 0.2V at with very low loads
- For small Rout, the buck supply can reach an efficiency (Pout/Pin) of about 90% at around 12V. This efficiency does not include the power required to operate the Ardunio.
- It is possible for the supply to output voltages up to approximately Vin-1, we leave doing this as an exercise.
Discharging Output Caps and Settling Time:
The load resistance and the output capacitors have an associated time constant. When switching from a high voltage to a low one (ex: from 12 to 1V), the output caps discharge the excess voltage through the load resistance. With very high load resistances (>10K), the output caps discharge much slower than with low load resistances (<1K). With an Rload at 20 Ohms, we've observed a settling time from 12 to 0V of about 260ms. With an Rload of 100K, we've observed a settling time from 12 to 0V of 3 minutes. Be very aware that when driving a high Rload, switching to a lower output voltage will take time. This can always be circumvented by placing a low resistance (<1K) in parallel with your Rload, again make sure that the low resistance is rated for the desired power dissipation.
The input capacitor, inductor and output cap were initially sized using this excellent documentation from TI.
The output capacitors were changed to be much larger than predicted because we wanted to cut down on the output ripple caused by the controller.
This video explains the very basics of a buck circuit in theory: http://www.youtube.com/watch?v=VCyYi9g_hI0
To learn more about Buck design check out this amazingly detailed document by TI: http://www.ti.com/lit/an/slva057/slva057.pdf
You may notice that our topology has an additional schottky diode between the inductor and the output capacitor, feedback network and load resistance. This diode was placed intentionally to aid in mitigating the effects of discontinuous mode for small output currents (large Rout). The proportional controller running on the Ardunio should be capable of working with the circuit without this diode in place, however we recommend that you leave it there.