Xinyuan-LilyGO / LilyGo-T-PCIE

89 stars 35 forks source link

reading battery voltage #17

Closed tradexsrl closed 3 years ago

tradexsrl commented 3 years ago

Hi is it possible to read battery voltage as in lilygo ttgo t-sim7600E ? any sample code ?

romoloman commented 3 years ago

int16_t vscale=1000; int16_t vbatt=(int16_t)((modem.getBattVoltage()*vscale)/1000); where vbatt is voltage in millivolt and vscale is a calibration factor (start with 1000 and adjust);

Please keep in mind that when charging you will always read 4000 + as value, also when connected with usb. To have a good reading you must run on battery and display the value using a webserver or something like that or use a serial port without using the USB on board.

When you are running on battery measure the battery voltage with a multimeter and adjust vscale,

tradexsrl commented 3 years ago

Many thanks, I supposed you have tested the board and one pci-e modem like an nb-iot or an lte standard or you had it in your hands , have you found any issue or not? Can you recommend this board instead of lilygo ttgo t-sim 7600e for proof of concept for an industrial and smart agriculture device?

romoloman commented 3 years ago

I'm using this board with a sim7600e on an industrial device without any single issue since months.... Medium power consumption is 160ma when connected to network without trasmission with esp32 cores always running and modem always on. Also I have wifi running in AP mode to view board status.

tradexsrl commented 3 years ago

Perfect , many thanks