Page 1 of 1

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

Posted: 28 May 2018, 15:25
by 2xdehelft
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?

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

Posted: 28 May 2018, 15:47
by grovkillen
If it always counts the double you could use formula %value%/2

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

Posted: 28 May 2018, 15:57
by 2xdehelft
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?

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

Posted: 28 May 2018, 16:23
by grovkillen
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/

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

Posted: 28 May 2018, 16:38
by 2xdehelft
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

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

Posted: 28 May 2018, 22:49
by TD-er
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.

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

Posted: 29 May 2018, 09:14
by 2xdehelft
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?

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

Posted: 29 May 2018, 20:14
by TD-er
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?

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

Posted: 30 May 2018, 09:11
by 2xdehelft
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

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

Posted: 03 Jun 2018, 14:45
by ManS-H
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.

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

Posted: 04 Jun 2018, 15:01
by 2xdehelft
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!

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

Posted: 04 Jun 2018, 16:09
by ManS-H
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.

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

Posted: 04 Jun 2018, 16:13
by 2xdehelft
The picture is just an example. took it from google :-D

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

Posted: 04 Jun 2018, 16:16
by ManS-H
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.

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

Posted: 04 Jun 2018, 16:23
by 2xdehelft
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

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

Posted: 04 Jun 2018, 16:33
by ManS-H
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.

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

Posted: 04 Jun 2018, 16:38
by 2xdehelft
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...

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

Posted: 04 Jun 2018, 16:44
by ManS-H
Oké. tomorrow i started with the fixture. I will tell you the results.

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

Posted: 13 Jun 2018, 12:27
by 2xdehelft
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.

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

Posted: 28 Jun 2018, 22:29
by sincze
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:

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

Posted: 28 Jun 2018, 23:23
by nobody@all
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...

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

Posted: 06 Jul 2018, 13:33
by ManS-H
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.