- Posted on
- • Geiger Counters
Hacking the Gamma Scout Alert to Work with Radmon.org
- Author
-
-
- User
- Mr Blinky
- Posts by this author
- Posts by this author
-
Archived from radmon.org - originally posted 28/01/2023
A member (of radmon.org) asked me if the Gamma Scout would/could work with radmon.org using the USB and software the counter came with. The answer to that is a simple, no, but it could be down with a quick hack. Simply add a couple of wires and connect them straight to an ESP8266 or similar MCU. This guide only covers the 'Alert' model. There may be differences with other Gamma Scout models. Here is how:
Open up the Gamma Scout and locate the small transistor at the top left of the board, right above the pin header. There we are going to solder on a wire to the middle pin on the transistor and also a ground connection. I chose one that is close and one end of a small resistor close to the transistor is connected to ground, but any ground on the board will do. Don't connect to the GM tube negative as this is not the same as the logic ground. See fig.1 and fig.2.
↑ Fig.1 Locate the transistor at the top left of the board. ↑
↑ Fig.2 Locate the actual connections where we will be soldering the wires to. ↑
Being very careful solder two thin wires onto the connections (fig.3) and make a mental note of which wire is connected to the pulse and which is the ground. I have a small length of twin cable with a handy inline connector in my junk drawer so I'm going to use that so I can easily disconnect the MCU when I'm not using it.
↑ Fig.3 Solder wires onto the two points on the circuit board we identified earlier. The wire I used has a crappy outer sheath as liked to melt easy. Be careful you don't short anything out. ↑
Once the wires are soldered in place add some hot glue over the connections to act as a relief for the solder joints then reassemble the Gamma Scout as we are finished with that part. Next it is time to connect the wires to the ESP8266 (Wemos D1 Mini clone). Connect the ground from the Gamma Scout to the ground on the ESP8266 and then connect the pulse wire to pin GPIO 13 (D7 on the Wemos) as shown in fig.4.
↑ Fig.4 connect the wires (pulse and ground) from the Gamma Scout to the ESP8266 ↑
Then finally, connect the ESP8266 to your computer's USB and load up the arduino sketch attached below. The sketch is basically my bare bones Wemos D1 Mini sketch with a couple of small changes to enable the pulse to be read from the Gamma Scout properly. Opening the serial terminal you should see the ESP8266 is getting events and starting to count.
The Arduino code (worked at the time of writing, but library updates may cause issues):
/*
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ArduinoBB Wemos Butterfly 1.0 |
| Bare-bones Arduino counter for Geiger counter and submission to Radmon.org written by Simomax. |
| This code was taken from a working project with all of the other code chopped out to give very basic Radmon.org CPM submission. |
| This is very basic code. It will detect pulses on GPIO 13 (pin D7 on Wemos D1 Mini) and calculate the CPM every second. It will then submit the CPM to Radmon.org every 60 seconds. |
| It has a debug option and also option to print the CPM to serial every second, much like the NetIO- GC-10, which can also be used with the Radlog windows software. |
| |
| You are free to do anything you want with this code. There is no license. You are allowed to use/copy/change/share the code without having to attribute myself, |
| although it would be appreciated if you did. You are also free to use this in any commercial setting. |
| Radmon.org is free and always has been and in that sentiment, so is this code, as is all of my code that I share on the Radmon.org forums unless specifically stated. |
| If you would like to give something back then please consider a small donation to Radmon.org (which I ahve no affiliation with whatsoever, ecxept from being a user and contributor |
| to the forums) or even better, become a regular user of the Radmon.org forums. It has become a little quiet of late and some new users to the forum would be welcomed, by everyone I am sure. |
| |
| This code comes without warranty or support. I am happy to answer questions in the Radmon forums, but try and keep it within the code. I may not be able to help with your own code outside my own. |
| If it breaks you get to keep all the pieces! |
| |
| Have fun and happy counting! |
| ~Simonmax |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*/
#include <ESP8266WiFi.h>
WiFiClient client; // Use WiFiClient class to create TCP connections
// Your WiFi Network SSID and Password.
#define WIFI_SSID "Your_WiFi_SSID"
#define WIFI_PASS "Your_WiFi_Password"
// Your Radmon.org username and submission password.
const char* RadmonHost = "radmon.org"; // No need to change this
const char* UserName = "radmon_username"; //Your Radmon.org user name
const char* PassWord = "radmon_submission_password"; //Your Radmon.org submission password - Make sure this is the same as your 'data sending password' on your Radmon.org profile page.
// Debug - True prints information to serial.
int debug = true;
// Option to enable CPM to be printed to serial - When enables this emulates the NetIO GC-10 serial output
int printCPM = false;
// Variables used - You shouldn't need to change anything below this line unless customizing. --------------------------------------------------------------------------------
long CPM;
volatile unsigned long totalCounts = 0; // Total counts - May be useful, but for now is only printed when debug enabled.
int cpsCount = 0; // Used for calculating CPM. This var counts the amount of interrupt events in one second.
int cpmArray[60]; // Array used for storing CPS over 60 seconds. Each index equals the CPS over a given second.
int cpmArrayStep = 0; // Used for stepping the index of above array when calculating CPM.
static uint32_t cpsTime=millis(); // Used for the 1 second timer. We count millis in the loop as using a delay would impact other functions and delays should generally not be used.
static uint32_t cpmTime=millis(); // And another for the 60 second timer for Radmon.org submission.
int cpmMillis = 1000; // How often to calculate CPM (1000ms = 1 second.)
int radmonMillis = 60000; // How often to submit to Radmon.org (60000ms = 60 seconds.) Please don't set this to less than 60000 as recommended minimum submission time for Radmon.org is 60 seconds.
int lastConnectionAttempt = millis();
int connectionDelay = 5000; // Try to reconnect WiFi every 5 seconds if connection lost.
void setup()
{
Serial.begin(9600); // Set serial baud rate to 9600.
delay(500);
pinMode(LED_BUILTIN, OUTPUT); // Setup (internal) LED pin.
digitalWrite(LED_BUILTIN, HIGH); // Turn the internal LED off - The internal LED on the Wemos D1 Mini uses reversed logic, so HIGH is off and LOW is on.
pinMode(13, INPUT); // Set pin GPIO 13 (D7 on Wemos D1 Mini) as input and enable internal pullup.
WiFi.mode(WIFI_STA); //Set WiFi mode
attachInterrupt(13, GetEvent, RISING); // Attach interrupt on GPIO 13.
if (debug) {
Serial.println("Running!!!!\r\n"); // ------------------------------------------------------------------------------------------------
}
}
void updateRadmon() { // Send CPM to Radmon.org.
if (debug) {
Serial.println("\r\nUpdating Radmon...");
}
WiFiClient clientGet; // Set as client.
const int httpGetPort = 80;
String urlGet = "/radmon-dev.php"; // Build the URL for Radmon.org CPM submission.
urlGet += "?function=submit&user=";
urlGet += UserName;
urlGet += "&password=";
urlGet += PassWord;
urlGet += "&value=";
urlGet += int(CPM);
urlGet += "&unit=CPM";
if (debug) {
Serial.print(">>> Connecting to host: ");
Serial.println(RadmonHost);
}
if (!clientGet.connect(RadmonHost, httpGetPort)) { // Try and connect to Radmon.org.
if (debug) { // Connection failed!.
Serial.print("Connection failed: ");
Serial.println(RadmonHost);
}
} else { // Connected - Success!
if (debug) {
Serial.println("Sending data....");
}
clientGet.println("GET " + urlGet + " HTTP/1.1"); // Send the datary goodness to Radmon.org.
if (debug) {
Serial.println("GET " + urlGet + " HTTP/1.1");
}
clientGet.print("Host: ");
clientGet.println(RadmonHost);
if (debug) {
Serial.println("Host: " + String(RadmonHost));
}
clientGet.println("User-Agent: ArduinoBB Wemos Butterfly 1.0");
if (debug) {
Serial.println("User-Agent: ArduinoBB Wemos Butterfly 1.0");
}
clientGet.println("Connection: close\r\n\r\n");
if (debug) {
Serial.println("Connection: close\r\n\r\n");
}
unsigned long timeoutP = millis(); // We check the connection time. If longer than 10 seconds then stop the connection and exit the function - timeout.
while (clientGet.available() == 0) {
if (millis() - timeoutP > 10000) {
if (debug) {
Serial.print(">>> Client Timeout: ");
Serial.println(RadmonHost);
}
clientGet.stop();
return;
}
}
if (debug) {
Serial.println("End of sending data....\r\n\r\nResponse:"); // We didn't timeout so lets wait for a response from Radmon.org.
}
while (clientGet.available()) { // We got a response so just check the 1st line of the server response. Could be expanded if needed.
String retLine = clientGet.readStringUntil('\r');
if (debug) {
Serial.println(retLine);
}
break;
}
} // End client connection as we are done.
if (debug) {
Serial.print(">>> Closing host: ");
Serial.println(RadmonHost);
}
clientGet.stop();
}
void calculateCPM() // Calculate the CPM.
{
if (debug) {
Serial.print("Calculating CPM: ");
}
cpmArray[cpmArrayStep] = cpsCount; // Set the index in the CPM array to that of the current CPS. The index initially starts at 0 when powered on.
cpmArrayStep++; // The next index we want to record.
if (cpmArrayStep >= 60) // There are 60 indexes, one for every second in a minute. If the index goes out of the bounds of our 60 indexes then cycle back to index 0.
{
cpmArrayStep = 0;
}
CPM = 0; // Var used to temporarily calculate CPM.
unsigned int i;
for (i = 0; i < 60; i++) // Get the value at each index of the CPM array.
{
CPM += cpmArray[i]; // Add each index together to give a total over 60 seconds.
}
cpsCount = 0; // Reset the CPS variable ready for sampling the next second.
if (printCPM) {
Serial.println(CPM); // Print the current CPM to serial every interval if enabled - Much like the NetIO GC-10.
}
else if (debug) {
Serial.println(CPM);
}
}
ICACHE_RAM_ATTR void GetEvent() { // ISR triggered for each new event (count).
if (debug) {
Serial.println("<< Got Event >>");
}
totalCounts ++; // Increase total counts each time the interrupt is fired.
cpsCount ++; // Increase var each time the interrupt is fired.
digitalWrite(LED_BUILTIN, LOW); // flash LED as quickly as possible.
delayMicroseconds(50);
digitalWrite(LED_BUILTIN, HIGH);
}
void loop()
{
if ( (millis()-cpsTime) >= cpmMillis) { // Check our 1 second interval.
cpsTime = millis();
calculateCPM(); // 1 Second has surpassed so we calculate our CPM.
}
if ( (millis()-cpmTime) >= radmonMillis) { // Check our 60 second interval.
cpmTime = millis();
updateRadmon(); // 60 Seconds has surpassed so we submit the CPM to Radmon.org.
}
if (WiFi.status() != WL_CONNECTED) // check WiFi connection:
{
// (optional) "offline" part of code - you can add code here to signal when WiFi is disconnected, such as lighting an LED.
if (millis() - lastConnectionAttempt >= connectionDelay)
{
lastConnectionAttempt = millis();
if (WIFI_PASS && strlen(WIFI_PASS)) // attempt to connect to Wifi network:
{
WiFi.begin((char*)WIFI_SSID, (char*)WIFI_PASS);
}
else
{
WiFi.begin((char*)WIFI_SSID);
}
}
}
else
{
// We are connected - you can add code here to signal when WiFi is connected, such as lighting an LED.
}
}
As I used an in-line connector on my Gamma Scout, when I am finished using it with the ESP8266 I can simply unplug it, place the wire and connector inside the Gamma Scout and pop the lid back on. And then it looks like nothing has been modified on the counter.


The Gamma Scout gives a really nice ~3.6v (same as the lithium battery?) rising pulse over about 150us. Here is waveform from when I was probing about:
Happy hacking! 😉