User Tools

Site Tools


Software

Check it out on github: https://github.com/apollo-ng/PiGI

Overview

pyGI Server

The pyGi server component is implemented in python and uses the RPi.GPIO python library to take care of handling the interrupts, generated by the impulses coming from the PiGI.

A LevelDB instance stores the collected data and websockets are used for the distribution of live and historical data to connected clients (webGI).

Naturally, it also provides an HTTP module to deliver the actual webGI client, so that any user can access the geiger counter without having to install native software first.

webGI Client

A kinda bleeding edge mobile-first HTML5/CSS3 Websocket based web client, than can be used in latest open source browsers like chromium & firefox.

Preliminary Dev Screenshots

[Main Instrument View] [History View] [Ion Trace Visualizer]

In the future, with more time and the help of other enthusiastic developers, there will also be a ready-to-download image, with kernel, OS and counting, logging & data sharing infrastructure, which just needs to be copied to the SD card so that it works out-of-the-box.

Installation

Dependencies

We've tried to keep external dependencies to a minimum to make it easily deployable on any flavor of open-source operating system. If you deploy it successfully on any other OS, please update this:

Currently tested versions

  • greenlet-0.4.2
  • bottle-0.12.4
  • gevent-1.0
  • gevent-websocket-0.9.3

Ubuntu/Raspbian

  $ sudo apt-get install python-pip python-dev libevent-dev
  $ sudo pip install ez-setup
  $ sudo pip install leveldb greenlet bottle gevent gevent-websocket

Gentoo

  $ emerge -av dev-libs/libevent dev-python/pip
  $ pip install ez-setup
  $ pip install leveldb greenlet bottle gevent gevent-websocket

Raspberry PI deployment

If you want to deploy the code on a PI for production in order to count values from a real GM tube connected to the PiGI-Module, you have to make sure to satisfy the RPi.GPIO dependency:

  $ pip install RPi.GPIO

This only applies to non-Raspbian installations, since Raspbian ships RPi.GPIO with the default installation.

Cloning the repository

  $ git clone https://github.com/apollo-ng/PiGI.git

Configuration

PyGI checks 3 configuration files, if existent in conf/, updating the values defined in the file before or using new ones, in the following order:

  • default.cfg (automatically comes shipped per default with examples)
  • local.cfg (create this file to override local server settings - gitignored)
  • dynamic.cfg (this file will be created automatically,

if the webGI client wants to change server settings - also gitignored)

When you are deploying on the Pi to count real values and/or want to change the Web Server/Socket port to 80 rather than 8080 you have to run the software as root. Otherwise the interrupt handling on the Pi won't work and port 80 will not be accessible due to security (<1024).

Usage

Server Startup

  $ cd PiGI/software/
  $ python pyGIserver.py

Client Access

Open a browser and go to http://127.0.0.1:8080

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Notes

GeigerJSON Template

{
    "type" : "geigerjson",
    "timestamp": 1393878981,
    "geostamp": {
        "lat": 48
        "lon": 11,
        "alt": 560
    }
    "node_uuid":"9b70c59c-a313-11e3-a61f-001f161087c0",
    "parameters": {
        "tube_id" : "LND712",
        "dead_time" : 0.000190,
        "tube_factor" : 0.00233,
        "opmode" : "[stationary|mobile]"
        "window": "[abc|bc|c]"
    },
    "data" : {
        "source": "[sim|test|env]",
        "cps" : 10,
        "cps_dtc" : 11,
        "cpm" : 600,
        "cpm_dtc" : 610,
        "totalcount" : 12345,
        "totalcount_dtc" : 12456,
        "edr" : 0.89,
        "edr_avg_15m" : 0.90
    },
    "annotation" : "my radioactive moment"
}

INES Scale for reference

Pulse size or collected charge

The GM tube output is a short charge pulse with an amplitude that is independent of the energy of the detected radiation. It just tells you that the incoming radiation had enough energy to be detected, but not how much. That leads to the question of how to calculate some other values out of the measured count rate.

Convert CPM to uSv/h

As discussed above, the GM tube doesn't know the energy of the detected radiation and also the count rate (R) depends on the tube specifications. Which means if you want to calculate a radiation dose per time (D) you can't calculate the correct value because you don't have all the information. All you can do is calculate a value as if you had radiation from Co-60, Cs-137, Sr-90 or some other radioactive isotope.

<x>D = R * conversion factor</x>

So to get from cpm to µSv/h (only units here, not really a correct equation):

<x>µSv/h = cpm * tube and energy specific conversion factor</x>

Common-List of Tube-Conversion-Factors

Effect of Dead-Time on Counts

In terms of GM tubes the Dead-Time is the time after an event in which the tube will not register another count. Positive ions close to the anode reduce the intense electric field so that approaching electrons do not gain enough energy to start new avalanches. The GM tube is then inoperative (dead) for the time required for the ions to migrate outward far enough for the field gradient to recover above the avalanche threshold. The time required for recovery to a value high enough for a new pulse to be generated and counted is called the “Dead-Time” and is of the order of 100 μs (microseconds). 1) 2)

To correct for this statistical error one has to calculate the actual (corrected) rate R with the measured (observed) rate and the tube specific Dead-Time.

Formula

<x 14>R_{corrected} = R_{observed} / {1 - (R_{observed} * t_{dead})}</x>

Example

Count rate R is 87,55 CPS (counts per second) with an SBM-20 tube.

<x 14>R_{observed} = 87.55 1/s</x>

The Dead-Time for this tube is listed as 190 uS.

<x 14>t_{dead} = 190 µs = 0.000190s</x>

<x 14>R_{corrected} = {87.55 1/s} / {1 - ((87.55 1/s) * 0.000190s)} = 87.55 / 0.98337 1/s = 89.03 1/s</x>


This means that the tube statistically missed 1,48 counts per second. The actual (corrected) rate is 89,03 CPS.

Measurements with the LND712 showed a longer dead time than the datasheet advertised (about 120-150us). Moving up higher in the plateau also seemed to increase the dead time. For perfect operating conditions, the tube voltage should be set to a value within the advertised operating range and then fine tuned to decrease the dead time to the lowest possible value, without affecting the tubes.

Discussion

markus, 2022/02/03 12:18

i have a running server. everything works fine locally. thanks a lot.

now i want to get data to an external database (mysql/weewx on another pi). one way would be curl and parsing of *.json.

but i cannot find a json-file like the one above. how can i run pyGI Server so that it produces a json file with the live data?

what would be the path to it in my browser?

thanks in advance.

rob , 2022/11/25 16:04

Bold TextHas anyone converted this to Python 3? Python 2 was problematic, since it is not used as default in Raspian

I have slowly been converting over the files and ran intBold Texto an error:

“File ”/home/username/PiGI/software/pyGI/geigerlog.py“, line 33, in get_last_totalcount

  db.RangeIter(include_value=False).next()

AttributeError: 'leveldb-iterator' object has no attribute 'next' ”

mike, 2024/01/07 14:10

Hi, did you ever get this to work with 3? I tried latest os and replacing with python2 but big mess.:-(

natspandcomactivate, 2023/12/06 10:59

Having been established in 1999,https://natspandcomactivate.online/ is a prominent supplier of prepaid debit cards and business prepaid card solutions, serving over 10 million clients nationwide. You can apply for a Netspend card in a few different ways. Like any other debit or credit card, you can activate your card over the phone or online as soon as you receive it.

Refugio , 2024/01/24 18:00

Its really a detailed post for us to learn about it. These ideas can make the things good for us. By using the best ideas at this site https://www.twitch.tv/dunkinrunsonyou and here https://beacons.ai/dunkinrunsonyou I got to know about the best services that resolves the issues.

us, 2024/02/07 04:12

To store the collected data, among us the pyGI server utilizes a LevelDB instance, offering a lightweight and efficient solution for data storage.

Carlos Roberts, 2024/03/05 23:50

I recently had the pleasure of using this writing service, and I must say, the experience was exceptional. From start to finish, their professionalism shone through, delivering top-notch content that exceeded my expectations. What truly impressed me was their attention to detail and commitment to meeting deadlines. I found them through a glowing review at LinkedIn, and now I understand why they come highly recommended. If you're seeking quality writing services, look no further. I'll definitely be returning for future projects. Five stars all around!

Enter your comment. Wiki syntax is allowed:
K I J᠎ W L