Arduino DC-DC Boost Converter Design Circuit with Control Loop
May 24, 2016 By justin bauer
This post will cover how to use an Arduino Uno to easily control a 10W+ boost converter.
A discrete boost converter can be built by using just a few parts, namely an inductor, capacitor, diode, and a FET. Please see the Wikipedia page for how the circuit works. It works off of the premise that an inductor will store energy in its magnetic field and then when it collapses (switch opens), it will resist the current change and reverse its magnetic field polarity so as to keep current moving. The voltage at the switch node can then be summed from the input to output to create a higher voltage at the output. Keeping the switch closed 100% of the time will merely charge the inductor and the output will equal 0V. Keeping the switch open 100% of the time will cause the inductor to act as a resistor at steady-state and the output will approximately equal the input voltage. Turning the switch OFF and ON rapidly will allow the inductor to charge itself when the switch is closed and then dump energy into the output capacitor when the switch is opened. Care must be taken into choosing how long to keep the switch closed since you do not want to saturate the inductor and cause the current to drop to 0A. The two different modes of operation, continues and discontinuous, refer to the current through the inductor. See this paper for more information on the two modes. Essentially you will want your circuit to operate in continues mode so that the the output voltage does not droop below the intended target and it lessen the effect on radiated emissions which will need to be mitaged to pass CE certification.
Here is the circuit I made in LTspice, a popular and free SPICE simulation software. Another option is to use the Lite version OrCAD PSpice Designer. I've used both and the OrCAD one seems less clunky than the LTspice version.
|L1||811-1335-ND||IND 330UH 2.8A 150 MOHM|
|Q1||IRLI640GPBF-ND||MOSFET N-CH 200V 9.9A TO220FP|
|D1||497-3216-1-ND||DIODE SCHOTTKY 150V 3A|
|C1||493-1164-ND||CAP ALUM 47UF 20% 160V RADIAL|
|R1||150W-5-ND||RES 150 OHM 5W 5% AXIAL|
This boost converter can safely boost a small voltage of a few volts to a larger voltage of 100V+ as long as the absolute maximums of the parts listed above are not violated. The converter is most efficient when the delta between output to input voltage is small. For example, boosting a 5V input to 80V will not be as efficient as going from 40V to 80V. You will need to experiment with the simulation in order to determine the output vs input curve without saturating the inductor. A 5V to 100V boost is obtainable at high loads with this design, but it will consume too much input current at lower loads.
As a safety precaution, get a power supply that is capable of current limiting to 2.5A. This will ensure that the inductor and schottky diode are not damaged. The output voltage must also not exceed ~140V since the blocking voltage of the schottky is rated up to 150V and the capacitor is 160V.
Before I purchased the above parts I did some simple simulations inside of LTspice. I need the input current to be less than 2A and output voltage to be between 24V-100V. The square wave input to the FET simulates the Arduinio PWM. I fixed that to a frequency of 62KHz which is what the max PWM frequency of the Arduino is. The on time was adjusted to achieve various voltage points and to operate in continuous conduction mode (current does not fall to 0A).
10V Input to 24V Output
4.8V Input to 11V Output
Notice how these two images show a different output voltage, yet the same PWM period. The real-life PID should correct the PWM output to produce a constant 24V output.
Below shows the inductor current varying between .6A and .3A. This is what we want.
This picture from this TI app note shows a discontinuous current mode. Notice how the current drops to 0 before the switch is closed again.
Here is a table of efficiencies across different input and output voltages
|Input (V)||Input Current (A)||Input Power (W)||Output (V)||Output Current (A)||Output Resistance (Ohm)||Output Power (W)||Eff (%)||Setpoint (ADC)||PWM (counts)|
You should notice a few trends.
- The Arduino PWM value is on LESS as the efficiency increases.
- The efficiency goes up as the difference between output to input voltage decreases
- Input current goes up as the efficiency goes down
The 150 Ohm 5W resistor will get hot during testing. You can feel the heat radiating off the package. 100V is possible as already shown, but the output current was only at 10mA. I could increase this value to something meaningful, but I didn't have a suitable resistor that wouldn't burn up. You could easily adapt this to work for nixie tubes.
I tried boosting a 3.3V->24V, but the 300uH inductor saturated and the output voltage was capped at 18V. If you see this happening with your control circuit then I'd recommend increasing your inductor value.
github of the Arduino source code.
The code uses PWM pin 6 to control the FET and a resistor feedback network on pin 0.
The feedback network consists of a 1K resistor to GND and 100K between the ADC pin and the output voltage. The ADC value can be determined as follows:
ADC = Vout * 1k/(100k+1k) ===> ADC = Vout*1/101
So, a 10V output will read 99mV on the arduino pin. The arduino pin should never exceed 5V. It is 10-bits, so each bit resembles ~4.8mV (5V/1023). A 24V output would yield an ADC reading of 48
(24V/101) / (5/1023). You can improve the resolution by using say 1K and 10K resistor network. I only had a 100K resistor laying around.
I am using this PID library. The PID constants were chosen based on experimentation. The trick is to 0 your
Kd and play around with
Kp until the system oscillates. You should see the input current bounce up and down around the set-point. Then increase
Ki a bit until the settling offset error is eliminated. Increase
Kd to mitigate the high dv/dt spikes.
double Kp=.2, Ki=.4, Kd=0;
I had to manually set the PWM frequency to 62KHz for the boost converter to work properly. The default PWM frequency is not high enough and will not work with good efficiency. You may see other libraries that rely on timers to not work correctly after adjusting this frequency. A huge drawback of using the Arduino is that changing the default behavior is a major pain and causes other nested libraries to stop functioning properly.
I have placed some simple uart
println statements to make debugging easier. You can watch these in realtime by using the serial monitor. The top line is the ADC input and the second line is the PWM output. The output is capped at 220.
As always, here is a picture of my sloppy setup.
And the schematic
I would like to point out that Fritzing as a schematic tool is just awful. I think I'm going to go back to my regular schematic capture tools such as diptrace or OrCAD.
Make sure to connect the Arduino's GND and your power supply's GND together. The gate resistor to GND is to ensure it is properly turned OFF when not in use from the Arduino.