If possible, I'd like to ask on how can I program a sketch wherein it determines the percentage of the battery that powers the whole device. The battery percentage will be sent to the android app.
I currently assembled:
Arduino UNO
SIM900 GSM/GPRS Shield
MQ-2 Gas Sensor
ESP-01 (ESP8266)
The whole machine will be powered by a 9V battery connected to the gsm shield.
Thanks a lot!
P.S. The gsm shield on fritzing isn't the exact type of the SIM900 one, just like the MQ-3 (it should be MQ-2 but couldn't find one).
Because you are powering the arduino from the battery you want to measure you need to add two resistors to form a voltage divider which is dimensioned so that 9V equals 1.1V (or better 1V) on the output.
Than switch the analog reference of the arduino to the internal 1.1V reference, which is stable against the supply voltage.
For the conversion of measured battery voltage (from the voltage divider) to a percentage you need to know the discharge curve of your battery.
LightuC:
Because you are powering the arduino from the battery you want to measure you need to add two resistors to form a voltage divider which is dimensioned so that 9V equals 1.1V (or better 1V) on the output.
Than switch the analog reference of the arduino to the internal 1.1V reference, which is stable against the supply voltage.
For the conversion of measured battery voltage (from the voltage divider) to a percentage you need to know the discharge curve of your battery.
I can't quite grasp what you just said since it is too technical (sorry!). Can you share a breadboard view so I can follow through?
Thank you so much for your reply. I appreciated it
iamdeadlyz:
The whole machine will be powered by a 9V battery connected to the gsm shield.
If you mean one of the PP3 style smoke alarm batteries then you might wish to reconsider. I doubt if it will last long enough for it to be worthwhile checking its capacity. A pack of 6 x AA alkaline cells would be much better.
LightuC:
Something like this should work (I used an online calculator so it is advised, that you measure the output voltage yourself).
Thank you so much! I'll be trying this one.
Cheers!
Robin2:
If you mean one of the PP3 style smoke alarm batteries then you might wish to reconsider. I doubt if it will last long enough for it to be worthwhile checking its capacity. A pack of 6 x AA alkaline cells would be much better.
...R
I am planning to use a Energizer max 9v alkaline battery for this. Is it ok?
This can be improved a lot by powering down unused parts. For example, by only being active every 5minutes for 1 second, the battery life can be improved to ~500h.