Closed PetrJakes closed 1 year ago
Hmm this is one counter that I haven't had access to during development. The code is generally used for a 2nd standalone, ESP which would plug into the "pulse" output from this board
Is the (PWM for the) high voltage controlled by the ESP32 or is there a separate 555ic, do you know?
When using an ESP32 build by default the internal PCNT is used, the pin should be marked as input by defining what you have.
I'd advise to look into the esp32_pulse_no_pcnt build in environments.ini, which includes the flag -DIGNORE_PCNT in build flags - this will then use the standard input pin counting method used on the ESP8266. (You can also set GEIGER_RXPIN within a custom environment setting) Build up the environment from the basic esp32_pulse_no_pcnt, and then add other bits like PCNT and OLED support.
The pin when marked as an input pin should be staying low..
Could you get a good photograph of the PCB above, please? Looking at the images above, I can't be sure on the pin that is used by the pulse circuit on the counter above... and I'd like to see the traces
The pin when marked as an input pin should be staying low.. Exactly.
Can you setup ESP32 as I mentioned (platformio.ini: default_envs = esp32oled_pulse, counter.h: #define GEIGER_RXPIN 26) and test if GPIO26 is LOW after start on your ESP?
I think this is the easiest way how to check it out.
PWM for the high voltage is controlled by separate 555 (see schematic). Only ONE pin is connected/used on ESP. GPIO26
Could you get a good photograph of the PCB above, please? Looking at the images above, I can't be sure on the pin that is used by the pulse circuit on the counter above... and I'd like to see the traces
Good point. I was thinking the same and measured by multi-meter yesterday several times. Only one wire goes out from the Geiger board. On the schematic (and on the PCB) marked as INT.
Could you get a good photograph of the PCB above, please?
Thanks for your diligence in checking and confirming already 👍
And thanks for the suggestion, this is something I haven't noticed but it seems that the PCNT option is making the pin high, I need to look into this some more, but -DIGNORE_PCNT may/seems to answer the problem?
I removed -DIGNORE_PCNT
flag in environments.ini.
The results are the same.
New observation: while ESP is waiting for the WiFi configuration, the GPIO26 is LOW. When ESP connects to WiFi, GPIO26 goes HIGH.
Hi, sorry, to clarify - you want DIGNORE_PCNT so that PCNT isn't in use - with DIGNORE_PCNT the PCNT isn't used and "standard" interrupt counting is used.
With DIGNORE_PCNT in my environment the pin stays low -
[env:esp32oled_pulse_no_pcnt]
extends = base:esp32_oled
build_flags =
${base:esp32_oled.build_flags}
-DGEIGER_TYPE=${geiger_type.pulse}
-DGEIGER_MODEL='"Pulse"'
-DIGNORE_PCNT
I am confused.
As far as I see -DIGNORE_PCNT
is default in your code.
In my original setup I made only following changes:
platformio.ini: default_envs = esp32oled_pulse
counter.h: #define GEIGER_RXPIN 26
It means to me -DIGNORE_PCNT
was included than.
Or is it necessary to set up some other flag to include following?
[env:esp32oled_pulse_no_pcnt] extends = base:esp32_oled build_flags = ${base:esp32_oled.build_flags} -DGEIGER_TYPE=${geiger_type.pulse} -DGEIGER_MODEL='"Pulse"' -DIGNORE_PCNT
PCNT is used by default on esp32 device. To disable PCNT you have to declare IGNORE_PCNT
sorry i can not format code properly
No problem, my previous comment has the environment you should set up and try esp32oled_pulse_no_pcnt
I may have just pushed a fix for the PCNT issue - the following I found was of use for this https://www.esp32.com/viewtopic.php?t=6346
It seems the PCNT pulls up the pin, interesting I never noticed this before
I tried default_envs = esp32_pulse_no_pcnt
which is included in your code (I did not made any other changes)
Successfully created esp32 image.
Generating partitions .pio/build/esp32_pulse_no_pcnt/partitions.bin
ESPGeiger/src/Counter/Counter.cpp: In member function 'void Counter::setup_pulse()':
ESPGeiger/src/Counter/Counter.cpp:71:54: error: '_geiger_rxpin' was not declared in this scope
Log::console(PSTR("Counter: Interrupt RXPIN: %d"), _geiger_rxpin);
^~~~~~~~~~~~~
ESPGeiger/src/Counter/Counter.cpp:71:54: note: suggested alternative: 'geiger_model'
Log::console(PSTR("Counter: Interrupt RXPIN: %d"), _geiger_rxpin);
^~~~~~~~~~~~~
geiger_model
*** [.pio/build/esp32_pulse_no_pcnt/src/src/Counter/Counter.cpp.o] Error 1
Compiling .pio/build/esp32_pulse_no_pcnt/lib80b/AsyncTCP/AsyncTCP.cpp.o
I tried
default_envs = esp32_pulse_no_pcnt
which is included in your code (I did not made any other changes)Successfully created esp32 image. Generating partitions .pio/build/esp32_pulse_no_pcnt/partitions.bin ESPGeiger/src/Counter/Counter.cpp: In member function 'void Counter::setup_pulse()': ESPGeiger/src/Counter/Counter.cpp:71:54: error: '_geiger_rxpin' was not declared in this scope Log::console(PSTR("Counter: Interrupt RXPIN: %d"), _geiger_rxpin); ^~~~~~~~~~~~~ ESPGeiger/src/Counter/Counter.cpp:71:54: note: suggested alternative: 'geiger_model' Log::console(PSTR("Counter: Interrupt RXPIN: %d"), _geiger_rxpin); ^~~~~~~~~~~~~ geiger_model *** [.pio/build/esp32_pulse_no_pcnt/src/src/Counter/Counter.cpp.o] Error 1 Compiling .pio/build/esp32_pulse_no_pcnt/lib80b/AsyncTCP/AsyncTCP.cpp.o
That doesn't make sense as the build passes fine for esp32_pulse_no_pcnt - https://github.com/steadramon/ESPGeiger/actions/runs/5335087892/jobs/9667811952 and does locally as well.
_geiger_rxpin is defined here - https://github.com/steadramon/ESPGeiger/blob/main/ESPGeiger/src/Counter/Counter.h#L83 - this should always be defined....
As mentioned - the latest version I pushed should pull the input pin low for you on ESP32 build with PCNT - the env:esp32oled_pulse
should now pull the pin LOW after init.
I've made an environment for this device as I feel it would be great to be able to support it.
Can you try the firmware bin attached as an Artifact here https://github.com/steadramon/ESPGeiger/actions/runs/5337398054 cajoe_gc_esp32 (note edited link)
Also as a note I'm investigating some stability issues with the ESP32 - I seem to have narrowed it down some to the MQTT client, investigation continues..
Your code works now. Now it looks to me the Gaiger HW is kind of crap.
When no ESP connected, it is giving 3 volts on the output pin (INT) and it is going
LOW when beep comes. This is as expected.
When ESP connected INT goes LOW and beeps are not triggered.
I was trying to change the R19 for lower value (10kOhm) but not success as well
I have a couple of the other CAJOE geiger counters that come without the ESP32
I know these need a resistor adjustment to clean up the pulse that is sent. Is the pin inline with the buzzer? I wonder if adjusting
https://github.com/steadramon/ESPGeiger/blob/main/ESPGeiger/src/Counter/Counter.cpp#L68
GPIO_PULLDOWN_ONLY
to GPIO_FLOATING
would help any?
In general it follows schematic I have sent already Schematic here
Pulses to the GPIO are going nearly from the TUBE (just an voltage divider and transistor), which is IMHO insane. I destroyed board while de-soldering/replacing R19.
An other option is a mod to take the signal from D23/LED1.
I have a couple of the other CAJOE geiger counters that come without the ESP32
I think the schematic is the same (or very similar)
Closing as confirmed functioning code - pin now low after PCNT
I am trying to setup CAJOE IOT-GM-v1.1 counter. Pulses from counter are connected to the ESP32 GPIO26.
My setup: platformio.ini:
default_envs = esp32oled_pulse
counter.h:#define GEIGER_RXPIN 26
After the start, the GPIO stays HIGH (3.3V). Because of that ESP can not detect pulses from detector.
Schematic here
Photos of device
![Screenshot from 2023-06-21 00-57-19](https://github.com/steadramon/ESPGeiger/assets/12581771/2941a38b-3078-4bd5-879e-f48ef70539a5)
How can I configure the code so GPIO defined as INPUT stays LOW?