Hi Paul,
The A7 pin is connected to a voltage resistor, which is "monitoring" the VIN voltage. To prevent any damage/interference with the current circuit, you need to first disconnect the A7 from the voltage divider by disconnecting the JP2, as described here:
https://bitbucket.org/talk2/whisper-nod ... er-jumpers. An alternative would be to use another Analog Pin if they are free.
Additionally, you will need to build your own voltage divider, which I recommend to output 1.1V for the maximum voltage. The reason for that is to use the "INTERNAL" voltage reference present on the MCU. Here an example:
RTOP: 1M
RBOT: 68K
CAP: 100pF (just to provide some stability)
Code: Select all
(INPUT VOLTAGE)----[RTOP]-------------(MCU Analog A?)
| |
| |
[RBOT] --- (Capacitor around 100pF)
| ---
| |
| |
GND GND
With the relation above you should get 1.1V output when your input is 17.267V. In other words, you can monitor a few volts over 12V you need, which is fine.
Now in the code, you can use the already existent function
T2Utils::readVoltage(A?, 0, 17267, 5), where:
A? - this is the analog Pin you going to use
0 - this is the control Pin, it's only necessary if you have a kind of "switch" which will turn the voltage divider ON or OFF - normally used to block the currently leak resistor dividers have. If you use "0" means the function expect the voltage divider to be always "ON", which I think would be the case.
17267 - here you define the Maximum voltage your voltage divider would represent at 1.1V;
5 - finally the number o samples to be collected to be averaged;
Have a look on the Talk2 Example Voltage.Base as reference and the files T2Utils.h and T2Utils.cpp. Otherwise just build your own function to read the analog value (from 0 to 1023) and convert to the voltage it would represent.
Cheers