WhyzaGC - Feather ESP32 addon to the MightyOhm Gieger Counter

Updated 16 January 2023

This project is about adding a wireless Adafruit Feather HUZZAH ESP8266 or ESP32 v2 with Adafruit Featherwing 128x64 OLED to interface with the self-assembled MightyOhm Geiger Kit.

WhyzaGC running and tracking the background radiationWhyzaGC running and tracking the background radiation

Introduction

I am always on the lookout for unique and interesting kits to build which led to me discovering the MightyOhm Geiger kit.

While there are a couple of other Geiger kits around, the fact that the MightyOhm was in stock (rare in these post covid times!), it included a commonly used detector tube (for relative data comparisons), its serial output, along with its steampunk looks, it had me sold.
I initially started with the ESP8266 and then 'upgraded' to the ESP32 to take advantage of the dual-core as I ran into limitations multitasking on the ESP8266 as discussed below.
As such I would recommend the Feather Huzzah ESP32 v2 over the original ESP8266 version due to both the NeoPixel RGB LED and dual-core functionality. That said, if you have a Feather Huzzah ESP8266 already, it will work just fine.

I also discovered Radmon.org which seemed a worthwhile project to contribute data to. It has a very simple and easy registration process...and runs on solar power!
While waiting for delivery I checked a number of forums looking for ideas on how to interface with the counter for both the Raspberry Pi and Arduino. I found a dated project using the Huzzah and MightyOhm and after researching parts availability, I decided to do my own Arduino project from scratch as I wanted to increase my Arduino coding skills. I also found some good ideas for interfacing with the Raspberry Pi which I also cover.

It was also a good opportunity to learn a lot more about radiation and our environment.
The MightyOhm measures background radiation levels, which Wikipedia defines as “Background radiation originates from a variety of sources, both natural and artificial. These include both cosmic radiation and environmental radioactivity from naturally occurring radioactive materials (such as radon and radium), as well as man-made medical X-rays, fallout from nuclear weapons testing and nuclear accidents.”

I bought from Ebay a piece of Vaseline glass to test out the meter's functionality. Other test options are discussed below.
It is recommended to read all of this document before commencing the project.

 

Features

  • Adafruit Feather Huzzah ESP8266 and ESP32 v2 support, OLED display, Li-Po battery
  • Button inputs for 4 OLED display modes showing different data formats. Includes bar meter strength graphs, auto-scaling histograms, and detailed data. Photos below.
  • Radmon.org data upload every 60 secs: https://radmon.org/index.php
  • Web server diagnostics are available via HTTP over port 80 (data, radmon.org upload status, debug, uptime)
  • Blue LED/Neopixel heartbeat, Red LED Counts per Second (CPS)
  • Monitoring of MightyOhm's serial data for disconnections.
  • MightyOhm serial data over HTTP and Telnet
  • mDNS multicast name registration
  • Neopixel Radmon status indications.
  • NTP client for OLED and web server time display
  • Unix syslog status messages to your syslog server

Parts List

 

Assembly

While assembling your MightyOhm if you are yet to do so, do not install the AAA battery holder as this is where the Feather Huzzah is to be placed. If you have assembled your kit, you will need to remove the battery holder.

Start by soldering the stacking headers to the Huzzah and the supplied headers on the Featherwing OLED as documented in Adafruit's online guide for your hardware. Familiarise yourself with all the documentation.

Then connect to your PC via the USB cable and you should see the Huzzah fire up and show serial output @ 115200 baud. After selecting the correct board, you should be able to then load and run sample code from the Arduino IDE under File -> Examples to verify hardware functionality, such as Basics -> Blink or WiFi -> WiFiScan.

Next, we need to connect the MightyOhm Geiger to the Huzzah. You can use a breadboard to test your setup if desired or you can simply dive in and solder the required 3 wires between the Huzzah and the MightyOhm.

With the rear of the MightyOhm accessible, the first is the MightyOhm Geiger serial TX pin which is found on J7 pin 4 on the MightyOhm which is connected to GPIO 13 on the Huzzah ESP8266 and GPIO 27 on the Huzzah ESP32 via the bottom of the board. This is pin 6 on the top from left to right ( from the front! ) on both Huzzah versions and is the white wire shown below.

Secondly, connect the Huzzah's 3.3v and GND pins to the MightyOhm's battery connections which are the red and black wires below..... Adafruit's pinout images can be found online.

Wiring the ESP32 into the MightyOhm Geiger counterWiring the ESP32 into the MightyOhm Geiger counter

 

You will notice in the above photo I have removed the stacking header pins on the bottom of the Huzzah but have not cut off the 1 pin for the VBUS/USB connection. I have bent it at a right angle so I can connect a 5v supply to power the Feather Huzzah (and charge the Li-Po battery).

Note that when the Huzzah is mounted in the MightyOhm, access is lost to the onboard USB serial connection so you will need to upload the software mentioned below before final assembly. Once the software is loaded, you can use the ESP32 OTA WiFi update feature if required when the Huzzah is mounted in its final position in the MightyOhm Geiger for upgrades.

After verifying the software below and the hardware is functional by connecting the Li-Po battery and checking operation, only then apply the double-sided tape and secure the Feather Huzzah to the MightyOhm AAA battery space, and the Li-Po battery to the rear side of the MightyOhm.

 

Software

Tested on Arduino IDE 1.8.19/2.0.0rc9.1 and ESP8266 Boards 3.0.2/ESP32 2.0.4 Arduino with Ubuntu Linux desktop 20.04 with both the Feather Huzzah ESP8266 and Feather Huzzah ESP32 v2.

Arduino software for ESP8266 and ESP32 versions are available on this projects GitHub Repo (https://github.com/Whyzanet/WhyzaGC)

At the top of the sketch are the variables that will need changing for your specific environment. Register with radmon.org first so you have your required credentials.

Download the correct .ino sketch file for your hardware and check the list of libraries included in the sketch and ensure they are all installed.

The following libraries are available via the Arduino Library Manager and will need to be installed:

ESPSoftwareSerial, Tlog, NTPClient, Adafruit_GFX, Adafruit_SH110X, Adafruit Feather OLED, Adafrui NeoPixel (ESP32), Uptime Library, CircularBuffer.

The following libraries will need to be downloaded to your library directory:

movingAvg: https://github.com/JChristensen/movingAvg 

Syslog: https://github.com/arcao/Syslog 

ESP8266mDNS (for ESP8266): https://github.com/LaborEtArs/ESP8266mDNS 

The code in essence reads the serial data from the MightyOhm using SoftwareSerial via a GPIO pin, displays this data in various ways on the OLED, and uses movingAvg to average the Count per Minute (CPM)over 1 minute and subsequently upload the result to radmon.org via an HTTP client GET.

The histogram graph utilises the circularBuffer library which made the graphing relatively easy.

There are a number of networking functions that leverage libraries, check out the documentation for more info (mDNS, Web server, NTP client, serial to telnet/HTTP, unix syslog, OTA upgrades).

The code is broken up into individual functions so if you want to see how one of the functions work it should be straightforward.

Below is a list and use of the main functions:

  • wifion - Activate WiFi, setup Web server, OTA upgrades and NTP client
  • wifioff - deactivate WiFi and radmon updates
  • serialmon - Monitor the MightyOhm serial connection for disconnects longer than 15 seconds
  • grab - Read the MightyOhm serial data via SoftwareSerial GPIO RX pin
  • process - Check for valid MightyOhm EOL serial data, flash the heartbeat LED, extract the required data for variables, averages and histogram display.
  • grabgraphdata - Grab current data for histogram circularBuffer
  • averagedata - average CPM data for radmon update
  • radmon - Once per minute flash the NeoPixel purple ( ESP32), perform the HTTP Get with radmon.org, flash the NeoPixel ( ESP32 ) red or green on the result.
  • handleRootPath - configure the web diagnostics on the HTTP server
  • logstats - send Unix syslog messages each hour
  • buttons and buttonX - Check for button input and call the correct buttonX function to display outputs and WiFi toggle.
  • runntp - Update NTP time at update interval

Upload the sketch and see if there are any missing libraries you  need to fix.

Once the sketch is compiled and uploaded, input is via 5 Featherwing button combinations. Button A, Button B, Button C, Button A + B (default startup mode) and finally Button B + C to disable and enable WiFi. See photos below of different display outputs. I found the Featherwing OLED buttons small enough and close enough to be able to use multiple button presses easily with my thumb (A&B and B&C for a total of 5)

 

Default screen a running CPM graph activate with buttons a and bDefault screen a running CPM graph activate with buttons a and b

Default bootup/Button A & B display

 

Button A screen showing wifi details and geiger counter outputButton A screen showing wifi details and geiger counter output

Button A display

 

Button B display CPS and CPM valuesButton B display CPS and CPM values

Button B display

 

Button C displaying large graph and valuesButton C displaying large graph and values

Button C display

 

USB serial port is set to 115200 baud and will display the MightyOhm Gieger serial output ( when accessible )

HTTP diagnostic data is available on port 80 via URL: http://whyzagc-esp.local

Monitor easily via the following linux terminal command.

watch -n 10 curl -s whyzagc-esp.local

To monitor the MightyOhm serial data remotely use: http://whyzagc-esp.local:81 

and in your favorite telnet program

telnet whyzagc-esp.local

Blue Heartbeat LED/Neopixel is triggered by an EOL from the Gieger serial output. Should flash 1 per second as a result. If Geiger serial EOL data is not detected, the heartbeat will stop.

Feather Huzzah ESP32 v2 Neopixel will flash purple every 60 secs when starting the radmon.org update and then will flash green when having completed a successful update, or red when aborting an unsuccessful update.

OTA upgrading of compiled sketch .bin via WiFi using the following URL: http://whyzagc-esp.local/upload 

To locate the correct binary for upload, within the Arduino IDE interface select Sketch -> Export Compiled Binary, which will drop the compiled binary into the same location as the ino sketch file.

WiFi software updates, HTTP server diagnostics, and MightyOhm serial port redirection over telnet/HTTP solve the issue of the USB serial port being inaccessible when the Huzzah is mounted in the MightyOhm's original battery location, preventing USB serial port upgrades, diagnostic monitoring, and raw MightyOhm serial port data access.

You can Enable/Disable WiFi through buttons B&C for portable/low power use. WiFi disable will also disable radmon.org updates and will require a reset to enable radmon.org uploads if startup behavior is enabled. As such if you toggle WiFi off and back on, you will have WiFi connectivity but radmon updates are disabled until the next reset….useful for testing as per below.

 

Testing

Vaseline glass contains uranium which makes it a useful item for background level radiation testing. Other options are volcanic rock, granite benchtops, some types of FiestaWare, or chunks of uranium... 


The piece of Vaseline glass I have will cause a count of around 135 CPM when up close to the detector tube which is a bit more than the average background levels of around 18 CPM with the SBM20 detector tube.


The SBM20 detects limited range high energy beta particle radiation and penetrating long-range gamma electromagnetic radiation, but not short-range alpha particle radiation which is stopped by the tube's metallic outer composition, which is fine as you don’t want to be playing with hazardous alpha radiation sources anyway (e.g. a smoke alarm’s Americium-241).  

The Vaseline glass’s radiation is mostly stopped by aluminum, which fits the definition of being mostly beta radiation. 


In addition to (and independently of) emitting radiation, Vaseline glass/uranium also glows a fluorescent bright green under UV light.


I also have a ‘nanotechnology, ionizing anti-EMF’ volcanic pendant necklace which gives a count of over 70 CPM, about 3.5 mSieverts/year. Its glossy product documentation has a long list of varied health benefits (including fighting cancer cells) if worn on the skin due to its ‘scalar energy.


An airplane flight would also be an interesting test environment due to increased cosmic (though less terrestrial) radiation levels at altitude. Latitude also affects background cosmic radiation with higher levels the closer you are to the poles. Calculator available at https://jag.cami.jccbi.gov/ 

Uranium glass used for testingUranium glass used for testing
Uranium Glass glowing under UV lightUranium Glass glowing under UV light

ESP8266/ESP32/OLED specific settings

Other than the expected differences in libraries for the ESP8266 & ESP32 retrospectively (ESP8266WiFi.h vs WiFi.h, ESP8266WebServer.h vs WebServer.h and ESP8266mDNS vs ESPmDNS), the 2nd LED differences (Blue LED vs Neopixel RGB LED) and pinout changes, the Feather Huzzah ESP32 CPU is also dual core.

As such in the ESP32 code, I have set the radmon.org update function to utilise CPU0 rather than CPU1 which all other code runs on by default.

This solves an issue on the ESP8266 platform due to it's single CPU. While performing the TCP connection setup and get request for the radmon.org update, the CPU is unavailable for other tasks. Since the typical TCP setup, data exchange and teardown takes at least 1.5 seconds in my environment (and up to 4+ secs), it means that the ESP8266 will miss at least 1 line of serial data from the MightyOhm. Simply put, it will miss one line of data for every second that the upload takes. This is not really a big issue as the code is reading the MightyOhm CPM  value which is averaged and uploading the resulting 1-minute rolling average CPM value that the Arduino calculates. So the impact of missing a couple of average values is negligible overall. It explains why the code is measuring the upload time and showing it in the web diagnostics. I did try schedulers and yield() without success on the ESP8266.....

This is not a problem on the ESP32 where the radmon.org function (and the functions it calls) is pinned to CPU0 while the default CPU1 is free to carry out other tasks such as not missing the grabbing of the next line of serial data from the MightyOhm ;)

The other consideration is that I can confirm that OLED screen burn-in does occur with the default contrast and use over 1000 hours as noted on the Adafruit site, resulting in a contrast deviation as the datasheet explains it. As such I have now set the contrast to a minimum to preserve the screen. This setting is near the top of the .ino file if you desire to change it. A screen with contrast deviation from burn-in will always be not as bright (or white as in this case) as a new screen, with the same settings. The color temperature is different and the whole screen is affected. You can increase the contrast of a burnt screen to somewhat compensate, but this may make the problem worse depending on your setting and will not change the color temperature.

Additional Connections


I am connecting the VBUS/USB pin on the Huzzah to a Raspberry Pi 5V pin via the Pi GPIO header (any 5v supply will suffice), as well as a ground connection between the two boards. Current is usually around 110 mA, though will peak around 300 mA when charging the Li-Po battery.

I am also connecting the Gieger serial TX pin (J7 pin 4) to the Raspberry Pi 4's additional serial Rx pins on UART 4 and 5 (the default serial port is already in use) by setting dtoverlay=uart4 and dtoverlay=uart5 in the Pi's /boot/config.txt file and then connecting the Gieger serial Tx pin to both pins 33 and 21. These additional serial ports are found under /dev/ttyAMA1 and /dev/ttyAMA2 under Raspberry Pi OS Bullseye. On one port I have configured a bash script to perform radmon.org updates for use if I don't want to upload from the Feather Huzzah for whatever reason. The other port is used by a Perl script that displays graphs using rrdtool.

See this link for the Perl script. Read the whole page before starting. https://mightyohm.com/forum/viewtopic.php?t=3504 

Finally, I also have the MightyOhm pulse pin (J6 pin 2) connected to pin 35 on the Pi 4 so that a bash script can look for a rising edge on GPIO 19. I use this to log occurrences of high CPSs for when I need to reconfirm the randomness of the universe.

MightyOhm with connections to Raspberry Pi is pictured on the right. Red is 5V supply, Orange is serial TX, Yellow is pulse, and brown is GND

Wiring the Pi into the Geiger counterWiring the Pi into the Geiger counter
The wires plugged into the Geiger counter from the PiThe wires plugged into the Geiger counter from the Pi

Radmon Data

Serial output from the ESP32Serial output from the ESP32
Output graph from the WhyzaGCOutput graph from the WhyzaGC
CPM output graph from WhyzaGCCPM output graph from WhyzaGC

Code, and the latest version

Check out Ross' WhyzaGC Repo for the latest updates on this project:

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.