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 these ads

About Moser
Electrical Engineering student who loves to bike!

38 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!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s