Can I measure lithium ion cell voltage with Arduino ADC which is used to power the same Arduino through a boost module (XL6009)? The output voltage of boost module is 9 volts.

  • Sidenote: why are you boosting the voltage to 9V (and presumably using the voltage regulator on the nano to bring it back to 5V)? – Gerben Sep 24 '18 at 18:26
  • @Gerben Because the lithium ion cell voltage can be in the range of 3-4.2 volts depending upon the charge level. So to operate the analog circuit (using LM358) and Arduino nano at a stable voltage I have to boost the input voltage. Plus the XL6009 module will keep the output voltage stable at 9V regardless of the input voltage. – Muhammad Saad Sep 25 '18 at 5:41

I'm the author of a library called BatterySense and you can use it to achieve your goal. In the repository Readme you can also find wiring diagrams and usage examples, but to give you a rough idea...

  1. Verify the negative side of your battery has continuity to the GND pin of your Arduino: you need to identify if the boost module is messing the common ground, but if you have continuity then you are fine
  2. Add a connection from the battery positive terminal going into one of the Arduino analog pins
  3. Use the BatterySense library to get the battery voltage and percentage level

You could use an analog pin to measure the voltage as long as it is not over 5VDC (assuming your Arduino is running at 5V).

There is a tutorial here: https://www.arduino.cc/en/Tutorial/ReadAnalogVoltage

void setup() {

void loop() {

  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);

  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);

  • You can use a voltage divider to increase the range of measurement. For example divider made of two identical resistors will drop voltage by exactly 50% of the input voltage, so you can measure voltages from 0V to 10V and not exceed the 5V limit on Arduino input (you loose precision though) – Filip Franik Feb 26 '18 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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