stelas / GCLog

GCLOG is a lightweight daemon running in the background and constantly reporting your Geiger counter readings to various radiation monitoring websites. With a small footprint and minimal dependencies it is aimed to run on Linux embedded computers.
https://www.gclog.de/
GNU General Public License v3.0
9 stars 1 forks source link

[ERROR] Reading ZERO value from Geiger tube #1

Closed snarkbe closed 5 years ago

snarkbe commented 5 years ago

I have connected a GQ GMC 320+ v5 on a RasPi 2 Model B v1.1 running Raspbian. The device is detected on /dev/ttyUSB0 and listed in lsusb.

The file gclog.conf is correctly configured to use /dev/ttyUSB0. When I start GCLog v0.2.4 (installed from the deb package), I get the following error every 2 seconds in journalctl :

Apr 17 10:06:59 pihole gclog[754]: [ERROR] Reading ZERO value from Geiger tube.

Any idea about the issue? Is there a way to troubleshoot the serial connection? The GC is working fine, and sending data to the GQ Windows software when connected to my PC.

snarkbe commented 5 years ago

BTW I did enable device.type=gq in /etc/gclog.conf and disable the other 2.

stelas commented 5 years ago

Sounds strange to me. This error means that although data is written but cannot be received.

Is there any other USB device connected to the Raspi? So gclog may read from the wrong one. You plug in the Geiger counter, turn it on so that it shows readings and then start gclog, right? Gets the Geiger counter date/time synchronized with your Raspi on gclog startup?

If you can rule this out: Can you post the corresponding lines from dmesg and lsusb? Please also provide the verbose output from gclog started with parameter -d (remove passwords, user ids, etc.).

snarkbe commented 5 years ago

I don't have any other USB device connected to the RasPi.

dmesg:

[    2.135590] usb 1-1.4: New USB device found, idVendor=1a86, idProduct=7523
[    2.135607] usb 1-1.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[    2.135617] usb 1-1.4: Product: USB2.0-Serial

[    4.390588] usbserial: USB Serial support registered for ch341-uart
[    4.390693] ch341 1-1.4:1.0: ch341-uart converter detected
[    4.393637] usb 1-1.4: ch341-uart converter now attached to ttyUSB0

lsusb:

Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Here is the verbose output. I only plan to send data to GMCMap:

# gclog -d -c /etc/gclog.conf
   ___    Geiger Counter LOGger daemon
   \_/    Version 0.2.4 (Build 2018-04-14)
.--,O.--,
 \/   \/  Copyright (C) 2014-18 Steffen Lange, gclog@stelas.de

This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

Usage: gclog -c <file> [-d]
  -c <file>  load configuration from file
  -d         activate verbose mode

Configuration:
                GQ GMC Geiger Counter on /dev/ttyUSB0,
                Location: XXX, XX (50.2123, 1.234560)
                netc.com: (null),
                radmon.org: (null) / (null),
                safecast.org: (null) / Device ID 0,
                gmcmap.com: 12345 / Device ID 1234567890,
                60s interval

This works fine on the RasPi: https://github.com/chaim-zax/gq-gmc-control . It connects fine to the GQ GMC, I can run all the commands without problems:

$ ./gq-gmc-control.py -i
GMC-320Re 5.20 
stelas commented 5 years ago

Everything seems to be right, except your GMC firmware version is much newer than mine. I slightly modified the send function (fcc206bac0074705339edce6a086d9a8f44a3f21). Please test attached gclog binary for Raspi and let me know if it works...

snarkbe commented 5 years ago

Sorry, same error message with the updated gclog : Apr 18 15:08:50 pihole gclog[10370]: [ERROR] Reading ZERO value from Geiger tube.

The first error message in journalctl is logged exactly 60 seconds after I run the gclog command.

stelas commented 5 years ago

The default polling interval is set to 60 seconds in gclog.conf. Here comes another gclog binary. It's based on b7f3683e72f8307a8667878330aab205115801b0, but with a higher baud rate of 115200. Can you trace the made system calls: strace -v -f -o trace.log ./gclog -d -c /etc/gclog.conf & Wait until two or three Geiger counter readings are made, then stop it: killall gclog And upload the captured trace.log here.

snarkbe commented 5 years ago

Increasing the baud rate was the solution apparently: Apr 18 19:32:22 pihole gclog[11957]: CPM: 24 (= 1484/61), Timestamp: Thu Apr 18 17:31:22 2019 Apr 18 19:33:23 pihole gclog[11957]: CPM: 29 (= 1727/59), Timestamp: Thu Apr 18 17:32:23 2019

Do you still need the trace.log ? I have captured one.

It's correctly uploading CPM data to GMCMap.com! :-) Thanks!

stelas commented 5 years ago

Great that it works!

Regarding to GQ's manual the baud rate is different in newer hardware revisions.

I'll add an option for that in the next GCLog release...

snarkbe commented 5 years ago

I have compiled and installed 2.0.5. Thanks for the new release. The page at https://www.dateihal.de/cms/gclog has not yet been updated for it, but maybe it's normal.

stelas commented 5 years ago

Solved in v0.2.5 (57de17c254d878ef037bf0e5cba95d43a0b33370). Package for Raspi is available here.