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


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 May 2 '17 at 9:42
  • Aren't you getting any Magic smoke ? – Sagnik Pradhan May 2 '17 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... – Soundouss Sassi May 2 '17 at 17:20
  • And if you measure with a multi-meter the voltage at the Arduino input ? – Andre Courchesne May 2 '17 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 May 2 '17 at 18:53

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.