Connecting Geiger Counter for Arduino and Raspberry Pi to

2 years 11 months ago - 2 years 11 months 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 " 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):
# send data to and send notification for alarm state
# SBM-20 tube conversion factor from uSv/h to CPM
# 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
exec=`wget -O /dev/null "$user&password=$password&value=$line3&unit=CPM"`
/bin/sleep 5
##### alarm notification section #####
# notify alarm by XMPP if CPM > 75
if [ $line3 -gt $alarm ];
echo "Alarm CPM = "$line3 | sendxmpp -s hello
    echo "everything is normal" > /dev/null 2>&1;
Last edit: 2 years 11 months 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.139 seconds
Powered by Kunena Forum
Solar powered Raspberry Pi 4 server stats: CPU 33% Memory 13% Swap 16% CPU temp=44.8'C Uptime 72 Days