Arduino Forum

Using Arduino => General Electronics => Topic started by: tjones9163 on Jun 15, 2019, 04:38 pm

Title: super-cap charger circuit
Post by: tjones9163 on Jun 15, 2019, 04:38 pm
Hello, i am looking into building a Super-capacitor charging circuit from the site https://circuitdigest.com/electronic-circuits/supercapacitor-charger-circuit-diagram (https://circuitdigest.com/electronic-circuits/supercapacitor-charger-circuit-diagram)
Here's what I know about the circuit according to the site.
12v goes through D3 and R8 to ground to let you know the circuit is getting power.
12v also feeds the input of the lm317 and puts out 5.3v regulated voltage on the output, according to the resistor feedback circuit.
R3 and R4 form a voltage divider that puts 4.86v on the non-inverting input of the amplifier when the reference voltage placed on the positive plate of the capacitor is fed into the inverting input.
So normally let's say with a dead cap, the non-inverting input will be higher than the CAp voltage and the amplifier will turn on the N-channel MOSFET, allowing current o flow from the drain of the MOSFET and out of the collector to charge the capacitor.
When the capacitor reaches higher than 4.86 volts it will put the output of the amplifier low, turning off the Gate of the Mosfet and at the same time turns on the PNP transistor Q2 lighting the Green LED to let you know that the Capacitor is charged.
Is how i explained it correct?
Thanks
(https://forum.arduino.cc/index.php?action=dlattach;topic=621549.0;attach=312754)
Title: Re: super-cap charger circuit
Post by: ReverseEMF on Jun 15, 2019, 06:27 pm
Well, first, I wouldn't call the voltage on the positive terminal of the Super Cap the "Reference Voltage".  The voltage on the Non-Inverting input of U2:A is what I would call the "Ref Voltage", and I would call the Cap voltage, the "Sense Voltage".

12v also feeds the input of the lm317 and puts out 5.3v regulated voltage on the output, according to the resistor feedback circuit.
More like 5.4V

1.25V/1K = 1.25mA
3.3k*1.25mA = 4.13V
4.13V + 1.25V = 5.38V


R3 and R4 form a voltage divider that puts 4.86v on the non-inverting input of the amplifier when the reference voltage placed on the positive plate of the capacitor is fed into the inverting input.
The voltage on the Non-Inverting input will be 4.86V, regardless of what voltage is applied to the Inverting input -- as long as the voltages are within proper operating ranges.

...allowing current o flow from the drain of the MOSFET and out of the collector to charge the capacitor.
Nope.  Out of the Source of Q1.  In other words, current [conventional current] will flow through Q1 from the Drain, to the Source, and out of the Source, into the Super Cap.  Also, there is no "Collector" involved.  Also, I wouldn't even do it this way.  I would either use a P-Channel MOSFET, or an N-Channel, and place it between the Super Cap negative terminal, and ground [Drain to Super Cap neg, and Source to ground].  Especially since the worst-case Gate Threshold is 4V, and that doesn't allow much head room with the current circuit.


...and at the same time turns on the PNP transistor Q2 lighting the Green LED...
Actually, Q2 should be an NPN transistor.  Unless the idea is to use the BE junction as a Zener, but then, there would be no inversion, so the LED would light when Q1 is ON, not when it's OFF.


Other than that, pretty much correct.
Title: Re: super-cap charger circuit
Post by: tjones9163 on Jun 15, 2019, 06:42 pm
Actually, Q2 should be an NPN transistor.  Unless the idea is to use the BE junction as a Zener, but then, there would be no inversion, so the LED would light when Q1 is ON, not when it's OFF.



Thank you  for the response, nut isnt Q2s base normally pulled high by 10k resistor and only when the output of the amplifier is LOW can it be activated?
Title: Re: super-cap charger circuit
Post by: ReverseEMF on Jun 15, 2019, 10:36 pm
... nut isnt Q2s base normally pulled high by 10k resistor and only when the output of the amplifier is LOW can it be activated?
Huh?!?
Title: Re: super-cap charger circuit
Post by: JCA79B on Jun 16, 2019, 12:19 am
The base of Q2 is pulled LOW by pin 7 of U2-A, turning OFF Q1 and the LED.
http://www.ti.com/lit/ds/symlink/lm311.pdf (http://www.ti.com/lit/ds/symlink/LM311.pdf)
Notice LM311 output is open collector, it's either conducting to ground or high Z.
Title: Re: super-cap charger circuit
Post by: tjones9163 on Jun 16, 2019, 12:31 am
The base of Q2 is pulled LOW by pin 7 of U2-A, turning OFF Q1 and the LED.
http://www.ti.com/lit/ds/symlink/lm311.pdf (http://www.ti.com/lit/ds/symlink/LM311.pdf)
Notice LM311 output is open collector, it's either conducting to ground or high Z.
Thank you for the response, but dont PNP transistor get activated by pulling the base to ground?
Title: Re: super-cap charger circuit
Post by: JCA79B on Jun 16, 2019, 12:50 am
Pulling LOW means connecting to ground. I don't think that LED circuit is correct. If R9 were connected between Q1 gate and the TOP of the LED it MIGHT work?
Title: Re: super-cap charger circuit
Post by: JCA79B on Jun 16, 2019, 01:11 am
I think I see it now, Q2 is drawn upside down, when LM311 output pulls LOW, current will flow from +12V into Q2 emitter (should be at top), out collector (at bottom), through R6 and LED. I think.   :smiley-confuse:
Like This?
(https://forum.arduino.cc/index.php?action=dlattach;topic=621549.0;attach=312801)
Title: Re: super-cap charger circuit
Post by: herbschwarz on Jun 16, 2019, 02:37 am
Hi All,
JCA is correct: Q2 must be connected correctly so that it can turn ON!
Also, it would be better to interchange the values of R6 & R7. Now,
look at the gate of Q1: R5 & R9 form a voltage divider so the gate
rests at 6V while U2:A is off. The Vgs(on) will keep the super cap
from taking a full charge. (How can messed-up schematics like
this be published?)
Herb
Title: Re: super-cap charger circuit
Post by: Smajdalf on Jun 16, 2019, 06:50 pm
The whole circuit from the linked page is poor. For example I see no reason for the MOSFET part of the circuit. For charging supercaps a switching voltage regulator is much better. But if you can waste the huge amount of energy and are able to withstand the heat safely linear regulator may be used:
Set output voltage of the LM317 to a value safe for the supercap. Add a current limiting resistor between 12V and input of the LM317. If you want a "charging complete" indicator simply use a comparator to turn on the LED when voltage over the resistor is sufficiently small.
Title: Re: super-cap charger circuit
Post by: ReverseEMF on Jun 17, 2019, 07:49 am
Thank you for the response, but dont PNP transistor get activated by pulling the base to ground?
Wrong way of thinking of it.  BiPolar transistors are current amplifiers.  A certain amount of current flowing through the Base-Emitter junction [in terms of conventional current, from Base to Emitter for an NPN, and from Emitter to Base in a PNP] allows a greater amount of current to flow from the Collector to the Emitter, in an NPN, or from Emitter to Collector in a PNP.  In other words, a large Collector current can be controlled by a smaller Base current.  There's more to it than that, but that's the gist.
Title: Re: super-cap charger circuit
Post by: MorganS on Jun 18, 2019, 06:36 am
Quote from: Xibit
You dude! I herd you like voltage regulators so I put a voltage regulator in your voltage regulator!
Worse than that. The reference voltage provided by resistors R3 and R4 comes from a presumably unregulated source. If you plug this thing into a 13.8V battery (very common for lead-acid batteries) then the reference voltage is out of specification. The problem mentioned right at the end of the article is due to this unregulated reference.

If the goal is voltage regulation then just set R1 and R2 to the voltage you need and leave the rest of the circuit out.

Supercapacitors are tricky beasts. I did a lot of work last year on designing a supercap to act as a load support when switching batteries in a system where there could be hundreds of milliseconds between batteries. The biggest problem is limiting the inrush current. The circuit shown is abusing the LM317 and exceeding its current rating. But only for a short period. Add a bigger supercap like 7F and you'll see the LM317 cook.

I built a lot of different circuits. I started with just resistors limiting the inrush current and a regular diode to bypass the resistors while the supercap is delivering current. With a lot of calculation and simulation of the inrush power and making some guesses on how much power a power resistor could handle for a short period, I got a good result.

Then I tried to use a MOSFET to eliminate the diode. There is a circuit called an "ideal diode" that is useful for this.

Then I used the MOSFET in linear mode to charge the supercap. I ended up with a design which still had resistors but it split the power dissipation 50-50 between the resistors and MOSFET. That design when through a lot of variations with a "current mirror" circuit and more.

The penultimate version used a LTC3824 switching regulator to charge the capacitor. This is much more efficient than resistors or transistors. At the start, when the capacitor voltage is low, it could draw only 1A from the supply but charge the capacitor at 5A. I spent many many house with LTSpice simulating this configuration. Then many more hours worrying over the PCB layout.

The final version, which I did not build, was intended to use a dedicated supercapacitor charger/discharger chip. This would be able to boost the output voltage and extract more energy from the supercap. The LTC335i has a lot of functions dedicated to this task. Unfortunately I spent too long trying to get it to fit on a 2-layer PCB when it really needed a 4-layer PCB.
Title: Re: super-cap charger circuit
Post by: ReverseEMF on Jun 18, 2019, 07:40 am
Supercapacitors are tricky beasts ... The biggest problem is limiting the inrush current.
Yes. A discharged capacitor behaves like a short.  And a discharged SuperCap behaves like one-hell-of-a-short!  So, the trick is to supply it with a source that has a very low, matching impedance, at the beginning of the charge cycle.  The best way to do that is with a current source.  A current source has an intrinsically low impedance.  That's what makes it a current source.  And, a current source capable of charging a SuperCap can be made by using an inductor to kick charge into the SuperCap at as high a frequency as possible.  A fully "charged" inductor is a low impedance source, and if that inductor is made to discharge into the SuperCap, it's a perfect marriage [with the proper selection of components vs frequency of operation, of course].
Title: Re: super-cap charger circuit
Post by: Smajdalf on Jun 18, 2019, 04:45 pm
I did not find suitable circuit on the internet so I made one (untested but I am sure it will work much better then the original one):
(https://forum.arduino.cc/index.php?action=dlattach;topic=621549.0;attach=313132)

R3 MUST be power resistor. Since dropout of LM317 is about 2V connecting a discharged cap will cause 10V over R3. So its value should be 10/(maximum allowable current) Ohm. The maximum safe current for LM317 is about 1A so R3 should be at least 10 Ohm. If power source is rated for less current, R3 must be increased accordingly. I.e. for 500mA power source it should be at least 20 Ohm. Also the power rating is important. Maximum dissipation in R3 is 100/R3 W. It is 10W for 10 Ohm resistor. A huge resistor is needed to survive this!
R5+R6 sets LM317's output voltage as usual. LM317 needs minimal load current of 10mA, this divider MUST be able to sink this current. Since there will be 1.25V over R5 its value MUST be 100 Ohm or less. Otherwise output of LM317 may get out of regulation possibly destroying the supercap.
R1+D1, R2+D2 and R4+D4 are optional for monitoring of the charging. If R4+D4 is used it will inject additional current to LM317's output which must be also consumed by R5+R6 - I think for this reason it is better to use R2+D2 instead.
C1 should be used for LM317's stability according to the datasheet.
In case the supercap is charged and connected and power source is disconnected, the supercap may discharge into the power supply via LM317 possibly damaging the regulator. The R3 may be enough to protect LM317 but adding D3 "to be safe" cannot hurt.
Title: Re: super-cap charger circuit
Post by: MorganS on Jun 18, 2019, 05:15 pm
That looks like a much better circuit. And a good explanation of it too.

The wattage on R3 does not have to be equal to the peak watts. The peak current is only for a short time.
Title: Re: super-cap charger circuit
Post by: Smajdalf on Jun 18, 2019, 08:18 pm
The wattage on R3 does not have to be equal to the peak watts. The peak current is only for a short time.
I was considering it. The dissipation will decrease to about 25% of peak value while charging the cap - but not very quickly. With large capacitance the charging time may be quite long - many seconds. I have no experience with power resistors but I don't think you can safely reduce wattage of R3 considerably - maybe to 50%? Not so great saving. OTOH with properly sized R3 the circuit will survive short on the output - I think it is a valuable property of a "simple circuit for noobs".

@ReverseEMF: You can use "normal" buck topology I think. Your circuit is a voltage inverter - there will be negative voltage on A0 of Arduino. While switching circuit is much much more effective than a linear one it is not as simple and a noob may easily run into problems.
Title: Re: super-cap charger circuit
Post by: 6v6gt on Jun 18, 2019, 08:50 pm
What, incidentally, is the application ?  If it is a simple, low current application and you can tolerate longish charging times (say a backup power source for an RTC) then the circuit can be very simple.
Title: Re: super-cap charger circuit
Post by: MorganS on Jun 18, 2019, 09:31 pm
Here's a Switch Mode strawman [untested]:
The advantage of a dedicated switcher chip like the LTC3824 is it applies current limiting to the individual PWM pulses. It switches on until the input current reaches the programmed threshold and then switches off. Then it switches modes halfway through the charge cycle to increase efficiency.  It's a standard buck converter topology with no special features. You don't need to invert the voltage.

Your scheme of "run for a bit then stop to check" is not as precise.

Speaking of the inverter, this isn't going to work as already pointed out - the voltage on A0 is negative. It also removes your control over Q3 as it will now need a negative voltage to switch off.

The simple Wikipedia diagram of a buck converter is:
(https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Buck_operating.svg/450px-Buck_operating.svg.png)

The inductor "protects" the input circuit by limiting the rate of rise of current going into the supercap. In the supercap application, the initial charge at low voltage actually sources most current through the diode. It may be getting 1A from the input and 4A from the diode. Despite sourcing current, the diode is not providing power. Just one of those odd things about current and voltage and power. Power comes from the input of course.

Here's a complete circuit using the LTC3824. This uses almost all of the advanced functions of the dedicated switcher chip. (I have left out the ideal diode circuit here.) Obviously PCB layout is critical - you can't just place all these components on a board and expect it to work.

(https://forum.arduino.cc/index.php?action=dlattach;topic=621549.0;attach=313174)



Title: Re: super-cap charger circuit
Post by: ReverseEMF on Jun 19, 2019, 12:06 am
Speaking of the inverter, this isn't going to work as already pointed out - the voltage on A0 is negative. It also removes your control over Q3 as it will now need a negative voltage to switch off.
Holy <expletive,> you're right -- removing!

How about something like this, then:

(https://forum.arduino.cc/index.php?action=dlattach;topic=621549.0;attach=313201)


Your scheme of "run for a bit then stop to check" is not as precise.
True, but, consider that it's a fixed load.  This thing has one job: Charge that capacitor.  And as long as it's the same capacitor, every time, and as long as conditions don't change much, you might just be able to get away with it.   Besides, what I'm really trying to do here is provide a stepping-off point for thought in this direction.  And, I actually did throw some components together, on a solderless breadboard, and ran it with a function generator, and Whoo-hoo, it caused the coil to kick charge into a SuperCap!  I tried three different typologies. and they all worked.

So, my reasoning is:  because this is a fixed application, it might be possible to "tune" this thing by choosing an inductance and setting the PWM frequency to it's electrical characteristics, and then "run it a bit", like I said [and the timing of that "bit" is part of the "tuning"].  And, yes, not as efficient as can be -- but perhaps more accessible to the Arduino Hobbyist most likely to visit these pages [for instance, all the parts I suggested, are "through-hole"].
Title: Re: super-cap charger circuit
Post by: MorganS on Jun 19, 2019, 06:17 pm
I like the buck converter topology. What else did you try?

We still have no idea what the supercap is for. What is it powering? But we can have some fun speculation while we wait for the OP to tell us why these suggestions won't work.
Title: Re: super-cap charger circuit
Post by: ReverseEMF on Jun 19, 2019, 06:32 pm
We still have no idea what the supercap is for. What is it powering? But we can have some fun speculation while we wait for the OP to tell us why these suggestions won't work.
Too true!
Title: Re: super-cap charger circuit
Post by: tjones9163 on Jun 21, 2019, 04:10 am
Hi All,
JCA is correct: Q2 must be connected correctly so that it can turn ON!
Also, it would be better to interchange the values of R6 & R7. Now,
look at the gate of Q1: R5 & R9 form a voltage divider so the gate
rests at 6V while U2:A is off. The Vgs(on) will keep the super cap
from taking a full charge. (How can messed-up schematics like
this be published?)
Herb
Thanks for the response, and yah you are right, i am trying to find better sites to study and eventually build easy-medium circuits. Any suggestions?
right now i use Circuit Digest, ElectronicsHub, and Makerpro.
Thanks again for the rsponse