TheThingsNetwork / arduino-node-lib

Arduino Library for The Things Node
MIT License
22 stars 26 forks source link

Battery voltage sensor stops working if battery voltage drops below around 3 volts #14

Open HanspeterH opened 6 years ago

HanspeterH commented 6 years ago

After the battery voltage has dropped to some voltage (e.g. 2.9V), the readout always returns the same value for all following messages sent (hundreds) although the DMM measured battery voltage is much below the reported fixed value of 3280mV. Probably rather a HW problem. But the SW should not send wrong data. This makes the sensor useless. 22:30:571763 dev id:ttn-node-01payload:0CD0001008E9battery:3280event:"motion"light:16temperature:22.81 ... hundreds of messages later.. 11:26:122514 dev id:ttn-node-01payload:0CD6002908E3battery:3280event:"button"light:41temperature:22.75 actual DMM measured battery voltage: 2.0V In this case the SW should somehow indicate in the message, that the data is invalid.

johanstokking commented 6 years ago

What is the code to read the battery level? Have you seen the new battery level LPP example?

HanspeterH commented 6 years ago

Yes I have seen it and charles seems to have included the new battery voltage readout logic already in the LPP sketch. Hopefully the sleep mode logic and the new battery voltage readout logic will be implemented in the basic sketch as well. I will test with the LPP sketch how long the ttn node will live with the improved code as soon as the ttn node with basic sketch is no longer sending its data, now running at 1.9V measured battery voltage and sensor data still looking good except voltage

johanstokking commented 6 years ago

Great. Can you file a PR for the basic sketch if that's necessary?

HanspeterH commented 6 years ago

Hmm I tried to read about PRs but I am lacking the skills about github terms and logic. I got stuck at the very beginning about selection of a base branch. I simply do not know all those terms as an end user and being only an occasional programmer. If I would continue i am pretty sure to do something wrong or useless...

johanstokking commented 6 years ago

@HanspeterH there are good tutorials, for example https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github

Very useful skill!

HanspeterH commented 6 years ago

Thanks, I will have a look...

hallard commented 6 years ago

Fixed with PR #15 ;-)