Connecting Geiger Counter for Arduino and Raspberry Pi to radmon.org

More
3 months 3 weeks ago - 3 months 3 weeks ago #4326 by pilovis
Just to improve the system and get notification every time the CPM reading goes above a certain limit.

I choosed to get notification by XMPP since I've got my own personal XMPP server, but you can easily change the code and get notification by SMS or/and by email.

To install a simple XMMP client on Raspberry do the following:
su - root
apt-get install sendxmpp

then create config file for sendxmpp:
su - root
echo "me@myjabberserver.com mypassword" >> ~/.sendxmpprc
chmod 700 ~/.sendxmpprc
cp -v ~/.sendxmpprc /etc/sendxmpprc
note: change "This email address is being protected from spambots. You need JavaScript enabled to view it." and "mypassword" with your credentials

Bash code modified (see previous posts):
#!/bin/bash
# send data to radmon.org and send notification for alarm state
#
# SBM-20 tube conversion factor from uSv/h to CPM
conv=361
# read last value from csv file generated by the instrument
line="$(/usr/bin/tail -n 1 /tmp/readings.csv | cut --complement -c  1-31 | cut --complement -c  9-14 | sed -e 's/,/ /g')"
# calculations to get CPM from uSv/h
line2="$(echo "$line*$conv" | bc)"
line3="$(echo $line2 | awk '{print int($1+0.5)}')"
# send data to radmon.org
user="my_radmon_username"
password="mypasswd"
exec=`wget -O /dev/null "http://radmon.org/radmon.php?function=submit&user=$user&password=$password&value=$line3&unit=CPM"`
/bin/sleep 5
##### alarm notification section #####
# notify alarm by XMPP if CPM > 75
alarm=75
if [ $line3 -gt $alarm ];
then
echo "Alarm CPM = "$line3 | sendxmpp -s hello me@myjabberserver.com
else
    echo "everything is normal" > /dev/null 2>&1;
fi;
Last edit: 3 months 3 weeks ago by pilovis.
The following user(s) said Thank You: mw0uzo

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum