Skip to main content

A library for monitoring radiation with the Radiation Watch Pocket Geiger.

Project description

Raspberry Pi Pocket Geiger library

Build Status PyPI version

A Raspberry Pi library to interface with the Radiation Watch Pocket Geiger counter (Type 5).

The library monitors the Pocket Geiger through interrupts - using the RPi.GPIO package - and processes the CPM and hourly Sievert dose.

Learn more about the Pocket Geiger counter on the Radiation Watch FAQ and on our blog. Actually it is not a proper Geiger-Müller counter, but a Photodiode PIN sensor that can effectively counts gamma rays.

Getting started

Install the library

PiPocketGeiger on Pypi.

Python 2

# Ensure RPi.GPIO library is installed.
# Instruction here for Raspbian. See https://sourceforge.net/p/raspberry-gpio-python/wiki/install/
sudo apt-get install python-rpi.gpio
sudo pip install PiPocketGeiger

Python 3

# Ensure RPi.GPIO library is installed.
# Instruction here for Raspbian. See https://sourceforge.net/p/raspberry-gpio-python/wiki/install/
sudo apt-get install python3-rpi.gpio
sudo pip3 install PiPocketGeiger

Wiring

The Pocket Geiger must be wired to the GPIO ports of the Raspberry Pi. Refer to the GPIO pin specification of your RPi revision.

For exemple you can wire the radiation and the noise pin on respectively the GPIO24 and GPIO23 of your Raspberry Pi.

Pocket Geiger pin Raspberry Pi pin Standing for
+V 3V3 Alimentation pin (DC 3V~9V)
GND GND Ground pin
SIG GPIO24 Radiation-detection pulse pin
NS GPIO23 Noise-detection pulse pin

The pin used are specified at the creation of the library object:

with RadiationWatch(24, 23) as radiationWatch:
  pass # Do something with the lib.

Even if the Pocket Geiger can handle voltage between 3V and 9V, the RPi GPIO only works on 3.3V levels, so do NOT supply 5V to your Pocket Geiger, but 3.3V instead.

Pocket Geiger Type 5 interface specification.

Initialize the library

You can either use the with statement to initialize an instance of the library. It will automatically bootstrap the instance and properly close it when existing the with block.

with RadiationWatch(24, 23) as radiationWatch:
    # Do something with the lib.
    print(radiationWatch.status())

You can also manage yourself the lifecycle of the instance, using setup() and close().

# Create an instance.
radiationWatch = RadiationWatch(24, 23)
# Initialize it (setup GPIOs, interrupts).
radiationWatch.setup()
# Do something with the lib.
print(radiationWatch.status())
# Do not forget to properly close it (free GPIOs, etc.).
radiationWatch.close()

Getting readings

To get readings, call the status() method:

print(radiationWatch.status())
# {'duration': 14.9, 'uSvh': 0.081, 'uSvhError': 0.081, 'cpm': 4.29}

Then do whatever you need with the results. For exemple, log them to a terminal or write them on a file.

React on radiation hits

The library allows to register callbacks that will be called in case of radiation or noise detection, using respectively the register_radiation_callback() or register_noise_callback():

def onRadiation():
    print("Ray appeared!")
def onNoise():
    print("Vibration! Stop moving!")
with RadiationWatch(24, 23) as radiationWatch:
   radiationWatch.register_radiation_callback(onRadiation)
   radiationWatch.register_noise_callback(onNoise)
   while 1:
       time.sleep(1)

This can be used to simulate the typical Geiger counter click sound or as a random generator.

Stream in real-time on Plotly

As a more ellaborate idea, you can stream the data directly to Plotly, allowing to sharing it easily. See the complete exemple.

In the same vein, you can upload reading to a Google Docs or also broadcast on Twitter.

Finally if you want to contribute to an open-data initiative you can publish your measurements to the Safecast API. More info on the SafecastPy lib repo.

Yes, with a Raspberry Pi, Python and an internet access, there's not so much limits to what you can pretend!

Note on Noise

Remember the Pocket Geiger can't record correctly in presence of vibration. For a more precise and mobile oriented unit, you may look at the bGeigie Nano from the Safecast project.


Like it? Not so much? Simply tell us. Don't forget to check out our blog! :-)

Happy hacking!

Credits

Created upon the Radiation Watch sample code.

Contribute

Feel free to open a new ticket or submit a PR to improve the lib.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

PiPocketGeiger-0.4.1-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file PiPocketGeiger-0.4.1-py2.py3-none-any.whl.

File metadata

  • Download URL: PiPocketGeiger-0.4.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.5.3

File hashes

Hashes for PiPocketGeiger-0.4.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 291328e40788da67484cc24cef2d4710aa87e108ff4825b3b846562153579edd
MD5 62feef95220197ada47a2ed99b85ee25
BLAKE2b-256 3075bddec48a1809d23278cbf15852a4f803274368c05c8a5d782e0e02572b09

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page