-
Notifications
You must be signed in to change notification settings - Fork 11
The Ext_V pin and its uses
The ATTiny Daemon can measure its own supply voltage (called V_Bat). In addition to that it provides the functionality to measure an external voltage as well. This external voltage can be either the supply voltage of the RPi, or the voltage of an external signal that has been connected to the pin V_EXT of the connector.
You can choose which voltage to measure using the jumper that in one position connects the RPi supply voltage, in the other position connects the V_EXT pin.
In both cases, a diode protects the input pin from anything strange that might happen on the ATTiny side. In addition we use a voltage divider to bring down the voltage and amperage to a level that ensures that the ATTiny cannot be powered through this input pin (via the ESD diodes). Even though the power consumption of the ATTiny is quite low and the ESD diode probably wouldn’t be destroyed, it still introduces an unpredictability that might jeopardize the overall system functionality.
If you need to measure higher voltages then you can simply use other resistor values to bring the external voltage to below the supply voltage of the ATTiny. This will most probably be 3V if you use a battery with a protection circuit, but use 2,5V to be sure.
To compensate for this on the software side two configuration options allow to multiply the measured value with a coefficient (named external voltage coefficient) and add a constant (named external voltage constant) to the result. If the result sinks below the value of the constant then a value of 0 is reported.
The first argument is, because we can. The code still fits within the flash of an ATTiny45, and maybe someone can use it.
The second argument is to allow for an implementation of the ATTiny Daemon that also measures to input supply voltage. With the Geekworm UPS this is not possible, because the UPS puts 5V on its input as soon as the supply voltage is no longer present (with a delay of less than a second). This means that we cannot determine the state of the input voltage reliably.
But if we later modify another UPS to work with ATTiny Daemon, then this might come in handy, and this without having to modify the hardware design in any way.