ESPGeiger
- ChrisLX200
-
- Away
- Premium Member
-
Less
More
- Posts: 152
- Thank you received: 8
1 week 6 days ago #7312
by ChrisLX200
Replied by ChrisLX200 on topic ESPGeiger
I need to check voltages on these Cajoe boards, I noticed current draw varied from ~150mA up to ~300mA between the three.
Please Log in or Create an account to join the conversation.
1 week 5 days ago #7314
by Simomax
Ahh, I think you may have hit the nail on the head - not all ESP32's (or ESP8266's) are equal, as I have found out in the past. I generally stick to ESP32 Dev Kits v3/v4 (dev boards) and Wemos D1 Mini's or clones thereof. I have had a handful of different ESP modules over the years with little to no joy getting them to work easily, as in straight out of the box. As you are using a Meshtastic (I think) type of module, this may use a slightly different flavour of ESP32. In fact, looking at the metal can on yours the text is a little different. I generally use the ESP32-WROOM-32D ESP32's and ZY8266MOD ESP8266's, and since sticking to those two specific flavours, which seem to come on nearly all dev boards, I have hardly had any issues. You will be able to get others working, but will probably require specific settings for the memory/speeds/DIO mode (I forget what that is, but fell over it once!) etc. So it's just a matter of getting all of your ducks in a line and then it should work. For ease of use I just stick with the two I have been using.
Under the metal can on an ESP32/ESP8266 there is more than just the main MCU. You can see in the picture (of one I blew up earlier ) there is also an 8-pin SOP, which I think may be the EEPROM. Some have different memory capacities and there may be other differences. Putting it all together there could be 4,5 maybe 6 settings that all need to align with the actual MCU module you are using.
Under the metal can on an ESP32/ESP8266 there is more than just the main MCU. You can see in the picture (of one I blew up earlier ) there is also an 8-pin SOP, which I think may be the EEPROM. Some have different memory capacities and there may be other differences. Putting it all together there could be 4,5 maybe 6 settings that all need to align with the actual MCU module you are using.
If you mean some of my code, here, on this forum, then sure, go for it. I posted it purely for people to use. It is very basic, but is the nuts and bolts needed to upload to Radmon with that particular device (at the time of writing I should add - The IDE changes, and so do libraries and other bits, so may or may not work now or in the future.)I would like to steal some of your Arduino code for uploading data to Radmon are you OK with that?
That's one hell of a difference! ~20ma maybe, but ~150ma? Is that including your ESP32, or just the CAJOE boards? It is always worth checking the voltage at the tube, if you have facilities to do so. Something I have been meaning to do with the CAJOE, which you may be in a better place to do having three of them, is see if they are sensitive to temperature changes. I suspect they are, and I suspect the change could be quite dramatic. I'd like to see the difference between room temp and say 50 degrees C (oven on lowest) and also room temp and say, 5 degrees C (refrigerator). I think there could a quite a variance between 5 degrees and 50. As you have a few boards it would be good to see if the different boards vary differently, which I suspect they might also. If you can't do this, or just don't want to let me know and I can perform the tests, but I only have one spare CAJOE as my other one is in situ and running.I need to check voltages on these Cajoe boards, I noticed current draw varied from ~150mA up to ~300mA between the three.
Attachments:
Please Log in or Create an account to join the conversation.
- ChrisLX200
-
- Away
- Premium Member
-
Less
More
- Posts: 152
- Thank you received: 8
1 week 5 days ago - 1 week 5 days ago #7315
by ChrisLX200
Replied by ChrisLX200 on topic ESPGeiger
After two 4am coding sessions trying to get my head around Platformio I can say I'm only slightly wiser and nowhere near capable of resolving the issues I'm having with the V.7 ESPGeiger. My AI assistant is thick as a brick at times and although invaluable gives me some BS code snippets to try! Anyway, the problem is Steadramon's implementation of the WiFiManager library, I know the basic method works because I have it functional in my paltry Arduino code effort*. It creates the Access Point and I can configure WiFi access without using hard-coded credentials. It's such a pity I can't get ESPGeiger working because it's exactly what I need and so much effort has already been put into its development that is wasted if it can't be fixed. And yes, I tried an earlier 6.nn version but encountered the same issue, I'm not sure how far I need to go back to find a version that may possibly work.I will continue with my Arduino project for now, thanks for your code which is much better than mine! However I'm a bit wary of uploading garbage to Radmon in the process of development, but I will need something functional so we can see long term trends.The differences between the myriad ESP32 boards should not be a problem for ESPGeiger (IMHO) as they only involve what extra features are implemented on the development board and the core CPU/speed/memory capacity, the basic functions are the same. I have 3 different dev kits at the moment (with a 4th on the way!) which are all basic ESP32-WROOM-32 v1/S2 boards, two with OLEDs and one without. The OLEDs are I2C but a TFT version is SPI. ESPGeiger is designed to work with/without onboard OLED display. However ESPGeiger never gets further than trying to connect to WiFi which is a very basic function it runs early so any other differences are probably irrelevant at this point - and like I said, WiFiManager definitely works with the boards I have if it's coded right.Yes I do have a high voltage probe with which I can measure voltage at the tube without loading it down. I haven't done that yet though. It's something I need to do to ensure all three counters are as near balanced as I can make them. The current draw is a puzzle, it is measured as the current consumption with both ESP32 and board running together. One board's 'clicks' are noticeably at a very different pitch than the other two but all three are are actually different from each other. Might be just the cheap Piezos they use. I think temperature does affect all GM tubes to some extent, like it does with scintillators, and it would an interesting experiment when/if I get all 3 working in harmony
. Another thought between different manufacturers of these tubes is what gas mixture is used inside, I doubt they're all the same. That's why I bought all 3 from the same source as they should be similar in most respects - but probably not representative of the wide range currently out there. The J305b are made in different factories and I would bet money they don't talk to each other or stick to some specification (I don't think there is one!). If it makes a click that's good enough. SBM20s on the other hand were probably all made to an accurate spec and are more consistant and dependable.
Edit: *also added a push button to pin 14 - same as ESPGeiger - but in my case it provides On Demand creation of new WiFi credentials via WiFiManager. At any time push the button to start the access point to enter new credentials, otherwise it uses those stored in flash.

Edit: *also added a push button to pin 14 - same as ESPGeiger - but in my case it provides On Demand creation of new WiFi credentials via WiFiManager. At any time push the button to start the access point to enter new credentials, otherwise it uses those stored in flash.
#define VERSION "V1.5.0"
#include <WiFiManager.h>
#include <WiFi.h>
#include <SSD1306.h>
#include <esp_task_wdt.h>
#define GEIGER_INPUT_PIN 13
#define BUTTON_PIN 14
#define CONVERSION_FACTOR 154.0
#define PERIOD_LOG 15
#define CONFIG_PORTAL_TIMEOUT 120
#define WDT_TIMEOUT_MS 10000
int counts = 0;
int cpm = 0;
float usv = 0.0;
unsigned long lastCountTime, startCountTime;
SSD1306 display(0x3c, 5, 4);
void IRAM_ATTR ISR_impulse() {
counts++;
}
// ========== OLED ==========
void displayInit() {
display.init();
display.flipScreenVertically();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_10);
display.drawString(0, 0, "Radiation Monitor");
display.display();
}
void showStatus(const String &line1, const String &line2 = "") {
display.clear();
display.setFont(ArialMT_Plain_10);
display.drawString(0, 20, line1);
display.drawString(0, 34, line2);
display.display();
}
void showReadings(int cpm, float usv) {
display.clear();
display.setFont(ArialMT_Plain_10);
display.drawString(0, 0, "Radiation Monitor");
display.setFont(ArialMT_Plain_16);
display.drawString(0, 18, "CPM: " + String(cpm));
display.drawString(0, 40, "uSv/h: " + String(usv, 2));
display.display();
}
// ========== WIFI SETUP ==========
void connectWiFi() {
WiFi.mode(WIFI_STA);
WiFi.begin();
showStatus("Connecting to WiFi...");
Serial.println("Connecting to saved WiFi...");
unsigned long start = millis();
while (WiFi.status() != WL_CONNECTED && millis() - start < 15000) {
delay(250);
Serial.print(".");
}
if (WiFi.status() == WL_CONNECTED) {
Serial.print("\nConnected! IP: ");
Serial.println(WiFi.localIP());
showStatus("WiFi Connected", WiFi.localIP().toString());
delay(1000);
} else {
Serial.println("\nWiFi not connected.");
showStatus("WiFi not set.", "Press button to config");
}
}
void launchConfigPortal() {
Serial.println("Launching WiFi config portal...");
WiFiManager wm;
wm.setConfigPortalTimeout(CONFIG_PORTAL_TIMEOUT);
wm.resetSettings(); // ? Clear previous credentials!
showStatus("Starting WiFi", "Config Portal...");
esp_task_wdt_deinit(); // Disable watchdog during portal
if (!wm.startConfigPortal("ESPGeiger")) {
Serial.println("WiFiManager timeout. Restarting...");
showStatus("Config Timeout", "Rebooting...");
delay(2000);
ESP.restart();
}
Serial.println("WiFi credentials saved.");
showStatus("WiFi Config", "Rebooting...");
delay(2000);
ESP.restart();
}
// ========== SETUP ==========
void setup() {
Serial.begin(115200);
Serial.println("Starting Geiger Counter " VERSION);
pinMode(GEIGER_INPUT_PIN, INPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP);
displayInit();
connectWiFi();
// Only attach interrupts if WiFi is working
if (WiFi.status() == WL_CONNECTED) {
attachInterrupt(digitalPinToInterrupt(GEIGER_INPUT_PIN), ISR_impulse, FALLING);
startCountTime = lastCountTime = millis();
esp_task_wdt_config_t wdt_config = {
.timeout_ms = WDT_TIMEOUT_MS,
.idle_core_mask = (1 << portNUM_PROCESSORS) - 1,
.trigger_panic = true
};
esp_task_wdt_init(&wdt_config);
esp_task_wdt_add(NULL);
}
}
// ========== LOOP ==========
void loop() {
// On-demand config: press button any time
if (digitalRead(BUTTON_PIN) == LOW) {
delay(50); // Debounce
if (digitalRead(BUTTON_PIN) == LOW) {
Serial.println("WiFi config button pressed.");
launchConfigPortal();
}
}
// Only run main logic if WiFi is working
if (WiFi.status() == WL_CONNECTED) {
esp_task_wdt_reset();
if (millis() - lastCountTime > PERIOD_LOG * 1000) {
unsigned long now = millis();
cpm = (60000 * counts) / (now - startCountTime);
usv = (float)cpm / CONVERSION_FACTOR;
counts = 0;
startCountTime = now;
lastCountTime += PERIOD_LOG * 1000;
showReadings(cpm, usv);
Serial.print("CPM: ");
Serial.print(cpm);
Serial.print(" | uSv/h: ");
Serial.println(usv, 2);
}
}
delay(50);
}
Attachments:
Last edit: 1 week 5 days ago by ChrisLX200.
Please Log in or Create an account to join the conversation.
1 week 5 days ago - 1 week 5 days ago #7316
by Simomax
Mine does that too from time to time. I found out quite early on that it sucks at writing code. I asked it to make some of my code more efficient. It did so by completely removing chunks of code, removed functions and the references to them and handed back half of what I fed it, 'Here you go. The new code is more efficient now. Would you like me to make it more efficient, or do you have some more code for me to butcher?'
I've just realized, I don't have ESPGeiger running on an ESP32 at all. All of mine run on ESP8266s - Wemos D1 Mini clones. If all you are doing is connecting it to a counter to upload readings then you might want to consider those instead of the ESP32s. They are smaller, cheaper and more than capable of uploading readings/oled etc.
I'm quite dubious about the CAJOE counters. One of mine went faulty whilst in service, and the parts seem to be the cheapest of the cheap. I might throw one in the fridge and oven this weekend. See what happens. I agree about the J305's too. I found a seller on Aliexpress selling J305's in both 90mm and 107mm lengths. Vague data/specs and no datasheet. I received another new Chinese counter today - not a bad bit of kit either. I'll post about that soon. Anyway, that came with a J315γβ tube, that looks just like a J305. I can't find any data for that anywhere, and can't find it for sale anywhere either. It's quite strange. Also dated 2024, so not a brand new type either. It would certainly be interesting to get a few J305's from the same batch and perform some testing on them.
My AI assistant is thick as a brick at times
Mine does that too from time to time. I found out quite early on that it sucks at writing code. I asked it to make some of my code more efficient. It did so by completely removing chunks of code, removed functions and the references to them and handed back half of what I fed it, 'Here you go. The new code is more efficient now. Would you like me to make it more efficient, or do you have some more code for me to butcher?'
I've just realized, I don't have ESPGeiger running on an ESP32 at all. All of mine run on ESP8266s - Wemos D1 Mini clones. If all you are doing is connecting it to a counter to upload readings then you might want to consider those instead of the ESP32s. They are smaller, cheaper and more than capable of uploading readings/oled etc.
I'm quite dubious about the CAJOE counters. One of mine went faulty whilst in service, and the parts seem to be the cheapest of the cheap. I might throw one in the fridge and oven this weekend. See what happens. I agree about the J305's too. I found a seller on Aliexpress selling J305's in both 90mm and 107mm lengths. Vague data/specs and no datasheet. I received another new Chinese counter today - not a bad bit of kit either. I'll post about that soon. Anyway, that came with a J315γβ tube, that looks just like a J305. I can't find any data for that anywhere, and can't find it for sale anywhere either. It's quite strange. Also dated 2024, so not a brand new type either. It would certainly be interesting to get a few J305's from the same batch and perform some testing on them.
I'm curious why you have done this. The only usage case I can see would be if you ran different WiFi SSID's in one place and wanted to switch between them. If wifimanager can't connect to the stored SSID it will revert back to it's hotspot again, and you can reconfigure WiFi from there. I have done it with some devices already - set them up at home then taken them to another location and on boot they just sit with the hotspot.At any time push the button to start the access point to enter new credentials
Last edit: 1 week 5 days ago by Simomax.
Please Log in or Create an account to join the conversation.
- ChrisLX200
-
- Away
- Premium Member
-
Less
More
- Posts: 152
- Thank you received: 8
1 week 5 days ago #7317
by ChrisLX200
Replied by ChrisLX200 on topic ESPGeiger
There will be times when I want to quickly force it to run offline so a button seemed a good idea for that, and I didn't want my credentials hard-coded into the source either. The credentials are stored in flash so yes, I don't have to press the button each time it boots unless I change SSIDs. The button is also there in ESPGeiger and after reading the setup notes on Steadramons's website I see that if you hold it down (on pin 14) during boot it bypasses the WiFi setup. That's something I have not actually tried but will ASAP because it might just get me past the failure loop I get at startup. Doesn't solve any problems but I would like to see it running.
Also on that website I see Wemos D1Mini is recommended, they're cheap like you say but I bought the ESP32s+OLED for the same price and it seemed like a good 'upgrade' lol! The ESP32 dev boards are also easier to mount. Whatever, I'm getting quite a collection of ESP boards now so I'll order a few of the D1 minis to add to it.
You probably noticed I'm more of a hardware person than a coder
, I've been a model engineer for many years and have a capable workshop. I've actually added 3 interface buttons to the Cajoe/ESP32 cases now. The other two will likely be used for switching display screens but right now two of them are redundant. It was just easier to do it while I had them apart, just pop them in the laser cutter and it cuts out the little square holes for the switches.
Also on that website I see Wemos D1Mini is recommended, they're cheap like you say but I bought the ESP32s+OLED for the same price and it seemed like a good 'upgrade' lol! The ESP32 dev boards are also easier to mount. Whatever, I'm getting quite a collection of ESP boards now so I'll order a few of the D1 minis to add to it.
You probably noticed I'm more of a hardware person than a coder

Attachments:
Please Log in or Create an account to join the conversation.
- ChrisLX200
-
- Away
- Premium Member
-
Less
More
- Posts: 152
- Thank you received: 8
1 week 4 days ago #7319
by ChrisLX200
Replied by ChrisLX200 on topic ESPGeiger
pulling pin14 low with the button doesn't do anything, it still immediately goes into a loop
Please Log in or Create an account to join the conversation.
Moderators: Gamma-Man
Time to create page: 0.207 seconds