ESP32 Logging Geiger Counter
Ever wondered how much radiation is around your house? Interested to see how much it changes over time? (e.g. as the recently released Fukushima Daiichi water makes it way to your shores, or in the event WWIII breaks out, etc)
This project is for you! ... and everyone else too, if (like me) you put your results online.
Background...
Years ago, I bought a "dumb" geiger counter. Every now and then the radiation alarm sounds, which annoys me since by the time I get to the screen to see what the reading was - it's gone. I suspect someone/something sketchy drives past my house from time to time!!
By weird coincidence, it also went off (and kept going) one time when I was at a farm. We used it to walk around to find out where the radiation was coming from - turned out it was a box in the back of a farm truck, which was broken. Inside that box was a soil moisture instrument - and sure enough - it had radiation warnings on it. That's how scientists measure crop soil moisture it turns out. The farmer fixed the broken (lead lined) box after we told him! So - long story short - I know my geiger counter works properly.
Today, my second one turned up, so I can record this stuff properly from now on. I'm sharing "how" as well, so you can too!
Supplies
Things you need:
- An ESP32 or similar - I used a "WROOM32" version - one of these https://www.aliexpress.com/item/32816065152.html
- A geiger counter with a TX output pin - I used this: https://www.aliexpress.com/item/1005004019027282.html
- Some wire to join the above, and a soldering iron to connect it.
(note: I am not affiliated with any of the above)
Setup a Free Online Data Logging Account
Follow these steps to set up a free online data-logging and charting endpoint:-
- Visit https://iotplotter.com/
- Sign up for a new account and verify your email address.
- Click "Create New Feed" (preferably public if you con) and give it a name (e.g. "Nuclear Radiation counts in (your city) (your country)"
- Optionally enter a description (e.g. "This is the output from a Geiger Counter measuring radiation particles. It counts them, and every 1 minute uploads the count. See https://github.com/gitcnd/ESP32_Logging_Geiger_Counter ")
- Record your API key inside the file ESP32_Logging_Geiger_Counter.ino (see next step) in the line:-
#define IOT_API_ID "put your ID here"
- Click "Manage Feed" and then "Keys" and record your API key inside the file ESP32_Logging_Geiger_Counter.ino (see next step) in the line:-
#define IOT_APIKEY "put your key here"
Programming the ESP32
Programming: (do this before soldering anything - because your ESP32 or PC might not have enough power to drive the Geiger as well once it is connected later)
If this is your first time programming ESP32 - follow one of these guides to set up your Arduino IDE and ESP32 add-ons:
- Windows instructions – Installing the ESP32 Board in Arduino IDE
- Mac and Linux instructions – Installing the ESP32 Board in Arduino IDE
Next:-
- Get the source code from GitHub here: https://github.com/gitcnd/ESP32_Logging_Geiger_Counter
- Using your Arduino program (downloaded from https://arduino.cc/ as per above guides) open and look at the start of the file "ESP32_Logging_Geiger_Counter.ino"
- Follow the instructions at the start of this file to type in your free online logging API ID and Key (from above step), WIFI SSID and Password.
- Connect your ESP32 to your PC and click the "Upload" button.
The above upload also includes an "OTA" feature - so you can re-program your ESP32 anytime in future without needing to connect it to your PC ever again.
5. Disconnect your ESP32 from your computer.
Wiring the ESP32 Up to the Geiger Counter
Wiring:
- Solder "5V" from the Geiger to "VCC" on the ESP32
- Solder GND from the Geiger to GND on the ESP32
- Solder "TX1" from the Geiger to GPIO16 (probably labelled IO16 or similar - check your ESP32 Board pin diagram to be sure)
Power on and test!!
The ESP32 LED (blue usually) should blink approximately once per second, which indicates it is alive. After about 1 minute, check your iotplotter.com web page to see your data being collected.
Re-Programming and Adding New Features
If you want to add more features (e.g. log weather or traffic or anything else* ) or change anything, you do not have to plug your ESP32 into your PC again - simply select its network port from your Arduino menu "Tools" -> "Port" -> "Network Port" - see screenshot for example.
If you do not see any network ports - exit Arduino, double-check your PC is on the same WiFi as your ESP32, and re-start Arduino.
* An exercise for the reader: try logging hallRead() perhaps? (all ESP32's have inbuilt hall sensors...)