Raspberry Shake Quake Alert Program
This program gets the Raspberry Pi Shakes geophone EHZ channel and d-trends it before plotting it. It also lets you set an alert threshold such that when the geophone value goes above the threshold an alert message is displayed.
Program
---
Raspberry Shake Quake Alert Program
This program gets the Raspberry Pi Shakes geophone EHZ
channel and detrends it before plotting it.
Set an alert threshold for the alarm to be triggered.
---
prog_vars =
d/count 0
d/xpos 0
-- Processed Geophone Sensor Value
-- This has been detrended
d/pro_EHZ 0.0
d/prev_EHZ 0.0
prog_vars.
prog_start =
pclear
d500
-- Display the Title.
ptl 100 1 ^ts=24^tc=blue^ "Raspberry Shake Alert Program"
-- Add Quit Button
pb 25 50 ^n=Quit^p=exitprog^
prog_start.
prog_loop =
-- main program loop
inc /count
-- Stop after 10,000 readings
any /count >= 10000 -> exitprog
-- Ignore the first few readings so the de-ttending can work
any /count >= 3 ->
-- Get a fresh set of readings from the shake
-- grsk AM.R5C47
grsk AM.R7DD4
-- Wait a while for next readings
-- NEED this delay.
d250
-- d-trend the reading
sub /rs_EHZ /prev_EHZ -> /pro_EHZ
-- Invert the negative values
abs /pro_EHZ -> /pro_EHZ
-- Plot the pro_EHZ geophone value
plot 10 150 ^id=rs^t1n=Z^t2n=E^t3n=N^xp=/xpos^v1=/pro_EHZ^
-- Display the plot value
ptl 30 100 ^ts=16^ "X /xpos > EHZ /rs_EHZ pro EHZ /pro_EHZ "
-- Check for a Quake
any /pro_EHZ >= 500 ->
-- YES we have a quake
ptl 100 40 ^ts=25^tc=red^ "Tapapa Hopukina Kia mau"
else
-- NO no quake
ptl 100 40 ^ts=25^tc=Lime^ "OK"
enda.
-- Next Xpos
inc /xpos
enda.
-- Update the previous value.
/prev_EHZ /rs_EHZ
prog_loop.
prog_stop =
ptl 25 25 ^ts=75^ "Bye"
prog_stop.