Shutter Auto Close And Low Battery Detection - nexdome/ASCOM GitHub Wiki
Firmware Operation
Voltage Monitoring
All firmware versions from 3.0.0 have monitored the shutter battery voltage and reported it via a notification.
The microprocessor directly measures the scaled input voltage using an analogue-to-digital converter (ADC). ADC readings are taken every 3 seconds and the value (in Analogue-to-Digital Units or ADU) is added to a moving average. The moving average is computed over 10 readings, or about 30 seconds. Thus, the reading produced by the firmware may lag the true value by up to 30 seconds. A moving average is used to smooth out noise from the ADC conversion process and any sudden changes in battery voltage due to changes in current draw (for example, running the motor or connecting to the charger).
About every 30 seconds, the moving average value is emitted to the serial port and sent to the remote XBee in the form: :BVnnnn#
, where nnnn
is the moving average value in ADUs.
The value measured by the ADC may differ from the actual battery voltage by as much as plus or minus 5%. This is due to the design of the measurement circuitry and the inherent variability in electronic components and will be defferent for every installation.
The voltage may be computed as: V = 1023.0 / 15.0 * ADU
.
The theoretical range of values is 0 ADU (0 Volts) to 1023 ADU (15.0 Volts).
Auto-Close
From firmware version 3.4.0 the shutter firmware has the ability to auto-close if a low battery condition is detected. Two new commands were added to support this feature:
Command | Description |
---|---|
@BRS |
Battery-threshold Read Shutter (returns the currently active setting). |
@BWS,nnnn |
Battery-threshold Write Shutter (nnnn is the threshold in ADU). |
Low battery detection is enabled by writing a nonzero value with the @BWS,nnnn
command.
Writing a zero value implies that auto-close is disabled.
The value written is in ADUs as described above.
When the shutter firmware emits a voltage value, it also checks this against the low battery threshold.
If the voltage is below the threshold, then a notification :Volts#
is emitted.
Then, if the closed sensor is not active, a @CLS
close command is sent to the command dispatcher.
This process occurs each time a voltage reading is produced, so if the shutter does not close for any reason, the firmware will attempt to close the shutter about every 30 seconds until either the closed sensor is detected or the battery voltage returns to nominal.
Auto-close is completely implemented in the shutter firmware so it does not require the rotator to be connected nor any client software. It is a fully autonomous safety feature.
Clients may use the :Volts#
notification to detect a low battery condition.
A return to nominal voltage may be inferred by the absence of two notifications (i.e. no notifications for at least 60 seconds).
Alternatively, clients can use the battery voltage notifications to extract the ADU value, compute the voltage and perform their own low voltage detection logic.
The firmware's 30 second moving average algorithm should help to prevent erroneous detections.
Practical Considerations
Determining Your Low Battery Threshold
Due to inherent variability in measurements and different battery chemistry characteristics, it is impossible to give a predetermined value for the low voltage threshold. This value will have to be determined by experiment, by every user and will most likely be different for each installation.
According to Battery University, a lead-acid cell is fully charged at 2.2 Volts and fully discharged at 1.75 Volts. For a nominal 12 Volt battery with 6 cells in series, the fully charged voltage will be 13.2 Volts and the fully discharged voltage will be 10.5 Volts. Discharging a 12 Volt lead-acid battery below 10.5 Volts will permanently damage the cell.
When determining the best value for your system, we recommend using a good volt meter to measure the true battery voltage, which may differ from the firmware's measured voltage.
Also remember that the firmware uses a moving average so the reading will lag the real value by at least 30 seconds and maybe more.
When deciding on your low battery threshold, remember to allow a surplus so that there is sufficient charge remaining in the battery to close the shutter, without over-discharging it.
If your battery voltage falls too low, you may damage the battery and the microprocessor operation may become unreliable due to insufficient power. Therefore, it is probably better to be conservative in your decision making.
Implications of Battery Voltage
Battery discharge characteristics are complex and multi-demensional and depend on factors such as:
- The battery chemistry (lead-acid vs. litium, etc.)
- The ambient temperature
- The current demand
- The charge state of the battery
- The length of the discharge cycle
Therefore, it should be clear that measuring the voltage can only produce a one-dimensional instantaneous snapshot of the true state of the battery, which is approximate. The voltage may or may not be a good indication of the battery's charge state. You, the user, must weigh up the various contributing factors and decide how and whether you want to use this feature.
Lead-acid batteries have an approximately exponential voltage discharge curve.
Lithium based batteries (such as LiFePO4) have a much flatter voltage curve which drops off quickly as they near depletion.
This can make voltage-based detection of the charge state quite tricky and you may have to adapt your strategy to the characteristics of the battery you are using.