Waveshare LoRa SX1262 Battery Monitor #16675
-
Hi, I am hoping somebody may know the answer to this. I am playing around with the Waveshare LoRa SX1262 on a Pico. For a remote water level detection project. I have the LoRa comms all working but I would like to use the Vat Voltage Detection mapped to GP26. Looking at the schematics of the LoRa board the battery is connected to GP26 via a voltage divider (200k/100k) which by my calcs would give 1/3 of the battery voltage onto GP26. It is attached to a lithium battery with a max voltage of 4.2 So I am thinking I have to take the adc reading (u16) * 4.2 *3 / 65535 should give me the battery voltage. With the USB plugged in this is giving me 5.2 volts which seems a bit high. Is my above assumptions correct? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Shouldn't it be read_u16() * 3.3 * 3 / 65535. The reference voltage is 3.3v. So read_u16() * 3.3 / 65536 returns the actual voltage at GP26. Look as well at the notes at https://docs.micropython.org/en/latest/rp2/quickref.html#adc-analog-to-digital-conversion. The ADC object should be created by the Pin reference (like 26, or "GP26" or Pin.board.GP26) and NOT the channel number. |
Beta Was this translation helpful? Give feedback.
Shouldn't it be read_u16() * 3.3 * 3 / 65535. The reference voltage is 3.3v. So read_u16() * 3.3 / 65536 returns the actual voltage at GP26. Look as well at the notes at https://docs.micropython.org/en/latest/rp2/quickref.html#adc-analog-to-digital-conversion. The ADC object should be created by the Pin reference (like 26, or "GP26" or Pin.board.GP26) and NOT the channel number.