Battery monitor/sensing ratio calculation on MotionMote/WeatherShield

Started by Memnon, July 23, 2015, 06:18:23 PM

ssmall

To give you more information what I am doing, I have a solar panel that charges a Lipo battery during the day and the battery provides power at night.  The solar panel puts out a max of 6 volts.  What size capacitor would I use between A3 and the Gate of the FET?

-Steve

perky

If you remember your theory, the resistance times the capacitance is the RC constant. That is the time taken for the capacitor to charge up to about 2/3 of its final value. Under off conditions (after the capacitor has fully charged with A3 in the high state) the voltage at the gate will be at Vin. When you drive A3 low the voltage at the gate will immediately drop by Vcc, turning the FET on. You want this voltage to remain well below the gate threshold voltage to keep it on during the measurement (so that's at least 3ms plus the time to measure). As soon as measurement is made A3 can be driven back high which will immediately drive the gate to above Vin by the amount that it has been charged up with, turning the FET back off.

So you need an RC constant big enough. About ten times the time to measure should be OK, that'll guarantee the FET is hard on for the duration, thats RC = 0.03 (assuming you use 10nF and 10k/4k7 divider), so for your 10k pull-up that's a C of 3uF. I would probably use a 100k pull-up resistor instead of 10k and use a 330nF or 470nF to give roughly the same time constant. The procedure is then drive A3 low, wait 3ms, make the mesurement, and drive A3 back high.

Mark.

ssmall

Mark, I will change the battery monitor voltage divider as you suggested and make the changes you suggested on the P-FET side of things as well.  I need to order some parts.  :)  I appreciate all your help.

-Steve


perky

That link you supplied was for calibrating by reading the 1.1 bandgap voltage (which is not particularly accurate in absolute terms but is reasonably stable over temperature) and comparing it with a known input accurate voltage. This problem though is about reading voltages that are above Vcc and keeping the power down at the same time.

Mark.

MrGlasspoole

Ah yes. Sorry i did forget not everybody is using 2x 1.5v batteries.

ssmall

Mark, I made the changes to the circuit you suggested.  A 10nF cap and 10k/4k7 resistors for the voltage divider.  I used a 100k pull-up resistor between the gate and the source instead of the 10k.  Everything appears to work correctly.  I can see the voltage is zero across the voltage divider when A3 is set to INPUT (high-z) and I can see a voltage drop when A3 is set to OUTPUT, LOW.  If I put a 330nF capacitor in series with A3 the voltage is always zero.  Am assuming I am missing something.

perky

The thing you're missing is that with the 330nF capacitor in circuit A3 should always be an output (and note, the capacitor is connected to A3 on one side of the capacitor and the gate/pullup on the other side). From my previous post then: "The procedure is then drive A3 low, wait 3ms, make the measurement, and drive A3 back high." The default state for A3 should be driven high.

Mark.