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

More
9 years 8 months ago #754 by ThibmoRozier
Hmm, will give it a check, maybe it has something to do with the gmc protocol... but if I understand well, it send back 0x00 0x1C to report 28 CPM? O.o Or is it 0x001C?

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

More
9 years 8 months ago #755 by tcall
Thanks to James today, who got two of us well on the way to learning our way round the Raspberry Pi B+ and getting Py.Radmon to run on it.
Matt should be on line very soon and I got my R.H. Electronics Geiger Counter (kit) going all night and registering on the Radmon site. Needed to use the
Pi today to compare with Matt's board, but it is now back on line and I see no reason why it should not be continuously on-line from now on. Power consumption is very
low, but I suppose I should now remove the display board. The next step will be to mount the sensor on the wall outside. We also have a mobile Geiger Counter with the very sensitive SBM19 tube.

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

More
9 years 8 months ago #758 by jnissen

Hmm, will give it a check, maybe it has something to do with the gmc protocol... but if I understand well, it send back 0x00 0x1C to report 28 CPM? O.o Or is it 0x001C?


I think it comes back as 0x00 and 0x1C. I don't know how you could pass 16 bits in a serial exchange. The RS232 protocol (serial) dictates all data pass as bytes (8 bits).

Baud: 57600
Data bit: 8
Parity: None
Stop bit: 1
Control: None

The RS232 protocol dictates that it be 8 bits so it's assumed it's two bytes per command request. I think your handling the data correctly in the Python script. I am planning to play some more with it later tonight. Hopefully I can shine a bit more light on what is going on.

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

More
9 years 8 months ago - 9 years 8 months ago #759 by mw0uzo
Does it work in RadLog?
If so, I can check the code to see if there was anything about that model that was tricksy to get working. I remember quite a few headscratching moments with Frank's GMC-320!
Last edit: 9 years 8 months ago by mw0uzo.

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

More
9 years 8 months ago - 9 years 8 months ago #766 by jnissen
Works fine in RadLog. I tried a number of hacks with delays and such and nothing helped. Always shows up as insufficient info from the GMC unit. Obviously this detector ues a RS232 to USB converter chip and the BBB apparently recognized that part and the device properly shows up as /dev/ttyUSB0. It could be as simple as the driver that recognized the PL2303 (RS232-to-USB device) inside the GMC unit is not well supported in the Debian release. I know my Win8.1 machine needs to run a down level version of the driver to make it work with the RadLog tool.
Last edit: 9 years 8 months ago by jnissen.

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

More
9 years 8 months ago - 9 years 8 months ago #769 by ThibmoRozier

Works fine in RadLog. I tried a number of hacks with delays and such and nothing helped. Always shows up as insufficient info from the GMC unit. Obviously this detector ues a RS232 to USB converter chip and the BBB apparently recognized that part and the device properly shows up as /dev/ttyUSB0. It could be as simple as the driver that recognized the PL2303 (RS232-to-USB device) inside the GMC unit is not well supported in the Debian release. I know my Win8.1 machine needs to run a down level version of the driver to make it work with the RadLog tool.


That's odd...
I'll see if there is a specific driver that can handle this device. :)

Oke.. So what I already found:

Linux:

Open source drivers are included in Linux kernels 2.6.11 and later. These have support for the Prolific 2303 chipset, and recognize the plug and play IDs of the Plugable adapter.


Will see if Python needs a specific manner of handling this chip.

Hey and back with a third edit. :P
GMC indeed has a static buad rate... Meh.

So static info:
Baud: 57600
Data bit: 8
Parity: None
Stop bit: 1
Control: None

Could you please try the following, and respond with the discoveries?
Replace the original gmc class with this one.
//Edit 3 on this.. Wow I should get some coffee..... Made an infinate loop and 30 second gap version.... >.< This should solve it.
class gmc(baseGeigerCommunication):

    def initCommunication(self):

        print "Initializing GMC protocol communication => geiger 1\r\n"
        # get firmware version
        response=self.sendCommand("<GETVER>>")

        if len(response)>0:
            print "Found GMC-compatible device, version => geiger 1: ", response, "\r\n"
            # get serial number
            # serialnum=self.sendCommand("<GETSERIAL>>")
            # serialnum.int=struct.unpack('!1H', serialnum(7))[0]
            # print "Device Serial Number is: ", serialnum.int
            # disable heartbeat, we will request data from script
            self.sendCommand("<HEARTBEAT1>>")
            print "Please note data will be acquired once per 5 seconds => geiger 1\r\n"
            # update the device time
            unitTime=self.sendCommand("<GETDATETIME>>")
            time.sleep(0.5)
            print "Unit shows time as => geiger 1: ", unitTime, "\r\n"
            # self.sendCommand("<SETDATETIME[" + time.strftime("%y%m%d%H%M%S") + "]>>")
            # print "<SETDATETIME[" + time.strftime("%y%m%d%H%M%S") + "]>>"
            
            self.i=0
            self.cpm=-1
            
            try:
                # wait, we want sample every 30s
                while i is not 30:
                    # send request
                    # response=self.sendCommand("<GETCPM>>")
                    # wait for data
                    while (self.serialPort.inWaiting()==0 and self.stopwork==0):
                        time.sleep(0.5)

                    time.sleep(0.1) # just to ensure all CPM bytes are in serial port buffer
                    # read all available data
                    x=""
                    while (self.serialPort.inWaiting()>0 and self.stopwork==0):
                        x = x + self.serialPort.read()
                        i = i + 1

                    if len(x)==2:
                        if self.cpm==-1:
                            self.cpm=0
                        # convert bytes to 16 bit int
                        self.cpm=self.cpm + ord(x[0])*256+ord(x[1])
                    else:
                        print "Unknown response to CPM request, device is not GMC-compatible? => geiger 1\r\n"
                        self.stop()
                        sys.exit(1)

            except Exception as e:
                print "\r\nProblem in getData procedure (disconnected USB device?) => geiger 1:\r\n\t",str(e),"\r\nExiting\r\n"
                self.stop()
                sys.exit(1)

        else:
            print "No response from device => geiger 1\r\n"
            self.stop()
            sys.exit(1)

    def getData(self):
        utcTime=datetime.datetime.utcnow()
        data=[self.cpm, utcTime]
        self.cpm=-1
        return data

Last edit: 9 years 8 months ago by ThibmoRozier.

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

Moderators: Gamma-Man
Time to create page: 0.209 seconds
Powered by Kunena Forum
Everything's free. Please support us by considering a donation. Log in first!
Solar powered Raspberry Pi 4 server stats: CPU 59% Memory 21% Swap 70% CPU temp=52.5'C Uptime 72 Days