The stuff is supposed to be powered by a 9V battery, and I’m gonna use an ADC port on the Teensy to sense the available voltage. The Recom R78 converter can accomodate 6.5-18V thus I can’t use the AREF pin of the Teensy, because
- I believe the ADC can’t sample beyond the Vin, 5V in my case (I’m not even sure you can go beyond the internal 3.3V)
- the AREF pin is on the backside, not connected, and would short circuit to pin 23 of the Teensy on the breadboard anyway.
So I go for a voltage divider made with two resistors of roughly 1/3 vs 2/3 (to lower from 9V to ~3V). I started with MΩ, but was surprised by the voltage going into the loads. After some trial and errors, I set for 2.2kΩ and 4.7kΩ, compensating the ratio in software. With such quite low resistance, it will consume 1,5mA at worst with 9V, but hell, the whole system is consuming 78mA already under 7.5V (with the USB debug connection to the PC, which seems to eat a lot), and climbs to 450mA when the modem supercapacitor is charging. Also with such a low resistance, I shouldn’t have to recalibrate when adding more loads, but I’ll have to check.
After calibrating using my PSU, I got a reading of about 630 for 6.5V and 880 for 9V, a 10mV precision, more than enough just to know at what speed the battery discharges !