Creating negative Voltage with Arduino Mega 2560

Hello,

i just wanted to make a short tutorial on how to create a negative voltage with an
Arduino Mega2560 Board:

You will need:

2 x Diodes
2 x Capacitors (1 uF and 15 uF)
1 x PWM Output from Arduino

  1. Create PWM with Arduino on PIN 11:

DDRB = 0xFF;
TCCR1A = (1<<COM1A1)|(1<<COM1B1)|(1<<WGM11)|(1<<WGM10);
TCCR1B = (1<<WGM13)|(1<<WGM12) | (1<<CS10);
OCR1A = 16000000 / (frequency * 1) - 1;
OCR1B = OCR1A * dutyCycle / 100;

DutyCycle should be 50 [%] and Frequency is up to you in [hz] (250 Hz up to 4 Mhz is possible). You may experiment with those two parameters.

  1. The Schematic:

At V- you get roughly -4.8 Volts. I've tested it with an LED and it is possible to draw current from this.

This is something I found randomly by trying and thought I'am going to share this with you.
Have fun with it!

Nice tutorial :slight_smile:
FYI, this is called a charge pump.

This could definitely be useful--but how much current can it supply (or how many milliwatt seconds in a burst once charged), and how much would it draw sitting idle?

my RC is woefully out of date, but won't the 15 uf be charging off the "leftovers" for pushing current to ground?

dochawk:
but how much current can it supply

That depends on quite a few variables the ripple you are willing to accept.
Note that at any significant current, you "lose" 2x diode forward voltage (2x ~0.7V for standard Si-Diodes), so Schottky diodes might be worth it (2x 0.3-0.4V)

Some example values (Didn't test in reallife, this is simulated, assuming 100 Ohm output impedance of the arduino digital pins)

50kHz, 1uF, 15uF:
-1.0V: 7.0mA @ 0.2% ripple
-2.5V: 3.4mA @ 0.06% ripple
-3.3V: 1.6mA @ 0.02% ripple

10kHz, 1uF, 15uF:
-1.0V: 7.0mA @ 1.2% ripple
-2.5V: 3.4mA @ 0.26% ripple
-3.3V: 1.6mA @ 0.1% ripple

10kHz, 1uF, 75uF:
-1.0V: 7.0mA @ 0.25% ripple
-2.5V: 3.4mA @ 0.05% ripple
-3.3V: 1.6mA @ 0.02% ripple

As you can see, ripple is ~1/f and also ~1/C

I found that increasing the 1uF doesn't do much, but drastically reducing it will decrease the performance quite a lot.

Concerning the duty cycle: 50% is the "best" in terms of highest efficiency and output, but reducing the duty cycle is a possible way to closed-loop-control the output voltage.

It's far from linear though and low duty cycles will cause high current peaks on the arduino digital pins, so on your own risk.

dochawk:
how much would it draw sitting idle?

After the caps are charged pretty much nothing.
<1mA within 25ms
<100uA within 70ms
<10uA within 0.4s

Worth a google this for adding extra stages to generate higher voltages - good fun

A second PWM output/circuit, 180° out of phase, connected to a shared 15uF cap, reduces ripple and increases current capability.
Leo..