I am re-posting as a new topic after getting no response to my question in the orig. thread for “LoRa Node 151 ADC measure battery voltage - Nov '19”.
I have several node 151s running on battery and even compensating for the voltage divider, I am still getting reading that cannot be correct. Here is my code followed by the readings. Note I am using the LoRaWAN_151CC code with ADC measurement.
//voltage divider on ADC2 input //val = (R2/(R1+R2))*batt_mv //R1=220K, R2=100K // val is a function variable and is a uint32_t uint32_t batt_mv = val * 3.2; AppData = batt_mv >>8 ; AppData = batt_mv; DebugPrintf("ADC Value : %u mv - %x\r\n",val,val); DebugPrintf("Battery : %u mv - %x\r\n",batt_mv,batt_mv);
ADC Value : 1281 mv - 501
Battery : 4099 mv - 1003
the batteries measure at 3.67VDC using a DMM