The MightyOhm Geiger counter is a great DIY project, and there is a simple way to connect it to a Raspberry Pi for data logging and displaying with a Pimoroni Scroll pHAT. The code supports either the newer HD Scroll pHAT or the older version with a simple variable change at the start of the Python program.
This article first appeared in The MagPi 67 and was written by Bill Ballard
- Raspbian Lite
- MightyOhm Geiger counter with Geiger tube
- Geiger counter case to protect you from high voltage
- 5 V USB power supply
- Pimoroni Scroll pHAT HD
Download and install the latest version of Raspbian Lite on your microSD card using any of the excellent instructions in the Raspberry Pi Forum. If you copy your wpa_supplicant.conf file to the boot partition before the first startup, your wireless network connection will be active immediately. Initialise Raspbian with raspi-config to the proper Internationalisation Options (time zone, keyboard, wireless country code, etc.), change the default password, and set the host name in Advanced Options to something like ‘geiger’. Make sure that you enable I2C in the Advanced Options of raspi‑config, and SSH if you will be connecting remotely. Next, edit:
sudo nano /boot/cmdline.txt
…from the line. Save, then exit the file and reboot the Raspberry Pi. Now you should do the usual update and upgrade to the operating system:
sudo apt-get update && sudo apt-get upgrade -y
Next, install the Python pip and scrollphathd applications (just leave off the ‘hd’ if using an older Scroll pHAT):
sudo apt-get install python3-pip python3‑scrollphathd
Finally, install pySerial and flask:
sudo pip3 install pySerial flask
…and you are all set.
Download the geiger.py file from GitHub and customise it for your desired log file location and your Scroll pHAT version (HD = True or False).
Assuming you have already assembled the Geiger counter with the MightyOhm instructions, you only need to solder the header to the Scroll pHAT and connect a few wires. Optionally, you can use an extra-tall 2×20 stacking header so you can use a connector. To connect the pHAT to the Raspberry Pi, you need to solder three wires to the Scroll pHAT corresponding to GPIO physical pins 6, 8, and 10. Pin 6 (GND) connects to the Geiger counter’s J7 connector pin 2, pin 8 (GPIO 14) connects to the J7 pin 4, and pin 10 (GPIO 15) connects to the J7 pin 5. Feel free to use a connector rather than direct wiring.
Connect the Pi to power, then turn on the Geiger counter (mute it if you wish, using the push-button). Log in and launch the program with:
python3 geiger.py &
The display should start showing the uncalibrated radiation level in microsieverts per hour, scrolling across the screen until you kill the process using:
kill -9 PID
…where PID was the number shown when you initially launched the program. Alternatively, you can use:
ps -ef | grep geiger
…to find the PID of the geiger.py process.