0

I power my Arduino Mini with 3 AA batteries on RAW input. Is it possible to get the voltage on RAW and therefore the expected longevity of the batteries?

3

No. Not directly. You can use voltage divider and measure the result with using internal reference. But it's another current consumption and you can't reduce it by (for example) entering one of the sleep modes.

And if you have 5V Arduino Mini variant, you can power it directly through 5V power pin. Otherwise you are losing about 1.5V on voltage regulator. On 3.3V variant it might be better, but it also depends on used regulator voltage drop and would be better to power it directly (if you don't have connected anything strictly with 3.3V power, and for AVR based Arduinos it's not a problem)

Anyway, if you power it directly, you can measure the power source voltage by measuring internal bandgap voltage reference against power as reference. But, as far as I know, it can't be done by analogRead, as it doesn't support other sources than analog pins.

  • 1
    What you can do is making a voltage divider using high value resistors and read that out on an analog pin. This isn't super accurate but gives an impression of the state of your batteries. – Len Nov 7 '16 at 9:30
  • 2
    @Len Yes, I just don't like voltage dividers on batteries, when you need output impedance about 10k. However it's possible to use big resistors and capacitor big enough to charge sampling capacitor without bigger voltage drop. – KIIV Nov 7 '16 at 9:52
  • 1
    Voltage dividers on batteries for measuring the voltage with the device they are powering can only work if the battery voltage is greater than the regulator voltage + dropout - otherwise your VRef will be a percentage of the battery voltage which makes measuring a percentage of the battery voltage meaningless. You need a stable reference (such as the band-gap) to measure what the Vref (Vcc) is. hackingmajenkoblog.wordpress.com/2016/02/01/… – Majenko Nov 7 '16 at 11:51
  • @KIIV I completely agree, I don't like it either but it is something. Majenko also points out some solid information. – Len Nov 7 '16 at 13:40
  • 1
    You can indeed use a stable builtin voltage as reference. So you can check it against the max voltage. – Paul Nov 7 '16 at 18:23

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.