1
\$\begingroup\$

I try to monitore the battery capacity once every minute by reading the voltage with the ADC.

The arduino is powered by the battery through a boost converter (5V). I put a mechanical switch between the booster and the Vin so I can easily turn on/off the arduino.

I assume that wiring the input pin (Batt sense) directly to the battery (at 3.7v before the booster of course) will damage the arduino when I switch off Vin, so I decided to put a N-MOSFET switch controlled by the arduino which I activate just before measuring the voltage.

Can this work ? Am I doing something wrong ?

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ Is there a reason the on/off switch cannot be before the boost converter? This would certainly extend the battery life. \$\endgroup\$
    – Glenn W9IQ
    Commented May 30, 2017 at 21:03
  • \$\begingroup\$ Is there anything else connected to the battery or boost converter output? \$\endgroup\$
    – kva
    Commented May 30, 2017 at 21:17
  • \$\begingroup\$ Yes, to be more complete when I switch off the arduino the 5V output is redirected at a female USB for charging purpose (like a battery bank). \$\endgroup\$
    – Denis
    Commented May 30, 2017 at 21:17

2 Answers 2

1
\$\begingroup\$

The N-channel MOSFET you have wired in will not work, because it's unlikely the Arduino can pull the gate higher than the Vgst of the MOSFET -- the Gate needs to be at least a volt and a half above the Source for it to turn "on." (This value of course changes depending on the specific MOSFET, but for discrete devices, you'll often see Vgst even higher than that.)

Meanwhile, a fully charged LiPo cell is 4.2V, and with 5V output, you only achieve 0.8V GS voltage.

Instead, you should hook up the input to your boot regulator to a 1 MOhm resistor, and then hook that to the voltage sense ADC input, and then short that to ground through a 4.7 MOhm resistor in parallel with a 100 nF capacitor. This will make a voltage divider that you can use to read the voltage. The leagage current though 3 MOhm is unlikely to ever be a problem for a circuit that's "on" (the loss in your boost regulator is much higher.)

The 1 MOhm resistor and the 100 nF capacitor work together to create a RC filter. The time constant for this filter is 0.1 seconds, so even if you read it every 10 seconds, you'd have a very accurate measurement. The reason you need the capacitor is because the AVR ADC requires a source impedance of 10 kOhm or less, and the 1 MOhm resistor clearly is more than that, so the capacitor provides a "reservoir" that the ADC can sample.

enter image description here

\$\endgroup\$
0
\$\begingroup\$

The voltage of a lithium ion battery does not say a lot about its capacity. You need to monitor the charge being pulled from the battery and know the capacity of a fully charged cell. There are devices available to do just that, which are called battery fuel gauge ICs.

Edit: These ICs wont be able to tell the remaining capacity of your battery the first time it's discharged, but it can learn while a fully charged cell is discharging.

Edit2: If you put the power switch directly after the battery you dont need the mosfet. The 3.7V wont damage the arduino, but it would power it trough the clamping diodes. A simple series resistor would be enough to prevent this from happening.

\$\endgroup\$
3
  • \$\begingroup\$ I know the discharge-level curve of the battery with my load, by measuring the voltage of the battery, I can estimate the remaining capacity very roughly but good enough for me (it's just a personal project). \$\endgroup\$
    – Denis
    Commented May 30, 2017 at 21:12
  • \$\begingroup\$ so I could just add a resistor between the battery and the input and forget about the mosfet ? \$\endgroup\$
    – Denis
    Commented May 30, 2017 at 21:22
  • \$\begingroup\$ The resistor will limit the current flowing to the arduino, so it wont be powered from the input pin. \$\endgroup\$
    – kva
    Commented May 30, 2017 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.