Hi, I am after a bit of help. Looking at a related post Can Argon (or Xenon) Read the Battery State? - #13 by Kean, I understand that for the Argon there is a built in voltage divider connected to P0.05 that allows you to read the battery voltage.
When I use the scaling float voltage = analogRead(BATT) * 0.0011224; my device tells me that battery voltage is upwards of 4.3V, which is incorrect.
When I physically measure my battery voltage with a multimeter it’s around 3.6V.
Is there something i’m doing wrong here?
Something to note, initially, I had connected my 3.7V battery (Li+) to A3, as I noticed on the datasheet that P0.05 was connected to AIN3. In hindsight, I realise that internally P0.05 was already connected to the battery via the voltage divider, and that I only needed to read the BATT variable, and apply scaling to get the actual voltage reading.
Could I have maybe damaged something on my Argon that would affect the readings?
Sorry in advance, I am relatively new to this platform, so could use some pointers.
Can you check what exact voltage you read on the 3v3 pin?
If the reference voltage for the ADC is off, so will be the derived values.
You may need to calculate the factor for your ADC reference.
Thanks, I’m measuring 3.285V, but don’t think this small difference is significant enough to affect it?
I changed the 0.0008 portion of my scaling equation to 0.000802 (3.285 / 4096), and still got a pretty off-target result of 4.3V.
Is the battery currently being charged? I don’t know the exact charge voltage on the Argon off the top of my head, but it’s probably in the 4.1 to 4.3 volt range. The battery voltage will be the charge voltage when charging.
What is the raw value you get for analogRead(BATT)?
The divider used for battery measurement of 2M & 806k resistors means a battery voltage of around 3.6V will give 1V into the analog input (3.6 * 806 / 2806 = 1.034) and a raw analogRead value of roughly 1280. So the scaling factor to get real voltage would be roughly 0.0028125 (i.e. 3.6 / 1280).
It is possible you have damaged the analog input if you connected it directly to the A3 input the battery voltage was much above 3.3V. If you have an adjustable power supply you could set it to 1V and connect it to another analog input to see the result. Then (with the battery unplugged) try the same with the 1V connected to A3 and see if they are similar.
Thanks, I realised that I had disconnected the connection between my battery and the Li+ pin on the Argon, because I didn’t want the onboard charger fighting my external charger.
I think you were spot on about how the battery voltage will be the charge voltage when charging.
I have since connected the battery to the Li+ pin and it monitors correctly.
@Kean, I tested the analog input as you suggested and it was fine (Phew), so didn’t end up damaging anything.