Struggling with ESP32 - Counts too many - Interrupt issue?

  • Simomax
  • Simomax's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Nuts about radioactive everything!
More
1 year 9 months ago #6356 by Simomax
Thanks for the input, Bert490. My intention of getting this working wasn't for me, it was for anyone that wants to use it. I doubt I would ever use an ESP32 as a counter myself. I wanted to keep it as simple as possible like with the other arduino code I have written for the various MCUs in order for other people to throw an MCU on a counter to submit to radmon.org. Like Lego, just throw a board onto a counter, upload the code and go. When it starts getting to adding extra components and things it suddenly becomes much less simple for other people with limited skill sets, so if I can't make this simple, it really isn't suitable for the job in hand.

Funny thing though, I have two test counters (my breadboard and an Ebay cheapie) and both of those work great on every MCU I have tested with except for the ESP32. Simply plug them together with a jumper cable and go. The code I have written for the other MCUs seems very stable and they all count correctly. I can only assume (as I haven't dug into it) that the ESP32 is much faster and more sensitive, so is picking up the tiny peaks and troughs of the pulse waveform. When I connect my breadboard counter to say an ESP8266, they both count 1:1, same for the Arduino Uno, Mega, Pro Mini etc. With the ESP32 i get anywhere from 1:3 to about 1:8 counts. Using the level converter it was between 1:1 and 1:3. I have also tried using the interrupt code from every other ESP32 counter I have come across and get pretty much the same results so that makes me wonder if other people are getting wrong count readings, and if not, why not? I may try my NetIO GC-10 at some point as that has (I believe) a logic level pulse out from the MCU on board of it which might make a difference. But until then it can stay shelved as far as I am concerned.

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #6357 by DonZalmrol
As mentioned earlier, I'm using an ESP32 for my logger without any issues at all for over a year.

For ESP32 you can use "PCNTs" Pulse Counters to help you count inputs. It is what I use to count my background radiation with two tubes, so two counters.

More info: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/pcnt.html

And working examples on my github: https://github.com/DonZalmrol/

I have to add that I did start using the PCTNs right away, I can't say for sure it was because I read up on the Espressif docs or had an issue with counts.

Please Log in or Create an account to join the conversation.

Moderators: Gamma-Man
Time to create page: 0.141 seconds
Powered by Kunena Forum
Everything's free. Please support us by considering a donation. Log in first!
Solar powered Raspberry Pi 4 server stats: CPU 37% Memory 23% Swap 70% CPU temp=48.2'C Uptime 71 Days