# Battery level sensor

I'm designing a smart bin for my paper and would like a sensor that continuously monitors the battery level in real time and in percentage value and then sends the data to the administration office. What sensor can I use? And how can the percentage value be obtained?

• You can use a voltage divider for battery level measurement with a microcontroller. The conversion to % can be done in code. There are lots of projects on internet for the same. – Electric_90 Mar 27 at 16:40
• Could you please tell me one? I was unable to find it. – noorav Mar 27 at 16:48
• Try searching the following term, arduino battery percentage. You will eventually find lots of videos on YouTube and tutorials on sites like Instructables. – Electric_90 Mar 27 at 16:54

The way battery capacity is usually monitored by reading the voltage. You need to look in the datasheet for the voltage span of your battery when it's fully charged and when it's "empty". The battery will never be totally empty but you will define a safe voltage to cut it off as to not damage the battery as indicated in the datasheet, this is your "0" percent.

To get the percentage you would need to calculate it either from the data sheet and the characteristic of the battery or do a measurement of it from full to empty and then estimate the percentage left.

A microcontroller can be used to read the voltage into its ADC port, probably with a voltage divider. Something like an Arduino is a good start. You can then do the calculations in code and send it over something like Bluetooth to an app or your choice of communication.

Below is an example of how you might do it.

simulate this circuit – Schematic created using CircuitLab

• If you care about the battery life, I highly recommend using higher resistor values and buffing the input to the ADC (with a voltage follower). As shown, the resistor divider will draw ~8.7mA continuously. With a 2000mAh battery, the resistor divider alone will drain it in 9 days. In comparison, the Arduino draws ~0.2mA when active (according to forum.arduino.cc/index.php?topic=5536.0) – MapleTronix Mar 28 at 0:38
• I agree but you you also get more accurate readings with lower resistance. To expand on this I would recommend adding a mosfet as a switch controlled by one IO pin on the Arduino. Then you only need to draw the current for short periods of time. – Marius Gulbrandsen Mar 28 at 6:24
• The MOSFET is good idea. I'm curious, why do you say that lower resistance provides more "accurate readings"? If you buf the input as suggested, the opamp will have much lower output impedance than 1 kOhm. And because the input impedance of opamps is insanely high, the current into the inputs is often on the order of low nanoAmps to femtoAmps. I don't see how you could expect more accuracy by having the ADC transient current flow through a 1K resistor. – MapleTronix Mar 29 at 17:25
• An example to this would be an Arduino. It states that to take an accurate sample you should have less than a 10k resistor, anything over this might lead to you seeing cross talk. But there are ways of working around this, like using an op-amp or capacitor. For connecting directly to the ADC from the voltage divider however it seems a resistor in the league of 1-10k is best for accuracy. Of course, depending on the microprocessor used and how the ADC is described in the datasheet. – Marius Gulbrandsen Apr 5 at 11:02