Site Telemetry

From ArgentWiki
Revision as of 13:07, 16 November 2012 by AI6MS (Talk | contribs) (Scripting: Removed SPAM "transcription service" link.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The OT2 comes with a few internal telemetry sensors built into the unit. Telemetry value one is tied to the temperature sensor, while telemetry value two is tied to a voltage divider. Telemetry value 3 is an available input that can be found on pin 10 of the MON08 header. Telemetry value 4 is a counter input that can be accessed via accessory port pin 1, or pin 6 on the MON08 header. Telemetry value 5 is hard coded in firmware to report HDOP from the GPS. Bit 7 is an available digital input available on pin 6 of the accessory port.

Using these available inputs, with a little interfacing to the outside world, you can monitor a fair amount of conditions at a site.

Obviously input one allows you to monitor the shack temperature. Because the sensor is inside the case, temperatures will be elevated due to the enclosed area, and slight heating from the electronics in the enclosure, but it is sufficient to know of the heaters or air conditioning is operational.

Input two samples the voltage provided to the OT2, which would obviously allow you to track the voltage on your power supply, or better yet, battery stack. If you are not running from a battery backed up supply, when your supply power goes away, so will all your telemetry. Battery backup on the OT2 and it's radio allows the unit to continue to report the site conditions even with the power out.

Voltage Divider

On input 3, a second voltage divider circuit was added, which allows for monitoring a second battery stack on site as desired.

Pulling accessory port signals to the backplane

Input 4 is wired to a magnetic reed switch installed on the shack door, allowing for intrusion monitoring.

Digital input 7 is connected to an external relay with is powered by the AC power from the site, which allows for monitoring if the power goes out.

All of the telemetry values can be monitored by observing the telemetry graphs at aprs.fi.


Scripting

The magic happens in the scripting engine where the telemetry values are monitored, and when conditions meet prescribed levels email messages are triggered, alerting the recipient to the alarm condition.

In addition to monitoring the telemetry values, profile switching is also employed in order to allow decision making based upon the input voltage. If the voltage drops below 11 volts, the OT2 switches to profile 2. If the voltage is above 13 volts, the unit switches back to profile 1.

If Profile 2
  Do Once
    If Flags 0xxxxxxx
      Exec "SEND EMAIL someone@email.com This site Low Voltage"
      Toggle Flags 10000000
    End Block
  End Block
End Block

This script section sends an email message when the unit switches to profile 2 (voltage < 11 volts). It also sets a flag which is used to ensure only one email message is sent per low voltage event.

If Pulse Count > 1
  Do Once
    If Flags x0xxxxxx
      Exec "SEND EMAIL someone@email.com This site Door Alarm"
      Toggle Flags 01000000
    End Block
  End Block
End Block

The pulse counter input is connected to the magnetic reed switch on the door, watching for intrusion events. A flag is set again once the alarm has been triggered to ensure only one email message is sent per door alarm event.

If Peek 3 and 64 = 64
  Set Counter 2 = 0
  On Second
    Increment Counter 1
    If Counter 1 = 300
      If Flags xx0xxxxx
        Exec "SEND EMAIL someone@email.com This site AC Alarm"
        Toggle Flags 00100000
      End Block
    End Block
  End Block
Else
  Set Counter 1 = 0
  On Second
    Increment Counter 2
    If Counter 2 = 600
      If Flags xx10xxxx
        Exec "SEND EMAIL someone@email.com This site AC Back On"
        Toggle Flags 00010000
      End Block
    End Block
  End Block
End Block

With a little tricky peeking at the digital input byte, one can check on the status of bit 7, and make decisions based on that value. Counter 1 and counter 2 are used to keep from having power bumps cause false alarms. Power needs to be off for 5 minutes continuously in order for an alarm email to be sent. If the power comes back on for 10 minutes continuously, another email is sent to alert that power seems to be back up and stable. Flags again ensure only one email message is sent per AC outage/recovery event.

Macro ALARMACK
  Set Flags 00000000
  Set Pulse Count = 0
  Exec "SEND N0CALL Alarm Ack"
End Block

The ALARMACK macro needs to be called manually to reset the flags to reenable the alarm reporting after being acknowledged.

Interfacing

I/O interface

The interface to the real world is fairly simple. The wires are brought out to binding blocks. In the image can be seen the AC sense relay, 4 screw terminals for the door alarm and external battery stack monitoring. Another relay is included which can be controlled by the power command. The built in power MOSFET can handle up to 35 amps, but this external relay separates the switched power completely from the OT2 circuitry.