I'm trying to read the battery voltage using Arduino, using a 9V battery. I keep getting the same voltage (4.99). I connected my Arduino to Matlab so I'm only using the command voltage=readVoltage(a,'pin'). I'm very new to this, so any help would be appreciated.

thats my circuit

1 Answer 1


Analog inputs on the arduino will measure 5v maximum. If you want to mesure higher voltage you will have to use a voltage divisor circuit (resistors).

  • 1
    Also your analog input might now be dead from providing almost twice the voltage it's designed for.
    – Majenko
    Commented May 2, 2017 at 9:42
  • Aren't you getting any Magic smoke ? Commented May 2, 2017 at 13:02
  • Thank you all, somehow I didnt damage the analog input, thank God. But i tried with resistors (10k) and its still measuring the same voltage... Commented May 2, 2017 at 17:20
  • And if you measure with a multi-meter the voltage at the Arduino input ? Commented May 2, 2017 at 17:21
  • 1
    @SoundoussSassi could you show/describe how you have connected the resistors (just to make sure it is a proper voltage divider)? I also wonder if it is necessary to select a proper reference (there should be an internal and external reference possible).
    – Ghanima
    Commented May 2, 2017 at 18:53

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.