cjcj:
I didn't realize that an LED could run from a neg to positive voltage - now I know.
Of course it can, just turn it around.
If I'm correct, I assume it's the potential difference between the values that drives the LED (current)??
Diodes have no concept of "negative" or "positive" in some absolute sense, all that matters in the voltage on their pins. If the anode is more positive than the cathode (and the difference is large enough to overcome the forward voltage), current will flow. If the cathode is more positive than the anode, current will be blocked.
The normal way LEDs are used here is to tie the cathode to GND and put a positive voltage on the anode, basically "pushing" current into the anode. With the inverting charge pump circuit I posted, the anode is tied to GND and a negative voltage is generated to "pull" from the cathode. The diode can't tell the difference.
I did originally experiment with formulas (using the analogWrite) function. I came up with a formula based on the input voltage, diode voltage drop, 0 to 255 range and output voltage. But the circuit wasn't working for me. I'm assuming I'll be doing the same here now with this new setup?
I addressed this as the 1st point in my findings. Duty cycle does nothing. In fact, most of those waveforms that I generated with the simulator had a 0.5% duty cycle (1 ms period, 5 us on). It is frequency that you need to change, not duty cycle. That's why I said to use the tone() function, not analogWrite().
I did however work out that I could still see the LED blink quite clearly (even in sunlight) at as low at 1mA. So that's the value I'm aiming for.
That's what I was expecting to be a good value too.
Answering your questions:
- I assume V1, V2 and V4 are voltmeters taking measurements?
They are voltage sources. V1 and V2 are standing in for the pumping waveform that would be generated by the tone() function from the Arduino. Just imagine that one pin from the microcontroller is connected to both capacitors.
- You've listed diodes D1 to D4, yet you mentioned I only need 3
D4 is standing in for the LED, and V4 is used to simulate the higher forward voltage needed (2V instead of 0.7V). I did it this way so I could simulate how different forward voltages affected the output current.
- Capacitors C1, C2 and C3 - are they 10uF electrolytic (say 16V rated)?
The two pump capacitors (C1 and C3) should be identical so that it's predictable. C2 is less important, though I'd recommend it be at least as large as the other two. I used 1uF for the pup capacitors in the simulation, but they can be adjusted: higher capacitance will result in more current for the same frequency. They probably don't need to be as high as 10 uF though, I'd start with 1uF, 4.7 uF at the most. The pump circuit will produce pulses of current, and you want that frequency to be high enough so that it's not visible.
- Is the triangle symbol on the left of diode D1 and at the base of C2 a ground symbol?
Yes, that is the symbol LTSpice (the simulation program) uses for ground.
- As I'm using an RGB LED, where do I connect the red and the green leg - I can only see one output on the circuit
I forgot about that little wrinkle. I thought I come up with something before but I've forgotten. Is it common cathode or common anode?
- Instead of schottky diodes, can I instead use switching diodes (say IN4148)?
You can, but Schottkys have lower forward voltage and will cause less problems as the batteries discharge.
I'm also not very conversant with the tone function. Reading up there are two options:
tone(pin, frequency), and
tone(pin, frequency, duration)
Which should I be using?
The one with duration, then it will stop automatically after a certain amount of time.
I assume this is what you were showing in your schematic, but I didn't understand the terms such as "PULSED(0 {VIN} 0 1n 1n 5u {Period}). I think I need a little bit of a push start here too.
Those are just the properties of the pulse voltage source I used to simulate the square wave output of the microcontroller. It sets the voltage levels, rise and fall times, period, etc. Don't worry too much about it.
My my simulations, using Schottky diodes, C1 and C3 = 1uF, and C2 = 10uF, you would need a tone() frequency of about 800Hz to put about 1.15 mA into a 2V diode when the battery's at 3V, and 2500 Hz when it's at 1.8V. This is a very doable frequency range if the simulation is accurate to how the actual circuit will behave.
If you do build this circuit with electrolytics or some other kind of polarized capacitor, remember that the negative lead needs to be connected to the diode line. The positive leads of C1 and C3 get connected to the microcontroller pin, and the positive lead gets connected to GND.