jump to navigation

Arduino Buck-boost converter 2010/12/08

Posted by Michael in 2JZduino.

[Edit: Previously posted as a “charge pump”, I was corrected by a reader this circuit is actually a buck-boost converter…]

If you’ve ever needed a negative voltage source for components connected to your Arduino, you might find this post helpful.

I built a simple buck-boost converter circuit powered by the Timer2 Compare Match Output Unit available on the ATMega 1280 (Arduino Mega). The effort was part of troubleshooting related to the simulated crank sensor output. I thought the stock ECU might need a voltage below ground to prevent noise from triggering extra zero-crossings, but this turned out to not be the problem. So I discarded this as part of my circuit design but it was a breadboard exercise worth sharing.

First, note that I believe this interferes with the PWM functionality of the Arduino environment. If you use other functions that reference Timer2, this will break them.

On the Arduino Mega the Compare Match Output Unit can be configured to toggle the value of pin 10 (port B4) at a particular frequency through hardware (i.e consuming zero processor cycles). My charge pump design is configured for an input voltage that switches between 0 & 5V every 0.4ms.

DDRB = B00010000;  // B4 (pin 10) is an output
TCCR2A = B01000010; // Toggle OC2A on Compare Match, CTC mode
TCCR2B = B00000011; // Timer2 prescaler = 1/32
OCR2A = 0xC8; // Compare Match @ TCNT2 = 200, occurs every 200*32/16MHz = 0.4ms

Below is a schematic for the converter circuit, drawn in LTspice. V1 is Arduino Mega pin 10 (OC2A output). R2 limits the current out of the Arduino. When the output is ON L1 (47mH & 82 Ohm) is energized, and when the output switches OFF, L1 pulls current from C1 (100 uF) through D1 while it discharges. C1 is what stores the negative voltage. R3 is the load consuming this negative voltage. It’s shown as 1k Ohms, but the circuit will maintain -0.5V for R3 values as low as 220 Ohms. For high impedance loads, the circuit will generate approx. -2.7V.

The voltage at C1 vs. time as simulated in LTspice is shown in the graph below (R3 = 1000 Ohms).

And that’s it. 4 lines of code and 4 components to generate a negative voltage.



1. A b - 2011/08/31

Cool idea. With the inductor in there, it’s a boost converter. A charge pump is capacitors, diodes, and switches.

Michael - 2011/08/31

Interesting, but I’m not convinced yet :) I’m learning a boost (step-up) converter is used to increase Vin, but that isn’t the case here. Independent of the components, the circuit output fits the description of a charge pump but not the description of the boost or buck converters.

Please, help educate me.

test - 2011/09/06

A charge pump uses switched capacitors, and not inductors. Here’s an example: http://i.imgur.com/wYonZ.png

2. test - 2011/09/06

Your circuit is Figure 1 of this buck-boost converter: https://secure.wikimedia.org/wikipedia/en/wiki/Buck-boost_converter

Michael - 2011/09/07

Excellent, my thanks for the correction. I’ll update my post for accuracy when I get the chance.

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

%d bloggers like this: