Boost Converter Intro with Arduino

Driving some neon lights.

Let’s say that you’re trying to drive a few Nixie clock tubes, or you want to make a strobe light. A variable high voltage DC power supply from 50-200+ volts may be required. Transformers are terrific, but difficult to find the right one and a pain to wind. Why not use a boost converter? They’re easy and don’t necessarily require a guru for basic operation. This guide is meant for the individual who wants to build a simple boost converter, and may need refreshing on the theory. It will also help determine what parts will be required.

Is this guide right for you?

boost equations

Basic inductor and boost converter equations. D is the duty (0 fully off, 1 fully on)

Boost converters typically get less efficient as they increase voltage out/voltage in ratio. If 100+ volts are required from a 12v source, the load will need to be a fairly high impedance. Don’t expect to run a 60watt light bulb from this boost converter! If precision is required, you may want a dedicated boost converter IC which will do the job better. This guide is intended for educational purposes.

Microcontroller:

I’m going to be using, oh you guessed it — an Arduino for this example! As usual any micro controller will do (3.3v or 5v), but this project requires analog voltage reading. If your favorite micro controller doesn’t have an ADC (Analog to Digital Converter), buy one or you can make your own!

Theory:

Boost converters work by taking advantage of a fundamental property of inductors: inductors use stored energy to maintain current. The key is that the inductor will vary voltage to maintain whatever current was present before the system (circuit) changed. Once the power supply is removed from a charged inductor, it may be easier to think of the inductor as an electromotive force rather than a passive component. Refer to the images to see it a bit more illustrated. Some of the key inductor equations are also listed.

boostbasicschematic

Basic overview. Original image from Wikipedia.

On state – Current can flow through the closed switch. There is a potential difference across the inductor. The fundamental property of inductors tells us that the inductor resists change in current. Initially the inductor current is near zero when the switch closes, but current will ramp up quickly as the inductor charges till the circuit goes into the Off state.

Off state – Current no longer flows through the switch. The inductor tries to maintain current, and it acts as a current source which means that voltage can sway, in this case it flips polarity due to discharge. The inductor voltage will immediately jump up to the voltage of C3 and maintain original current till the potential energy of the inductor is transferred to the capacitor. As the capacitor charges, the inductor will continue to jump up the the capacitor’s voltage, even if it’s much greater than Vin.

The Circuit:

boost converter circuit

Schematic, C1, C2 are 12V. C3, FET1, and D1 must be rated for high voltage output. Arduino shares ground with this circuit. ~12v means around 12v, that’s not a negative.

The mosfet(FET1), diode (D1), and capacitor (C3) will need to be rated for voltages greater than the peak voltage. The mosfet and diode will need to have a current rating greater than the current peak — see equations. The more capacitance the better, and a ballpark number from the capacitor equation isn’t a bad idea. When it comes to duty, I would suggest not going over a .9 (230 duty for Arduino pwm) duty. If you already have a diode you want to use, then use the diode’s max current as the peak current and solve for the duty. This will be the maximum duty without damaging the diode.

Important: Mosfet Driver for the IRFP260N is required. This mosfet’s Gate-Source pins have a capacitor in parallel (downside on all mosfets). This capacitance is significant and will tend to resonate with the Arduino’s signal. This may damage the Arduino, and will dramatically reduce mosfet efficiency.

boost converter circuit

Boost converter circuit.

Frequency: My Arduino sample code will be using f = 31250 Hz pwm. It seems like any higher frequency results in a less efficient system, and 31250 hz is inaudible. This will also be using phase correct pwm – more on this in section 17.7.4 atmega328 datasheet.

Feedback: There are calculations to estimate the high voltage output, but in reality there are many factors which affect this output. I found that a feedback system works better. This feedback will output 5v when C3 is at 255 volts, and output 3.3v at 168V. If the feedback voltage is too high for the ADC, adjust the voltage divider! Look at the TI pdf at the bottom (pdf pg 9).

Selecting parts:

Here are the key components that may need to be purchased. I suggest buying from Jameco or Digikey if purchasing in the states.:

  1. Capacitor – There will need to be a high voltage capacitor – larger the better. I used a 330uF 200V capacitor that I found in an old computer Power Supply Unit. Laptop PSU (usually), computer PSU, and CRT monitors will have decent sized high voltage capacitors. Find an old CRT monitor to dig into! Check myEasy High Voltageguide to safely discharge a CRT monitor. Buy some capacitors here, or here!
  2. Diode – A regular 1N4007, but it’s not recommended and will probably fail! A Schottky diode or some other ultra fast recovery diode is much better. There are some nice diodes in CRT monitors. I’ve used the RL4Z, 5JUZ47, 5VUZ47, all scavenged from CRT monitors. Buy some here, these should work too.
  3.  N channel mosfet – IRFP260N available here or here, rated for 200v, 49A.
  4. Neon Light. With DC, the ground is what lights up!

    Mosfet Driver – I’ll be using the MIC4422YN. The MCP1407  or the UCC27424P should work too. If using more than 12 volts, watch the voltage requirements of these guys.

  5. Inductor – Buy or make your own inductor. I’ve used a 120uH, 871uH, 1000uH, and a 5000uH inductor with this circuit. All work fine. Larger inductors store more energy in its inductance which requires less current. The main drawback is that Equivalent Series Resistance (ESR) is higher with inductors that have many windings. When buying an inductor, watch the current rating!

Code for Arduino:

Simple code: boost code

PID code (Arduino pid library 1.0.1): boost code PID

Download .pde files from Rapidshare (down) – I’ll eventually put everything up on github. I know those pdfs are very inconvenient

Other Notes:

With boost converters, core saturation can be an issue with some designs. Remember that this design charges up a capacitor to 200V! This is dangerous and could be deadly if misused! The inductor is a current source when it’s discharging. Beginners are unfamiliar with current sources so I avoided explaining it like that.

Here’s an example of a dedicated buck/boost converter IC from sparkfun!

Handy References:

It’s always difficult knowing how in depth to go in the guides. My guide was written to get the nooblet up and on his feet. If this isn’t enough I’d suggest the links below. The TI boost guide really goes into detail.

Adafruit boost guide

Smps overview (pdf)

TI boost guide (slva061.pdf)

nixie clock from Jameco schematic
Daycounter Boost Converter guide

About Moser
Electrical Engineer who loves to bike!

52 Responses to Boost Converter Intro with Arduino

  1. Pingback: An introduction to DC boost converters - Hack a Day

  2. Pingback: An introduction to DC boost converters analyser.fevroplast.gr

  3. John R says:

    Would you be better off with a moderately sized film cap rather than a large electrolytic?

    Have you had a look at the output on a scope?

    I did almost exactly the same with my pic based nixie clock – I found that it was very easy to generate a high voltage, but required a bit of tweaking to stop the voltage swinging – although mine was purely proportional – and the rough output was perfectly fine for some nixie tubes!

    • Moser says:

      Yes I agree with you John a smaller cap may be used, and would be recommended for a permanent installment. That being said, I would redo most parts if it was for permanent installment. These just happen to be the parts that I have laying around. I found that with very small loads or larger loads the system can be finicky.

  4. Ken Smith says:

    You can get complete boost switchers in an SOT-23 or SO-8 package from Linear. If you need just to make a fixed voltage it is easier to just stick one of those in.

    If you want to control the voltage a resistor from the PWM of the micro to the feedback network works nicely. You fool the chip into thinking it has a higher output voltage that it really does by pulsing the pin high. This make the control number backwards to the normal but people usually get over that quickly.

    • Moser says:

      Great Idea. Yes there are great boost converters available. Sparkfun has one, and maxim makes a few. Maxim offers free samples for educational and business use. I will add that to the post.

  5. Matjaz says:

    I highly recommend you look output signal with oscilloscope. You will see a lot of pulses (witch you can get rid off with film capacitor in output).
    Also is good to look at mosfet’s source current – witch must be like ramp.

    Have you measured effectivity?

  6. Pingback: Electronics-Lab.com Blog » Blog Archive » Boost Converter Intro with Arduino

  7. jeff says:

    Looks great. Going to try this out. Question about the code though. You have this line:

    myPID.SetOutputLimits(0, 100);

    So, the max output will be 100. But is that 100% duty cycle or is that 100/255 (~39% duty cycle). Not sure how it’s scaled, but I’m used to setting duty cycle with analogWrite().

    • Moser says:

      yes the duty cycle max is 100, but the OCR2A register is 0 to 255, so it’s 100/255 was the max in my example. You could set it to higher, but dont go above around 250

  8. Pingback: PID Tuning Parameters for a boost converter.

  9. Vijayaragavan CM says:

    Can anybody tell me the procedure for simulation of Digital PID Controller for Buck Boost converter in SimuLink. Please explain with its all parameter values.
    kindly send replis to my mail which is ragavan.cmv@gmail.com.

  10. KD says:

    Hi, can this work with a variable input that goes form 5-18V to give a constant output voltage of 80V?

  11. Pingback: dc dc converter 12v to 180v

  12. ADM says:

    If I just change the configuration/arrangement of the same components into a buck converter configuration, will it work?

    • Moser says:

      http://en.wikipedia.org/w/index.php?title=File:Buck_operating.svg&page=1
      Yes I was testing some high power LEDS by just making a buck converter with arduino. If you look at the image above, the mosfet would have its source connected to the positive voltage rail. So use a P channel mosfet. Experiment with it before you connect any real loads. Have it shut off if the analog feedback is above 1023. I’d also check the output with an oscilloscope too!. You can use an N channel fet, but you’ll need a bit more of a complicated mosfet driver.

      • ADM says:

        A complicated mosfet driver? Can you give me a suggestion? I have a high-side mosfet driver (TC4427CPA) and a n-channel mosfet (MTP3055VL). I’m not sure if I should use what I have or use a low-side mosfet driver like in your case

  13. mira says:

    Hi,
    I really new for this. I just copied your code and compiled. The results turn out to like this:

    myPID:10: error: ‘PID’ does not name a type
    myPID.ino: In function ‘void setup()’:
    myPID:15: error: ‘myPID’ was not declared in this scope
    myPID:15: error: ‘AUTOMATIC’ was not declared in this scope
    myPID.ino: In function ‘void PidUpdate()’:
    myPID:35: error: ‘myPID’ was not declared in this scope

    Is there anything that i’ve been missing?Please help

    • Moser says:

      Are you sure you installed the library correctly? if so, use arduino version 0022 with the pid library beta.

      • mira says:

        i already solved the problem. I search how to install the library. For now..i don’t understand the function of double voltage. why so? could you please further explain about this..thanks in advance

      • Balajee says:

        how did you solve this
        myPID:10: error: ‘PID’ does not name a type
        myPID.ino: In function ‘void setup()’:
        myPID:15: error: ‘myPID’ was not declared in this scope
        myPID:15: error: ‘AUTOMATIC’ was not declared in this scope
        myPID.ino: In function ‘void PidUpdate()’:
        myPID:35: error: ‘myPID’ was not declared in this scope

      • Moser says:

        install the pid library. I had good luck with doing pwm output = ( target voltage – current voltage)*10. That’s a super simple proportional controller that doesn’t work too bad for a boost. Make sure that the min is 0 and max is less than 250

  14. alex says:

    May i.ask whats the minimun and maximum voltages provided by such a circuit (if for example the starting voltage is provided by a 12 volt battery) and further more can incriments on one volt be produced?…

    • Moser says:

      It’ll get less efficient as your input to output ratio increases. If you need a high voltage output from a low voltage source use a transformer.

  15. Janice says:

    could it work in buck-boost converter?

  16. drfenix666 says:

    Reblogueó esto en drfenix666y comentado:
    Something 4 my thesis

  17. robot797eter says:

    i have a realy realy great question

    if i were to use an attiny as a arduino
    to make 60V (from 5 V)
    and 22hz with like 2 second delays

    is that posible?

    and if so how does i calculate it
    (the max ampere is 50 mili amp)

    i need this becaus i am building a phone
    and the ringer needs like 50 a 60V

    and i thought i would use this

    https://www.sparkfun.com/tutorials/50

    but then i found your site
    and i thought what if i could fit all funktions on an attiny
    and controll it with a high low signal

    that would also make a fun ringer that funktions on a switch

    • Moser says:

      Yeah that will work. Just get the attinys pwm frequency in the 10kHz to 100kHz. Read the details on all the application notes on my site.

      The chip from spark fun will do a better job than the attiny. You’ll need a proper transistor for the boost switching

  18. fajarrukmo says:

    nice project. and it’s work for my project. thank’s

    but how about current control and voltage control run together. Is it possible?

    • Moser says:

      current shunt resistor on the high voltage side, measure the voltage drop across it to control voltage to maintain your target current. If current is within limit then up the voltage to your target voltage

  19. Tyler says:

    If I were to have a variable input (45v-75v) and needed a steady 100v output how exactly would I do this? I also need to run the circuit at 200kHz pwm. I appreciate the help.

    • Moser says:

      you’ll need a boost chip if you need 200KHz. Arduino max is ~68 or so KHz – it might be ~31.2KHz. I would use a voltage divider to divide 100v into 4v and do a proportional controller on the boost circuit — if i used an arduino.

  20. lsmorato says:

    Hi, here in Brazil I only found the IR2101 mosfet driver. Do you think this chip could be used instead the mic4422?
    I’d like to make a ramp from 0V, or almost, to 250Vcc with 150mA, do you think that is possible?
    thank you!

  21. Jasim says:

    Hi , you did a great job
    if I need output voltage 12, How much set point would be?? Also, can I use Basic PID Library code http://playground.arduino.cc/Code/PIDLibaryBasicExample. instead of yours. ( I have Back Boost converter http://www.hirelsystems.com/shop/Power-Pole-Board.html
    and I would connect Arduino as feedback controller… Please help

    • Moser says:

      Set target voltage to 12. You might want to start with the simple example and use a proportional controller: Pconst*(targetVoltage-targetVoltage) = pwm, then check to ensure pwm is below the max pwm level you feel is suitable… maybe 240 — don’t send 255 since that will just be shorting out your inductor to the power rail

  22. Akmal says:

    hi, i want to ask where did you get the this value
    double R2 = 200000;
    double R1 = 10000000

    why need to times by 4.9
    double voltage = (analogRead(A1)/1023.)*4.9*(R2+R1)/R2;

    I appreciate the help

    • Moser says:

      google ‘resistor voltage divider’ the equation is from that. Actually in this post i think it should be ‘double voltage = (analogRead(A1)/1023.)*4.9*R2/(R2+R1);’

  23. Nicos says:

    Hello, i’m try to make my own boost but i have some problems. I think that the inductor is the cause of all that. The main problem is that he actually works as buck, crazy. I used home made inductor, with ferrite’s core. I think that what happen is that my inductor can’t stores 1/2LI^2 energy, cause the permeability is too much high. Do you think that this could be the reason? Should the inductor be with air or with out? Should the inductor be able to store that energy?

  24. Bandile says:

    i am doing a boost converter for a variable input of 25-35 V to 65V constant output , how can i modify the code. really need help. thanks

  25. bayu rentaro says:

    excuse me, I want to ask you something about “how to change the frequency from 31250 Hz to around 50000 Hz or anything else that we can change the frequency”. please how ?

  26. Pingback: Boost converter och Regen i controller – dev.smedby.net

  27. karthi says:

    boost converter program please add

  28. karthi says:

    boost converter arduino program please add

  29. Bambang Purjianto says:

    Hello sir.
    i wanna ask you about this post.
    i have made a BUCK-BOOST converter for charging battery with solar cell using arduino uno.
    but i have a problem with my program. my program it’s doesn’t work.
    can you help me with my problem?
    because this is my final project for my graduation
    thank you sir..

  30. Thomas Gerrits says:

    Im using a similar design to make a 4-quadrant chopper prototype. I use the same gate driver. Is there any reason that during operation the input voltage to the gate driver would be shorted to the input of the converter? This seems to be happening to me when I use the converter, but when it’s turned off they are not shorted.

  31. Hi there,I log on to your blogs named “Boost Converter Intro with Arduino | ReiBot.org” on a regular basis.Your humoristic style is awesome, keep up the good work! And you can look our website about تحميل اغانى.

Leave a reply to ADM Cancel reply