PyRadmon install and set up on Raspberry Pi (Wheezy Raspbian)

4 months 2 days ago #4252 by ThibmoRozier
Just wait......
I am working on a rewrite that doesn't require you to download one of 4 versions.
I'll also add proper support for setting log levels. The suggestion is what we'd call "a hack" and absolutely not according to standards. It is never suggested to fully disable logging, at the very least set it to ERROR.

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

4 months 1 day ago - 4 months 1 day ago #4253 by pilovis
ThibmoRozier, I don't know what kind of CPM your script is reading.

Stopwatch at the hand, I'm measuring from 5 to 9 CPM inside my room (0,040-0,073 uSv/h for my tube) instead of 18/31 CPM (0,14-0,25 uSv/h) your script is supposing to read now.
Just to be sure I moved my device to Turin since there is an official monitoring station of the local university that is about 1.6 miles away from here, their current reading is 0,070 uSv/h (outside):

Also the other stations here in north Italy that send data to Radmon seem to send irreal data (considering conversion factor of their tubes), since the official monitoring stations, about in the same locations, give much less reading values!

Be careful to publish such data without any verification, also CPM reading from different tubes are not always directly comparable, like this site seems to do, each tube has its own Conversion factor and it must be calculated before inserting data, 10 CPM from my tube are not the same of 10 CPM from another another brand tube.
It would be much better to publish uSv/h values instead of CPM values that are not always comparable.

I think I will stop sending data to radmon until I will be sure to send real data.
Last edit: 4 months 1 day ago by pilovis.

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

4 months 1 day ago - 4 months 1 day ago #4254 by ThibmoRozier
Thing is that they are using calibrated units, we are using DIY stuff.
You can simply not compare those.

Also, PyRadmon(-Reborn) in serial mode sends what your counter returns as a value.

IMO the MyGeiger returns a very decent value, even though this does depend on how "good" your tube is.

Sneak-peek of the new config for PyRadmon-Reborn v2.0.0:
// Parameter names are not case-sensitive
// Parameter values are case-sensitive
// Log levels: 10 = DEBUG, 20 = INFO, 30 = WARNING, 40 = ERROR, 50 = CRITICAL
// The Radmon username and password
// Port is usually /dev/ttyUSBx on Linux and COMx on Windows
// In case of audio, set the device ID here.
// ID: {}.{9dec41af-1b86-4c24-8e19-78564c886765} ; Name: Microfoon (Realtek(R) Audio)
// ID: {}.{d983da26-9b68-4ca5-bc7d-e2c07de3cd6e} ; Name: Microfoon (Live! Cam Chat HD VF0790)

I also moved away from pyaudio and switched to soundcard for audio, as it doesn't require intermediate libs, it doesn't block the devices unless necessary and it returns full device names.
The new version will also be one single file for the whole shebang, no longer the odd "pick your type", but dynamic dependency loading. (No soundcard means no audio support, no pyserial means no serial support)
I have also decided to drop support for 2.7 and move on to Python 3.
Last edit: 4 months 1 day ago by ThibmoRozier.
The following user(s) said Thank You: mw0uzo

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

4 months 10 hours ago - 4 months 8 hours ago #4256 by pilovis
I am now sending real and calibrated data.
My readings range from 3 to 9 CPM, tube conversion factor 0.00812, one reading for 6000 ms (measure time = 1 minute).
Honestly I don't know what kind of data others are sending since their readings seem to me too high.

My scripts (all Bash):

sudo apt-get install bc

This is the script I programmed to have a csv file with data readings.
note: the awk part add unixtime, date and time, the sed part substitutes "spaces" with "commas" and to write the csv file,
unixtime will be used as a primary key in Mysql to avoid importing duplicates
/root/geiger_tube/measure 2>&1 | awk '{ print strftime("%s %Y-%m-%d %H:%M:%S"), $0; fflush(); }'  | sed -e 's/\s\+/,/g;w /var/www/rad/readings.csv'



# L305By tube conversion factor from uSv/h to CPM (CPM = uSv/h * conv)
# read last value from csv file generated by my instrument
line="$(/usr/bin/tail -n 1 /var/www/rad/readings.csv | cut --complement -c  1-31 | cut --complement -c  9-14 | sed -e 's/,/ /g')"
# calculations to get CPM from uSv/h
#echo $line
line2="$(echo "$line*$conv" | bc)"
#echo $line2
line3="$(echo $line2 | awk '{print int($1+0.5)}')"
#echo  $line3
# send data to
exec=`wget -O /dev/null "$user&password=$password&value=$line3&unit=CPM"

send to the last CPM reading every minute:

crontab -e
*/1 * * * * /bin/sh /root/

Import data to MySQL database:
/usr/bin/mysql -upilovis -pmypwd --local_infile=1 data -e "LOAD DATA LOCAL INFILE '/var/www/rad/readings.csv' INTO TABLE letture_radiazioni FIELDS TERMINATED BY ',' enclosed by '\

MySQL db structure
CREATE TABLE `letture_radiazioni` (
  `unix_time` bigint(20) NOT NULL,
  `date` date DEFAULT NULL,
  `time` time DEFAULT NULL,
  `value` decimal(10,6) DEFAULT NULL,
  `unit` text,
  PRIMARY KEY (`unix_time`),
  UNIQUE KEY `unix_time` (`unix_time`)

I'm planning to move from one reading for 6000 ms (one minute) to one reading for 30000 ms (30 minutes), to get more consistent data.
Last edit: 4 months 8 hours ago by pilovis.
The following user(s) said Thank You: mw0uzo

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

4 months 7 hours ago #4257 by ThibmoRozier
You might want to make your own topic for this, as this forum section is dedicated to PyRadmon(-Reborn).
It would also be better to use curl, rather then wget. That way you don't have to output to /dev/null

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

1 month 2 weeks ago - 1 month 2 weeks ago #4385 by jnissen

To completely disable logging (higly suggested for embedded devices like Raspberry), you need to do this modification on the script:

# Set logger default info
logging.basicConfig(filename = "pyradmon_log.log", filemode = "a",
format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
datefmt = "%d/%m/%Y %H:%M:%S %p")
logger = logging.getLogger("PyRadmon (Without audio)")

I login to my pi periodically and clean up the logs but this is certainly an option. I must say that since moving to the pi3 with both 2.4GHz and 5GHz wifi my reliability has gone up considerably. No more drop outs and mysterious missing days.

It's just an observation I have made that logging may not be the source of the issues for everyone.
Last edit: 1 month 2 weeks ago by jnissen.

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

Time to create page: 0.116 seconds
Powered by Kunena Forum