Hello everyone, I'm new to forums
Is there a way I can read voltage of a 100mAh battery with Arduino?
Will I destroy something if I put 100mA to a digital pin?
Your help would be appreciated
The analog & digital pins need very little current - they work more on voltage levels.
You can put 0 to 5V on an analog pin (with a 5V Arduino) and read that level with
int value = analogRead(Apin);
you will get a 0 to 1023 result. Multiply the result by 0.00488 to have it as a voltage.
float voltage = value * 0.00488;
An electrical circuit only takes as much current as it needs if the voltage is correct. If the voltage is too high (over 5v for a 5v Arduino) it will force too much current through the circuit and probably damage something.
...R
digital/analog input pin takes no current (well many orders of magnitude less than you can measure
with a multimeter), but only so long as the voltage on the pin is within the power supply
range of the Arduino, ie between 0V and 5V in a 5V Arduino. Accidentally put even 6V on
such an input pin and you'll destroy it very fast indeed.
You can be much more robust if you add a series resistor, say 5k or 10k sort of range in series with
the input pin, then if the voltage goes out of range it limits the current to safe levels.
100mAh is the capacity (endurance) of the battery, not the voltage.
100mA current draw for an hour, or 5mA for 20 hours, etc.
If we know the voltage of the battery, we can tell you how to measure it.
Is it used to power the Arduino, e.g. a 9volt battery.
You might need a voltage divider (two resistors) if the battery voltage is higher than the Arduino/MCU supply.
Or a single current limiting resistor for safety, as MarkT explained.
Leo..