VoltageSupervisor_00

rPi low voltage supervisor, let me know before batteries die

Goal:

Know when the batteries voltage decrease to 7.0v because after that they cannot support the 7805 and decline rapidly. If we are moving and the batteries stop supplying enough current to the 7805 then the pi will stop responding and remain in whatever state it was in. So if we were going forward we will run into a wall and not stop. I want to make sure I know if the batteries are low and then at least I can stop controlling the unit!

 How I did it:

I used a P-Chan Mosfet, pull down and a voltage divider. The voltage divider takes the voltage right from the battery pack. So when the batteries get to 7v the voltage divider outputs about .538v. I was using the IRFD9120 because its all I had laying around (it is actually a poor choice for this circuit because its expensive!). The IRFD9120 has a Vgs(th) from -2v to -4v. It does not seem to be full “on” until I hit about 2.8v. My source to the mosfet is 3.3v coming out of the pi itself so to hit its threshold I need 3.3-2.8=.5v on the gate or less before it opens. The voltage divider is Ra=120k Rb=10k giving .0769 and .0769*7v = 0.538v giving the desired threshold.

Does it work ?

Yes it works pretty well. I’m using two CR123 rechargables and I get about 30 minutes before they start to drop. This circuit will let you know just as they start to drop off. From there you might still have another 5 minutes. I’m going to make the javascript in my control page turn all of the gpio off and disable the buttons when this gets triggered, along with logging the time. This way I will see how much time you have after you get notified.

Run Time Battery V ra rb vout LowOn State
1 8:17 7.97 120000 10000 0.613077 FALSE
1 8:18 7.76 120000 10000 0.596923 FALSE
1 8:22 7.4 120000 10000 0.569231 FALSE
1 8:26 7.3 120000 10000 0.561538 FALSE
1 8:27 7.27 120000 10000 0.559231 FALSE
1 8:29 7.22 120000 10000 0.555385 FALSE
1 8:32 7.18 120000 10000 0.552308 FALSE
1 8:37 6.83 120000 10000 0.525385 TRUE
End 20min
2 11:30 8.39 120000 10000 0.645385 FALSE Off
2 11:30 7.91 120000 10000 0.608462 FALSE Working
2 11:31 7.78 120000 10000 0.598462 FALSE Working
2 11:34 7.56 120000 10000 0.581538 FALSE Working
2 11:37 7.5 120000 10000 0.576923 FALSE Working
2 11:44 7.48 120000 10000 0.575385 FALSE Working
2 10:48 7.37 120000 10000 0.566923 FALSE Working
2 11:49 7.31 120000 10000 0.562308 FALSE Working
2 11:52 7.21 120000 10000 0.554615 FALSE Working
2 11:57 7.1 120000 10000 0.546154 TRUE Working
2 11:59 7 120000 10000 0.538462 TRUE Working
2 12:00 6.92 120000 10000 0.532308 TRUE Working
2 12:01 6.85 120000 10000 0.526923 TRUE Working
2 12:02 6.52 120000 10000 0.501538 TRUE Issues
2 12:04 5.35 120000 10000 0.411538 TRUE Broke
2 12:05 6.44 120000 10000 0.495385 TRUE Off
2 12:06 6.65 120000 10000 0.511538 TRUE Off
End 30min

Problems:

The 3.3 volts I get are from the pi’s 3.3v output so when the pi eventually does loose power because the 7805 can no longer function the 3.3v disappears. This means the output of the circuit is unknown. But I dont think it really matters at that point because the feedback into the rPi is pointless if its not running. So be sure to do your house keeping first and then ignore its output later.

The P-Channel Mosfet is really not for this application and costs about $1 each. I should get a cheaper mosfet since I’m not driving anything through it. There are some on mouser that cost about 7c such as PMV160UP,215 there are also IC voltage detectors but none of them seem to work right at 7v, and if I need to put in a voltage divider anyway I could just use a mosfet.

Todo:

Find Cheaper Mosfet, rebuild voltage divider for that mosfet.

 

Leave a Reply