-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Counter increments by 2 for every pulse #7488
Comments
Seems that counter debounce time for less than 200ms does not work reliably. Have you tried larger values. |
Hi, Any news on this? Have you tried a higher counterdebounce? Have you tried the gpio as counter1n? |
I have tried setting |
I had same 2x increment with on board push-button of a sonoff basic. At my place it was gone with CounterDebounce 200. If you are willing to debug further: -You need to build your own binary after altering some code Here is how updated tasmota/xsns_01_counter.ino looks like around line 55: |
Thank you for the debugging help @to-scho I tried what you said, and this is the log output resulting:
As you can see, for each passing of the stripe there are two counts. I tried with |
I've done some more investigation - made these changes to
And from this I'm seeing that there are a lot of triggers to
So it seems the issue is not in the code, but rather in getting a clean signal... I suspect it is doing something like this: where T1 and T2 are the first and second triggers respectively. The challenge here is that the time between the signal going low/high can be either quite fast (disk spinning fast) or slow (very little energy used), so I cannot see any good value for I'll close this issue as I think it is not related to the tasmota code, but if you have any other ideas how to work around this I'd be very grateful! |
Thx for your investigation. I saw these spikes also when I had these "old" energy meters. Extending debounce time did solve it partly with a chance of missing a quick rotation. Time to get a "Smart energy meter" ;-) |
includes Arduino backport arendst#7488 backport arendst#7487 backport arendst#7486 backport arendst#7464 backport arendst#7434 backport arendst#7433 Security fix and malloc fix
Could a simple capacitor "fix" this debounce issue? I see the same "problem" on a old 1994 Schlumberger gas meter and the TCR5000. I'm running Tasmota 9.2.0 release. |
With CounterDebounce 500 / CounterDebounceLow 50 / CounterDebounceHigh 50 it's working as expected :-)! |
I have to use these values. With the values above the counter counts about 4 or 5 times to fast
but over the time it counts to low. |
PROBLEM DESCRIPTION
I have been trying to get a tcrt5000 to work as a reader for the rotating disk on the household power meter. This has returns a high signal while most of the disk is rotating, and every time the red marked spot passes under the sensor it goes low.
Problem: for every pulse that the sensor sends, I get the counter incrementing by two.
Setup:
D4 / GPIO2 is configured as a
Counter1
Counter relevant commands set:
I was wondering if this might be an issue with the TCRT5000 module, so I set up a simple push-button on a breadboard, and I can get the same effect with this as well.
BUT
With the manual button I can click significantly faster than the dial on the power meter passes (but less than the 100ms debounce time) - if I click very fast, I get the correct single increment of the counter, but if I click slowly, holding the button for (I guess) more than half a second I get two counts.
It feels to me as if counter works, as long as the pulses are very short, but not if they are a bit slower...
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
pio run
esptool.py
Backlog Template; Module; GPIO 255
:Status 0
:TO REPRODUCE
As described above
EXPECTED BEHAVIOUR
I would expect the counter to increment exactly +1 per pulse regardless of the length of the pulse
The text was updated successfully, but these errors were encountered: