Hello, 

 I have idea to augment weather station data with level of ionizing 
radiation. Simple and inexpensive geiger counter model was chosen. Device 
is Radex One.
Primarily unit works with dedicated Windows software via USB port.
After some playing with serial port monitor is possible to send request and 
then receive response from device.
Below is sample response from dosimeter.

7AFF208016000A0000004480000800000C0000007103000004020000710300000DEF

Where bytes x000371 = 8,81uSv/h (dose rate), x000204 = 5,16 uSv 
(accumulated dose), x000371 = 881 CPS (counts per minute)

Is possible to fix phyton script below to adopt it for my device?

Need to say, program below is written to comunicate with same manufacuter 
device, but device purpose differs,  it measures radon gas concetration in 
air, also it measures temperature and humidity.
According data bytes is represented with IEEE754 format, but for my 
dosimeter is just simple  conversion from hex to dec and data string length 
is smaller (34 bytes vs 70 bytes from radon meter)

import serial
import struct

ser = serial.Serial(
    port='/dev/ttyACM0',
    baudrate=9600,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.EIGHTBITS
)

ser.isOpen()
packet = 
bytearray(b'x7bxffx20x00x06x00x83x04x00x00xdaxfbx04x08x0cx00xefxf7')
ser.write(packet)

raw_temp = ""
raw_hum = ""
raw_rad2 = ""
raw_rad3 = ""

exp_timer = 0;

for x in range(0, 70):
    c = ser.read()
    print '{0:x}'.format(ord(c), 10), " ",

    if x in range(28, 32):
       raw_rad3 = raw_rad3 + c
    if x in range(32, 36):
       raw_temp = raw_temp + c
    if x in range(36, 40):
       raw_hum = raw_hum + c
    if x in range(56, 60):
       raw_rad2 = raw_rad2 + c
    if x == 64:
       exp_timer = ord(c);
    if x == 65:
       exp_timer = ord(c) * 256 + exp_timer;

print ""
[temperature] = struct.unpack('f', raw_temp)
print "Temperature: " + str(temperature)
[humidity] = struct.unpack('f', raw_hum)
print "Humidity: " + str(humidity)
[radoncur] = struct.unpack('f', raw_rad3)
print "Radon Cur: " + str(radoncur)
[radonmax] = struct.unpack('f', raw_rad2)
print "Radon Max: " + str(radonmax)
print "Exposure countdown: " + str(exp_timer)



Thanks

Andrej


-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/6b0b6357-aa1d-47b7-bb7c-10656f1b6a43n%40googlegroups.com.

Reply via email to