So, I built a simple ESPHome pulse counter using an ESP32 and an ERCF Binky device. I powered everything with 3.3V, though I think that the ERCF implementation supplies the Binky PCB with 5V. Anyway, when I fire it up, it works – I get pulses and the device counts them.
However, I’m trying to run this at “high speed”, so I’m getting hundreds of pulses per second. When I try to do that the device just seems to reboot. I built it with a screen and using WiFi but I’ve simplified the YAML to be just the pulse counter and the problem still persists.
If you are convinced it’s code related keep on. If you have doubts, feel free to present your hardware. I still don’t know if you have a hamster running on the encoder wheel or 10kW motor running, or something else…
In the foreground is the ESP32 and in the background the KY-010 board, with the EE-SX398 and I’ve tried this with the 5V pin, too.
I’m running a 3d printed respooler which takes filament from one spool and moves it to the other - I’m driving it with my battery powered drill. I want the encoder to measure the length of the filament while I do this. I figured it would be cake, but then I ran into these reboots that seem to be a show stopper.
I can’t do that because then I’d have no way to tell what was happening!
Originally, I had a screen on it using I2C so I could read out the # of pulses and total but I’ve removed it to simplify. I guess since it doesn’t seem to be the source of the reboot I technically could put that back and disable the logger… maybe I’ll give that a try.
If the suggestion above from tom_l doesn’t resolve issue, take some odds out and remove the pulse counter from your code. If it’s still resetting try with another power supply/cable.
This is incorrect @tom_l. I want it to count on every millimeter because of the design of the encoder. I’ve already calibrated it at my desk using a strand of filament that is 100mm long.
you can see in the image below that the gear has a vaned wheel attached to it which has 1mm fins on it. If I only use rising_edge or only use falling_edge, the measured distance will only be half the length of the strand of filament.
This is also wrong, I have the pulse_counter block with “mm/min” because that’s what the pulse_counter always reports. If you look at the logger examples I’ve posted EVERYTHING that the pulse_counter reports is normalized to 1 minute. I can have it report in 2s intervals but if it gets 5 pulses during those 2 seconds it will say: 150 pulses (which is 60 seconds divided by 2 seconds times 5 pulses). AND this value isn’t totaled, it’s only for the update_interval – which is why I chose mm/min as the units. If I can get the pulse_counter to work correctly, my plan was to include a block like this:
this is good to know because I was worried that 5V to the sensor may raise up the output voltage to a point painful for the ESP32. Looking at the spec sheet for the sensor it looks like the minimum supply voltage is 4.5V but this PCB seems to work at 3.3V so I’m not sure if I need to use the 5V supply. Anyway, it doesn’t seem to help the reboots.
The more I play with this setup the more I’m wondering if it’s some static electric charge playing a role because these spools of filament have a lot of separation happening, especially when I ramp up the speed. Maybe there’s a large/wide magnetic field playing a role in the signals somehow… only I’m not sure how I should attempt to protect the wiring and whatnot from the magnetic flux. I’m wondering if I can just wrap it up in aluminum foil or something…
Interferences are the most difficult thing to debug. Also, could the encoder wheel touch the plastic body of the sensor at high speed? Creating static electricity…
But try with different power source and short cable first.
rst:0x1 (POWERON_RESET),boot:0x13
smells like power problem or interference.