0

How do I supercapacitor (was What Kind of Connector is This?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: What Kind of Connector is This?

by crono141 on Mon Jan 02, 2017 5:14 pm

Doesn't the Pi have built in pull-down resistors on its GPIO pins?

crono141
 
Posts: 21
Joined: Sun Dec 11, 2016 11:55 pm

Re: What Kind of Connector is This?

by zener on Mon Jan 02, 2017 7:50 pm

According to this:

http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/gpio-pin-electrical-specifications

They have a programmable pull up or pull down capability, but the exact value of the resistance is not specified (even though it shows 50K on the schematic there). It is likely not an actual resistor.

zener
 
Posts: 3884
Joined: Sat Feb 21, 2009 2:38 am

Re: What Kind of Connector is This?

by crono141 on Mon Jan 02, 2017 10:11 pm

OK, I've determined that my original idea for a battery isn't going to work because the battery will supply power for (a long time) while the pi is shut down, and so when main power comes back on the pi won't boot up because it never saw a drop in supply. So I think I'll have to go with your supercap idea in order to make this work.

I've done some reading about supercaps, but I have questions because I'm a circuits noob. If I get 2 supercaps in series, do I connect my supply voltage to the + side of the first cap, - on first to + on second, and then - on second to the Pi? In essence, connecting the same as a pair of batteries? Second question, will this capacitor bank charge in this orientation without a limiting resistor? Or will the presence of the pi on one end act as a limiting resistor?

Image

3rd question: will the Pi get the power it needs to boot while the capacitors are charging?

Thanks again everyone for your help!

EDIT:

Or should the schematic look like this:
Image

Since capacitors discharge in the opposite direction that they charge in, if I put them in parallel with my 5V line, with the other end attached to ground, they should charge in this orientation when a 5v supply is present. And then when the 5v supply is cut, they should discharge back through the pi and into ground. Does that sound right?

crono141
 
Posts: 21
Joined: Sun Dec 11, 2016 11:55 pm

Re: How do I supercapacitor (was What Kind of Connector is T

by zener on Tue Jan 03, 2017 12:49 am

Your images didn't come through. Yes it will charge and discharge as you say. I would just use a 5V super-cap such as FS0H224ZF. Stacking super caps can be tricky since the voltage has to stay balanced. This one has enough ESR (resistance) to keep it from killing your supply. You will have to calculate the hold up time or experiment with it. They have larger ones if you need more Joules.

zener
 
Posts: 3884
Joined: Sat Feb 21, 2009 2:38 am

Re: How do I supercapacitor (was What Kind of Connector is T

by crono141 on Tue Jan 03, 2017 11:37 am

Thanks, zener. Sorry about the pictures. Can you check again?

Also, I did some quick and dirty math with some probably poor assumptions. Utilizing info here, assuming 220ma power usage during shutdown, a voltage drop from 5 to 3.3 v, and 10 second run time, I would need a supercap of approx 8 farads. But that 220ma is a big assumption.

It looks like MAL219691214E3 in series with a 20ish ohm resistor should do the trick, and give me either twice the time or twice the drawn current as a buffer.

And just to be clear on the circuitry (if my images don't come through), to charge we connect the + lead of the cap to the + end of voltage supply, and the negative end to ground. The same + end connected to the cap is also connected to the pi, so that the cap is essentially in parallel with normal supply.

crono141
 
Posts: 21
Joined: Sun Dec 11, 2016 11:55 pm

Re: How do I supercapacitor (was What Kind of Connector is T

by zener on Tue Jan 03, 2017 2:48 pm

Yes the wiring you describe is correct. Keep in mind any series resistance to the cap limits both the charge AND the discharge current. If you just want to limit the charge current then you can put a shottky diode in parallel with the resistor.

zener
 
Posts: 3884
Joined: Sat Feb 21, 2009 2:38 am

Re: How do I supercapacitor (was What Kind of Connector is T

by crono141 on Sat Jan 21, 2017 10:16 am

OK, sorry for resurrecting this after 3 weeks, but I had to order parts a couple of times. The first capacitor I ordered, while it had the requisite voltage and capacity, could not supply enough current (only a few 10s of ma, instead of the 500ma+ I'd need to run the pi). I could not find a single capacitor that would supply 5V+ and was also rated at a discharge amperage that would work, without having 90F capacitance (which would last too long).

So I ended up with the original plan of using two 2.7V 30F capacitors in series. Initially I didn't have a balancing circuit. I had no success at all. It seemed that the caps were not charging. I added a balancing circuit then to see if that would help (it didn't). Here's the circuit as it stands now:

Image

I took my volt meter out and measured voltage around R1 while the hole thing was running (pi booted), and got 5 ish volts. But when I measured on either side of the capacitors, I only was getting 0.6V. I then attempted this circuit without the R1 resistor. I then measured 4.6ish volts on either side of the caps, so I thought "great, its charging up now". I let it sit and then cut the power. I think I got a few second of operating time, and then the cap voltage dropped too low and the pi "quit". I have "quit" in quotes because what happened is the red LED went out, but the green one stayed lit/flashing. I imagine this is a visual indicator that your supply voltage was too low. No worries I thought. I cut the power back on, but got no change. Pi didn't boot. I measured my supply voltage (with the 5V supply on), and I was only measuring 2.8V-3.2V. I have no idea why this happened, and my first thought was that I blew up my 12v-5v converter. I turned everything off and discharged the caps. I added my R1 back in and turned it on, and low and behold the Pi booted. But I was back in my initial situation of only getting 0.6V across the capacitors. It worse after I added the balancing resistors, because then my voltage only measured about 0.25V. I let it sit again for a few minutes to see if the caps were in fact charging, and after many minutes the voltage did measure 1.2V. But this was after sitting for like 5 minutes.

I have no idea why this isn't working, or working faster. So I have many questions: are my resistor values too high (especially R1)? 100 ohm is my smallest resistor that I have, but I can daisy chain 4 or more in parallel to get a smaller inlet resistance. Should I do the same for my balancing resistors? Based on experience, how long should it take to charge these caps? Do you know the muffin man? Is there anything obvious that I'm doing wrong?

Thanks again in advance for all your help.

EDIT: I think the ideal situation is obviously that the caps charge while the Pi is on so that I still get that nice instant on action. But the next best thing would be if we could charge the capacitor circuit first, and once its charged switch the juice on to the pi. I have no idea how to do that, though.

crono141
 
Posts: 21
Joined: Sun Dec 11, 2016 11:55 pm

Re: How do I supercapacitor (was What Kind of Connector is T

by zener on Sat Jan 21, 2017 4:24 pm

First of all turn your diode around. You want to limit the current when you charge the caps not when you discharge. Ideally that is a Shottky diode.

Now, R1 should be sized to protect your power supply. So, for example, if you have a 5A supply then you would want R1 to be about 1 ohm. You don't want your supply to see the caps as a short and turn off or blow up.

Balancing caps are a "two sides of the coin" kind of thing. The smaller their value, the better they balance, but the more energy they waste. 100 ohms seems like a good choice for those.

zener
 
Posts: 3884
Joined: Sat Feb 21, 2009 2:38 am

Re: How do I supercapacitor (was What Kind of Connector is T

by crono141 on Sat Jan 21, 2017 4:40 pm

Thanks. I think I just have my diode symbol backwards. It's assembled properly on the proto board.

And with such a low recommended R1 resistance, do you think I could get away with just not having one? I don't think the supply will blow, but when I went without before I only ended up with 3V to the pi, so it didn't power on. That's what's mysterious to me.

crono141
 
Posts: 21
Joined: Sun Dec 11, 2016 11:55 pm

Re: How do I supercapacitor (was What Kind of Connector is T

by zener on Sat Jan 21, 2017 4:48 pm

You need to determine how many amps your supply can put out and how many amps the caps are drawing when charging from fully discharged. I am guessing you will need some resistance. You need to determine how long they will take to charge. Big caps will take a while. You also need to determine (from the cap date sheet) if they can put out the current level you need. It depends on their internal resistance.

zener
 
Posts: 3884
Joined: Sat Feb 21, 2009 2:38 am

Re: How do I supercapacitor (was What Kind of Connector is T

by crono141 on Sat Jan 21, 2017 6:41 pm

I appreciate all your help.

I've made some progress. Things obviously didn't work out the way I wanted them to, and I think I'm going to have to take things back to square one because of it.

I ended up removing the 100 ohm R1 resistor and just put a straight wire into it. I measure the resistance across that wire and its about 1 ohm (ironically, probably because I've soldered and resoldered the same area so many times). After lots of experimenting with the other resistors in the circuit, I've determined that I cannot charge the capacitor block AND boot the Pi simultaneously. There's just too much voltage drop in the capacitor circuit to have enough left over to turn on the RPi. (At power on, voltage in circuit is 5V, which rapidly drops to around 2.5 and then very slowly climbs until the caps are fully charged).

I did determine that the capacitors are good, and that they take about 5 to 10 minutes to fully charge, and that once they are fully charged they provide a keep-alive time of approximately 20-30 seconds before the pi's lights go out. I already have a script in place to perform a shutdown operation when power is cut. But here comes the other problem.

From the time the power is cut to the time the Pi finishes shutting down, I've only dropped from 5.2V to about 4.5V. That's all well and good, except that after that point the caps do not discharge with any speed (even with balancing resistors to help it along). What this means is that when main power is restored, the Pi doesn't boot up because as far as it knows it has never actually been disconnected from main power, so now it just sits there with a fully powered shutdown state.

So here's what I need to accomplish in order for this project to be successful:
1. Raspberry Pi must be able to receive enough voltage and current from the moment power is on and sustain it while the caps are charging. Caps can take 10 minutes to charge if they need to, because end use case shouldn't require lots of power on/offs in rapid succession.
2. Once main power is cut and Pi shuts down, I need for the capacitors to continue to discharge rapidly until completely drained so that Pi believes that power has been fully cut (as if it were unplugged). Ideally full discharge should occur over a 30 second period or so.

Resources:
If you'll recall, I'm actually tying into a 12V 8.5 amp supply and using a converter to get 5V 3.0A which I've connected the above circuits to. I'm entertaining the idea of removing this converter and using a combination of voltage dividers and voltage regulators to get close to my 5V supply. I figure if I run off the 12V supply, there should be plenty of power and current to charge the caps AND boot up the pi simultaneously.

I have resistors in 100, 220, 470, 1k, 2k, 10k, and 20k ohm amounts

I have some transistors. (https://www.adafruit.com/products/756)

I have 4 diodes. (https://www.mouser.com/Search/ProductDe ... 0-1N5402-G)

I have 4 voltage regulators (5-15v in to 3.3v out).

I have 4 supercaps (http://www.mouser.com/Search/ProductDet ... U30B306MRB)

Ideas:

1. Somehow charge the capacitors on a separate circuit from the main power supply. I don't know how to go about doing this, but it seems like it should be possible with a mixture of transistors and diodes, and maybe a voltage divider circuit. Problems are making sure the charging current doesn't get to the Pi while charging, while also allowing discharge current to do its job. Perhaps a transistor can be used somehow.

2. Somehow connect capacitors to a better grounded circuit to get them to discharge faster, while not severely impacting my keep alive time. The situation is that while the Pi is shutting down, its still drawing lots of current, but once its done shutting down, it doesn't draw enough to drain the caps. Would larger balancing resistors do the trick? Or perhaps in addition to the balancing resistors, another much larger resistor in parallel that connects the the + and - end of the whole capacitor array?

I feel like 2 should work out pretty easily. If I can figure out a way to get a transistor to open when power is cut, then I can create the circuit for problem 1. I could then use the same idea to connect a draining circuit to the caps at the same time.

Could you provide any input or thoughts on the above scenarios?

crono141
 
Posts: 21
Joined: Sun Dec 11, 2016 11:55 pm

Re: How do I supercapacitor (was What Kind of Connector is T

by zener on Sun Jan 22, 2017 4:39 pm

So here are the issues:

1) If you use the 100 ohm resistor then the caps don't charge enough. Yep, that's way too big.

2) If you take out the resistor altogether then your 3A converter bogs down and drops out. Yep, you need some series resistance. I recall someone suggesting 1 ohm. No, a short piece of wire is not 1 ohm. Even at 28Ga it would be less than 1 ohm. I can't guarantee 1 ohm is the perfect value but it should be close. It will need to be high wattage also, like 5 or 10W. If you want to get really fancy then you build a current control circuit. The LM317 data sheet shows an example. It will need a big heat sink.

3) The Pi acts weird when it has input voltage that is below its specified min but above zero. Yep, it's called "undefined". I found a link last night (can't find it now) where someone lowered the voltage gradually on a Pi and noted what happened. Everything was OK until 4.6V, then one by one, different systems stopped working.

4) You need some way to initiate a hard reset on power up. Well, there is a reset pin I think, so you could use that.

zener
 
Posts: 3884
Joined: Sat Feb 21, 2009 2:38 am

Re: How do I supercapacitor (was What Kind of Connector is T

by crono141 on Sun Jan 22, 2017 5:03 pm

OK. Here's the crazy circuit I've come up with:

Image

The lynchpin of the whole design is the Supertex LND01 MOSFET http://www.microchip.com/wwwproducts/en/LND01, which is designed to be normally ON, and gate voltage turns it off. I'm also going to be ditching my off the shelf 12v to 5v supply in favor of two LM323K voltage regulators http://www.jameco.com/z/LM323K-Major-Brands-Standard-Regulator-5-Volt-3-Amp-3-Pin-2-Tab-TO-3_23667.html, which will connect directly to my 12V supply. One of the regulators will be connected directly to the pi with a diode. The other will be connected to the supercap circuit. The supercap circuit will be isolated from the Pi at power on by the MOSFET which is turned OFF by the 3.3 volt signal from my initial voltage divider that I use to sense connected power with. I have another one of those MOSFETs controlling a grounding connection between the supercaps. It will be in the ON position until shortly after boot, when my Pi script will turn it to the OFF position by supplying a 3.3v signal on a GPIO pin.

So here's how things should go. TV is powered on, which turns on the 12V supply. It goes through a 5V voltage regulator and directly to the Pi, powering it on. Simultaneously, a separate 5V path from the 12V supply begins charging the supercaps, which has been isolated from the Pi by the normally ON MOSFET, which is switched off due to supply voltage (through the 3.3v regulator). Everything should boot and a script will turn OFF the capacitor grounding MOSFET seconds after boot, allowing the caps to charge.

Now, after the caps have reached full charge, power will eventually be cut. 12V supply turns off, which immediately turns ON the MOSFET between the caps and the pi, allowing them to power the computer. A shutdown sequence is initiated. At some point during the shutdown sequence (which only lasts 10 seconds), the power will be cut the the second MOSFET, allowing the caps to discharge directly to ground. Hopefully there will be enough juice remaining in the caps to finish the shutdown sequence before they become completely drained by the discharge circuit becoming active.

Do you see any problems with this circuit?

crono141
 
Posts: 21
Joined: Sun Dec 11, 2016 11:55 pm

Re: How do I supercapacitor (was What Kind of Connector is T

by crono141 on Sun Jan 22, 2017 6:03 pm

OK, I took all 11 of my remaining 100 ohm resistors and put them in parallel to get the lowest possible resistance I could get with the parts I had (about 9 ohms). And you were right. I got all 5 of my volts to the pi, and the caps charged quicker. I still have the problem of turning the sucker back on though. I wasn't aware of the pi hard reset. I tried googling momentary relays, but everything I found was too large. Not sure how to tie it in otherwise. Thanks again for your Sage advice. ☺

EDIT: After some experimentation and timing, I've determined that the caps do indeed charge up fully in about 10 minutes. Its a bit longer than I'd like, but workable. They discharge low enough for the Pi to come back on after about 5 minutes. I'm not sure if I'm getting complete shutdowns or not, because as things stand there's no way to determine that visually. All I can do is guess based on the green LED, and timing a normal shutdown sequence.

Anyway, I think I've found a solution to both the shutdown problem, and the restart problem. I've ordered one of these (https://www.pololu.com/product/2562). Its a 5v step up voltage regulator that I'll put in series with the discharge portion of the capacitor circuit. This should ensure that the Pi gets its expected 5V for as long as possible, ensuring a complete shutdown, and end up with discharged capacitors faster since we'll be pulling more energy out of the caps.

Thanks again for all your input, and helping me get this project completed successfully.

crono141
 
Posts: 21
Joined: Sun Dec 11, 2016 11:55 pm

Please be positive and constructive with your questions and comments.