Connecting Geiger Counter for Arduino and Raspberry Pi to

2 years 2 months ago - 2 years 2 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 2 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.133 seconds
Powered by Kunena Forum
Solar powered Raspberry Pi 4 server stats: CPU 40% Memory 15% Swap 0% CPU temp=54.0'C Uptime 10:07, Days