Double count with pulsecounter, type rising, falling or low not working

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Double count with pulsecounter, type rising, falling or low not working

#1 Post by 2xdehelft » 28 May 2018, 15:25

Hi,

I'm currently trying to measure my house power usage with a pulse counter with a TCRT5000 sensor. All is working well accept for one thing. The power meter has a rotating silver disk with a little (2cm) black piece. The pulse counter counts this black part 2 times. Once on the beginning and once at the end.

Ive selected low, rising, falling and change from the settings in ESPEasy, but no change. It always counts double. (setting it to LOW does not count anything) Setting the debounce value to something like 5000 does work, but when I’m using less than 250w the time it takes for the black part to pass the sensor is more than 5 second. This makes my readings skyhigh… When I’m using more than about 6000w one whole rotation is less than 5 seconds, so my values are to low… This limits my measuring range to 250-6000w.
The rising and falling values are meant to stop the double counting right? So why is this not working?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Double count with pulsecounter, type rising, falling or low not working

#2 Post by grovkillen » 28 May 2018, 15:47

If it always counts the double you could use formula %value%/2
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#3 Post by 2xdehelft » 28 May 2018, 15:57

Yes i could, but i want to use TIME to calculate the live usage.... when i disable the delay it registers one long time and one short time.. this is not usable..

Is it possible to add up the last two measurements with rules?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Double count with pulsecounter, type rising, falling or low not working

#4 Post by grovkillen » 28 May 2018, 16:23

Use the formula to do that.

I use this for a interval of 10 seconds

Code: Select all

%value%×3600/10
You could the do something like this

Code: Select all

%value%×3600/2/[interval]
https://testoftimes.com/2017/11/25/moni ... g-esp8266/
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#5 Post by 2xdehelft » 28 May 2018, 16:38

I have the formula to calculate to watts, thats not the problem. My meter gives me 2 time values, one long (the silver part of the rotating disk) and one short (black part of the rotating disk)
Multiplying the last value does not help me… I need the last 2 measurements added up or an avarage of the last 2 measurements....

I have this kind of meter:

Image

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

Re: Double count with pulsecounter, type rising, falling or low not working

#6 Post by TD-er » 28 May 2018, 22:49

Are you sure you're "looking" at the black reflection on the disc and not picking up a reflection of the nut on top of it at the axis?
Where have you put the resistor? Between the GND and Emitter or between Vcc and the Collector?
You may want to try the other way. Just to make sure the change in level is enough.
Or is the transistor-part connected directly to a GPIO that has internal pull-up enabled?

Maybe try to measure with a multimeter what the 0-level is and how it depends on environmental light reflections.

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#7 Post by 2xdehelft » 29 May 2018, 09:14

TD-er wrote: 28 May 2018, 22:49 Are you sure you're "looking" at the black reflection on the disc and not picking up a reflection of the nut on top of it at the axis?
Where have you put the resistor? Between the GND and Emitter or between Vcc and the Collector?
You may want to try the other way. Just to make sure the change in level is enough.
Or is the transistor-part connected directly to a GPIO that has internal pull-up enabled?

Maybe try to measure with a multimeter what the 0-level is and how it depends on environmental light reflections.
I’m definitely looking at the black part of the disk. There is a red control light on the sensor, Its on during the silver part of the disk and off during the black part.

I’m using this sensor:

Image

+ connected to 3.3v, - connected to ground and D0 connected to GPIO 18 (D8). Should i put a resistor between the connections anywhere?

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

Re: Double count with pulsecounter, type rising, falling or low not working

#8 Post by TD-er » 29 May 2018, 20:14

Nope, the components on that print will shape the signal.
Just make sure you're using digital output pin "DO" and not the analog "AO" pin.

What version of ESPeasy are you using?

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#9 Post by 2xdehelft » 30 May 2018, 09:11

Yes I am using D0.

I've tried the last stable 2.0 (ESPEasy_v2.0-20180322), the MEGA release (ESPEasy_mega-20180522) and the R120. The first to have the rising and falling options but same behaviore, double counts. The r120 does not have the falling/rising options, and also counts double.

i've even tried it on 5V instead of 3.3 yesterday, and played with the sensitivity setting... No change.

Here a video of the sensor, as you can see the detection is working as it should.
https://www.youtube.com/watch?v=A9-I9i1Rj68

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Double count with pulsecounter, type rising, falling or low not working

#10 Post by ManS-H » 03 Jun 2018, 14:45

2xdehelft wrote: 30 May 2018, 09:11 Yes I am using D0.

I've tried the last stable 2.0 (ESPEasy_v2.0-20180322), the MEGA release (ESPEasy_mega-20180522) and the R120. The first to have the rising and falling options but same behaviore, double counts. The r120 does not have the falling/rising options, and also counts double.

i've even tried it on 5V instead of 3.3 yesterday, and played with the sensitivity setting... No change.

Here a video of the sensor, as you can see the detection is working as it should.
https://www.youtube.com/watch?v=A9-I9i1Rj68
Heya 2xdehelft,

Still busy with this project? I started again but then with 2xTCRT5000 sensor. You wrote this: I have the formula to calculate to watts. How is that formula? I try to use the data from the TCRT5000 in a dummy device. If it rotated from left to right dived thee data by 2. If it goes from right to left then right minus left. But first i will made a test fixture for the sensors.

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#11 Post by 2xdehelft » 04 Jun 2018, 15:01

ManS-H wrote: 03 Jun 2018, 14:45
2xdehelft wrote: 30 May 2018, 09:11 Yes I am using D0.

I've tried the last stable 2.0 (ESPEasy_v2.0-20180322), the MEGA release (ESPEasy_mega-20180522) and the R120. The first to have the rising and falling options but same behaviore, double counts. The r120 does not have the falling/rising options, and also counts double.

i've even tried it on 5V instead of 3.3 yesterday, and played with the sensitivity setting... No change.

Here a video of the sensor, as you can see the detection is working as it should.
https://www.youtube.com/watch?v=A9-I9i1Rj68
Heya 2xdehelft,

Still busy with this project? I started again but then with 2xTCRT5000 sensor. You wrote this: I have the formula to calculate to watts. How is that formula? I try to use the data from the TCRT5000 in a dummy device. If it rotated from left to right dived thee data by 2. If it goes from right to left then right minus left. But first i will made a test fixture for the sensors.

Hi,

To get the live usage in watt from rotation time i've used this calculation:

my meter does 187.5 laps per hour for 1 KW. 1000/187.5=5,333333333333333

One hour has 3600 seconds.... 3600x5,333333333333333=19200

19200/laptime disk = current usage in watt.... so when laptime is 60 seconds: 19200/60=320Watt



How do you measure the direction of the disk? very interesting!

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Double count with pulsecounter, type rising, falling or low not working

#12 Post by ManS-H » 04 Jun 2018, 16:09

2xdehelft wrote: 04 Jun 2018, 15:01
ManS-H wrote: 03 Jun 2018, 14:45
2xdehelft wrote: 30 May 2018, 09:11 Yes I am using D0.

I've tried the last stable 2.0 (ESPEasy_v2.0-20180322), the MEGA release (ESPEasy_mega-20180522) and the R120. The first to have the rising and falling options but same behaviore, double counts. The r120 does not have the falling/rising options, and also counts double.

i've even tried it on 5V instead of 3.3 yesterday, and played with the sensitivity setting... No change.

Here a video of the sensor, as you can see the detection is working as it should.
https://www.youtube.com/watch?v=A9-I9i1Rj68
Heya 2xdehelft,

Still busy with this project? I started again but then with 2xTCRT5000 sensor. You wrote this: I have the formula to calculate to watts. How is that formula? I try to use the data from the TCRT5000 in a dummy device. If it rotated from left to right dived thee data by 2. If it goes from right to left then right minus left. But first i will made a test fixture for the sensors.

Hi,

To get the live usage in watt from rotation time i've used this calculation:

my meter does 187.5 laps per hour for 1 KW. 1000/187.5=5,333333333333333

One hour has 3600 seconds.... 3600x5,333333333333333=19200

19200/laptime disk = current usage in watt.... so when laptime is 60 seconds: 19200/60=320Watt



How do you measure the direction of the disk? very interesting!
Thanks for your reply. First of all i want make a fixture for both sensors. The output must be equal for both sensors. That's my first step. i the mean time i can think how to handle the direction of rotation.
2xdehelft wrote: 30 May 2018, 09:11 my meter does 187.5 laps per hour for 1 KW.
If the picture is your Ferraris meter i don't understand your formula. It shows 150U/kWh

For me it's then :
my meter does 150 laps for 1 KW. 1000/150=6,666666666666666

One hour has 3600 seconds.... 3600x6,666666666666666=24000

24000/laptime disk = current usage in watt.... so when laptime is 60 seconds: 24000/60=400Watt

Correct me if i are wrong.
Last edited by ManS-H on 04 Jun 2018, 16:15, edited 1 time in total.

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#13 Post by 2xdehelft » 04 Jun 2018, 16:13

The picture is just an example. took it from google :-D

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Double count with pulsecounter, type rising, falling or low not working

#14 Post by ManS-H » 04 Jun 2018, 16:16

2xdehelft wrote: 04 Jun 2018, 16:13 The picture is just an example. took it from google :-D
Even then, the meter shows the turn/kwh, not the time.

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#15 Post by 2xdehelft » 04 Jun 2018, 16:23

If your meter is 150 turns per hour per KW your calculation is correct! try it out it works perfect. Ive doublechecked it with a powermeter and by connecting a 400W light to the net. powermeter gave me 413W, my calculation 407W... The difference is probably a measuring error in the powermeter.

Te be sure calculate is backwards...
if it rotates once every 60 seconds, its 60 times per hour. 60/150=0.4KW
if it rotates once every 30 seconds, its 120 times per hour. 120/150=0.8KW
if it rotates once every 10 seconds, its 360 times per hour 360/150=2.4KW

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Double count with pulsecounter, type rising, falling or low not working

#16 Post by ManS-H » 04 Jun 2018, 16:33

2xdehelft wrote: 04 Jun 2018, 16:23 If your meter is 150 turns per hour per KW your calculation is correct! try it out it works perfect. Ive doublechecked it with a powermeter and by connecting a 400W light to the net. powermeter gave me 413W, my calculation 407W... The difference is probably a measuring error in the powermeter.

Te be sure calculate is backwards...
if it rotates once every 60 seconds, its 60 times per hour. 60/150=0.4KW
if it rotates once every 30 seconds, its 120 times per hour. 120/150=0.8KW
if it rotates once every 10 seconds, its 360 times per hour 360/150=2.4KW
Oké, i understand. But this is a calculated value"my meter does 187.5 laps per hour for 1 KW." not the tuns given on your meter.

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#17 Post by 2xdehelft » 04 Jun 2018, 16:38

ManS-H wrote: 04 Jun 2018, 16:33
2xdehelft wrote: 04 Jun 2018, 16:23 If your meter is 150 turns per hour per KW your calculation is correct! try it out it works perfect. Ive doublechecked it with a powermeter and by connecting a 400W light to the net. powermeter gave me 413W, my calculation 407W... The difference is probably a measuring error in the powermeter.

Te be sure calculate is backwards...
if it rotates once every 60 seconds, its 60 times per hour. 60/150=0.4KW
if it rotates once every 30 seconds, its 120 times per hour. 120/150=0.8KW
if it rotates once every 10 seconds, its 360 times per hour 360/150=2.4KW
Oké, i understand. But this is a calculated value"my meter does 187.5 laps per hour for 1 KW." not the tuns given on your meter.
187,5 is the value on my meter... It says so on the front of my meter... The picture i posted is not my meter, just an example...

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Double count with pulsecounter, type rising, falling or low not working

#18 Post by ManS-H » 04 Jun 2018, 16:44

Oké. tomorrow i started with the fixture. I will tell you the results.

2xdehelft
Normal user
Posts: 10
Joined: 28 May 2018, 15:13

Re: Double count with pulsecounter, type rising, falling or low not working

#19 Post by 2xdehelft » 13 Jun 2018, 12:27

I've not been able to fix this problem, even replaced the pulsecounter, still every lap is counted double...

Is it possible to average the last 2 measured values with rules? This way i could calculate the correct time it takes for one lap.

sincze
Normal user
Posts: 38
Joined: 15 Jul 2016, 12:54

Re: Double count with pulsecounter, type rising, falling or low not working

#20 Post by sincze » 28 Jun 2018, 22:29

Damn this is cewl.
I assume the calculation needs to be done in the rules section? Or you just calculate within the task / device ?
Could you share a screenshot so I can validate my settings as I've some serious time issues. :lol:

nobody@all
Normal user
Posts: 29
Joined: 09 Apr 2017, 23:27

Re: Double count with pulsecounter, type rising, falling or low not working

#21 Post by nobody@all » 28 Jun 2018, 23:23

here is my schematic which I'am testing from three days and it's working very very good. during each rotation of the black bar in front of the sensor led blinks for 40ms. The diode I use only for test - if everything is ok. I do not use it -connect pin7 from lm393 directly to wemos d1mini. Resistor R10 -100k is very important to working properly this sensor- it puts some histeresis when black line changes position. Sorry for my english but I using this language very long time ago in school...
Attachments
Schematic_licznik-swiezak_Sheet-1_20180628225156.png
Schematic_licznik-swiezak_Sheet-1_20180628225156.png (53.26 KiB) Viewed 12985 times

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Double count with pulsecounter, type rising, falling or low not working

#22 Post by ManS-H » 06 Jul 2018, 13:33

ManS-H wrote: 03 Jun 2018, 14:45
2xdehelft wrote: 30 May 2018, 09:11 Yes I am using D0.

I've tried the last stable 2.0 (ESPEasy_v2.0-20180322), the MEGA release (ESPEasy_mega-20180522) and the R120. The first to have the rising and falling options but same behaviore, double counts. The r120 does not have the falling/rising options, and also counts double.

i've even tried it on 5V instead of 3.3 yesterday, and played with the sensitivity setting... No change.

Here a video of the sensor, as you can see the detection is working as it should.
https://www.youtube.com/watch?v=A9-I9i1Rj68
Heya 2xdehelft,

Still busy with this project? I started again but then with 2xTCRT5000 sensor. You wrote this: I have the formula to calculate to watts. How is that formula? I try to use the data from the TCRT5000 in a dummy device. If it rotated from left to right dived thee data by 2. If it goes from right to left then right minus left. But first i will made a test fixture for the sensors.
The test with 2x TCRT5000 isn't a success. Not possible for me to synchronize the both sensors. So i stop further tests.

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests