P003 Pulse problem

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
easpeasy-s
New user
Posts: 4
Joined: 11 Aug 2022, 15:58

P003 Pulse problem

#1 Post by easpeasy-s » 11 Aug 2022, 16:24

I use espeasy on a esp32board to count pulse coming from a power meter)
The signal (red line) on the GPIO is:
input signal
input signal
20220811-0001.png (21.69 KiB) Viewed 2623 times
and i get from 1 to 20 pulse every 10s

with the mode set as "falling" it works and seems to count correctly
Falling
Falling
Capture.PNG (25.14 KiB) Viewed 2623 times
but with the mode set to "PULSE low" the counting is erratic and much lower
Pulse
Pulse
Capture1.PNG (25.48 KiB) Viewed 2623 times
I have tried with different Debounce Time without success.
It did read the doc about that and it seems it should work.

Any idea?

my devices with 3 pulse input
devices
devices
Capture2.PNG (27.5 KiB) Viewed 2623 times

Build: ESP_Easy_mega_20220809_normal_ESP32_4M316k Aug 9 202 (but is the same with all release for many months)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: P003 Pulse problem

#2 Post by TD-er » 11 Aug 2022, 17:15

What is the blue signal?
Is that also being fed to the ESP?

I assume the red scale on the right reflects the voltage of the red signal?

With such a clean signal, I don't think you should be using any debounce filter as it probably will hurt more than it may fix.

I have to check the code (later, maybe this evening) to see if it should work like this.

Can you explain what you expect on the output?
And what is it you're seeing which is erratic?

easpeasy-s
New user
Posts: 4
Joined: 11 Aug 2022, 15:58

Re: P003 Pulse problem

#3 Post by easpeasy-s » 11 Aug 2022, 19:54

Blue signal is input from my photo-diode, so is not relevant here.
Yes, the red scale is the for the red signal.

So what to put in "Debounce Time" to disable the debounce filter ? put in 0?

If I use the falling mode it seems that the count is correct.
But if I use PULSE Low or PULSE High, I miss many pulse and I did expect to see the same count that for falling. But I got ~half, 1/3 or 0 count comparing to count in falling mode

ex: in falling mode I get 2,3,4,3 count in 4*10s and in Pulse mode i get 0,1,0,2 count in 4*10s

Seems strange to me.
I tried to display some debug informations but didn't understand most of them. But I can send them if you need it.
Regards.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: P003 Pulse problem

#4 Post by TD-er » 11 Aug 2022, 22:02

Hmm, perhaps the pulse-width is too small for properly detecting both edges?
But why do you need both edges? Is the duration of the pulse of any significance?

easpeasy-s
New user
Posts: 4
Joined: 11 Aug 2022, 15:58

Re: P003 Pulse problem

#5 Post by easpeasy-s » 12 Aug 2022, 12:06

Hmm, perhaps the pulse-width is too small for properly detecting both edges?
I want only count the number of pulse
But why do you need both edges? Is the duration of the pulse of any significance?
I need only one edge, but I tried with "pulse low" and in a second test with "pulse high" without success.
The duration has no signification and is ~9ms.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: P003 Pulse problem

#6 Post by TD-er » 12 Aug 2022, 12:28

Well then for your use case it is good enough to count either the rising or the falling edges.

Counting a full pulse does involve quite a lot more computational effort in the ESP and double the amount of interrupt calls which may affect other tasks running in ESPEasy.

easpeasy-s
New user
Posts: 4
Joined: 11 Aug 2022, 15:58

Re: P003 Pulse problem

#7 Post by easpeasy-s » 12 Aug 2022, 21:43

Thanks for the explanation

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 25 guests