ESP Easy Pulse count problem / bug

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Maarten112
Normal user
Posts: 11
Joined: 01 Apr 2016, 11:48

ESP Easy Pulse count problem / bug

#1 Post by Maarten112 » 01 Apr 2016, 12:05

Hi Everyone,

I'm busy settings up a simple pulsecounter with ESP Easy to measure my energy consumption on an analog Energy meter. I'm upgrading from a home made arduino project to do the same, since I love the WiFi functionality of the esp8266.

I'm using the following software/hardware:

- ESP-01
- tcrt5000 sensor with breakout board on GPIO2 like the one used on the wiki: http://www.esp8266.nu/index.php/PulsCounter
- temporary USB to TTL unit to supply the circuit with stable 3.3V (will be removed as soon as everything is working).
- ESPEasy_R78

The problem is that pulses are counted multiple times after the "black" mark on the analog energy meter wheel has passed. I suspected that the interrupt would be FALLING or RISING, since it's most convenient for most applications. However, it seems that ESPEasy is counting both FALLING and RISING. I've checked the sourcecode, and noticed however that the Interrups are programmed as FALLING (e.g.

Code: Select all

attachInterrupt(Par1, Plugin_003_pulse_interrupt6, FALLING);
) However...it still seems that both FALLING and RISING (so BOTH) are counted!

A simple solution would be to set a delay in the espeasy software, but the problem with that delay is that the delay must be long enough to not double count pulses on low current consumption, but short enough to not miss any pulses on high current consumption. It's really not convenient, since I am unable to find the sweetspot to measure all my current use (e.g. if I set the delay such that low current pulses are not double counted, it will miss pulses at high current consumption).

Would it help to use a pull up resistor between GPIO2 and VCC...or is it some kind of bug? Thanks already!!

Backbone
Normal user
Posts: 106
Joined: 06 Oct 2015, 22:12

Re: ESP Easy Pulse count problem / bug

#2 Post by Backbone » 02 Apr 2016, 22:18

Maarten,

USB to TTL converters can deliver maximum 300 ma.
ESP8266 need more power if the wifi works! Beaware if you have problems your not the first.........
Use breadboard power supply with 1 amp power adapter to trouble shoot.

I run the same set up but my detection point is a silver spot on the dial in the number 6 (gasmeter).
Unchanged ESP EASY code and it runs fine with low and high rate of powerusage.

Paco

Maarten112
Normal user
Posts: 11
Joined: 01 Apr 2016, 11:48

Re: ESP Easy Pulse count problem / bug

#3 Post by Maarten112 » 04 Apr 2016, 17:05

Hi Paco,

Thank you for your reply! I will change the usb to ttl adapter for a dc dc converter that will do > 1Ah and will report my findings!

dduley
Normal user
Posts: 93
Joined: 06 Feb 2016, 17:56

Re: ESP Easy Pulse count problem / bug

#4 Post by dduley » 28 Apr 2016, 07:51

Hi All,

I am trying to use the pulse count feature to read the output of a water meter. I get 1 pulse for every ten gallons of water. That all works fine but when I try to use the formula to convert pulses to gallons all I get is the pulse count and total. The total increments by 1 for every pulse but I have a formula set up that looks like this: %value%*10. I would expect the totals to increment by 10. Are the formulas working for the Pulse count plugin?

Thanks

Dave

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: ESP Easy Pulse count problem / bug

#5 Post by andy » 28 Apr 2016, 18:17

I may have found a clue. Line 27 in _P003_Pulse.ino states:

Code: Select all

        Device[deviceCount].VType = SENSOR_TYPE_SINGLE;
...which indicates to me it may only report one value to ThingSpeak (my issue in another thread) and may only apply a formula to the first result.

If you look at line 23 in _P005_DHT.ino, you'll find:

Code: Select all

        Device[deviceCount].VType = SENSOR_TYPE_TEMP_HUM;
...where, indeed, you can apply formulas to both values, and both values are reported to ThinkSpeak.

I think we need line 27 in _P003_Pulse.ino changed to:

Code: Select all

        Device[deviceCount].VType = SENSOR_TYPE_TEMP_HUM_BARO;
While that's not technically correct, it drops the values into _C004.ino into the correct case and may also permit formula application to three values instead of one.

dduley
Normal user
Posts: 93
Joined: 06 Feb 2016, 17:56

Re: ESP Easy Pulse count problem / bug

#6 Post by dduley » 29 Apr 2016, 16:46

andy wrote:I may have found a clue. Line 27 in _P003_Pulse.ino states:

Code: Select all

        Device[deviceCount].VType = SENSOR_TYPE_SINGLE;
...which indicates to me it may only report one value to ThingSpeak (my issue in another thread) and may only apply a formula to the first result.

If you look at line 23 in _P005_DHT.ino, you'll find:

Code: Select all

        Device[deviceCount].VType = SENSOR_TYPE_TEMP_HUM;
...where, indeed, you can apply formulas to both values, and both values are reported to ThinkSpeak.

I think we need line 27 in _P003_Pulse.ino changed to:

Code: Select all

        Device[deviceCount].VType = SENSOR_TYPE_TEMP_HUM_BARO;
While that's not technically correct, it drops the values into _C004.ino into the correct case and may also permit formula application to three values instead of one.
Hi Andy

I think you are on to something for your Thingspeak issue but the formulas don't seem to work on either of the variables (Count or Total). I was going to look at the plugin code today to see if there was a simple change that would fix it.

Dave

dduley
Normal user
Posts: 93
Joined: 06 Feb 2016, 17:56

Re: ESP Easy Pulse count problem / bug

#7 Post by dduley » 29 Apr 2016, 17:07

Hi All,
The other thing I just noticed is that the count values are not non-volatile. If you reset the module all the count information goes away. It would be good to save the count in flash and have a clear button on the count task or something like that. I am using mine to accumulate water usage information. If there was a power failure or the module just felt like hiccuping, as these are prone to do, then the accumulation would be lost. You would then really have to be connected to another system that provided that persistence like Thingspeak or Openhab in order to not loose that information.

Just more thoughts

Dave

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: ESP Easy Pulse count problem / bug

#8 Post by costo » 30 Apr 2016, 12:07

dduley wrote:Hi All,
The other thing I just noticed is that the count values are not non-volatile. If you reset the module all the count information goes away. It would be good to save the count in flash and have a clear button on the count task or something like that. I am using mine to accumulate water usage information. If there was a power failure or the module just felt like hiccuping, as these are prone to do, then the accumulation would be lost. You would then really have to be connected to another system that provided that persistence like Thingspeak or Openhab in order to not loose that information.

Just more thoughts

Dave
In my opinion that's exactly what the ESPEasy project was meant for, collecting sensor data and sent it , wireless over IP, to a server/system where the data is saved, processed and displayed in the form you want it. That is why I use Domoticz for that purpose.
I prefer Domoticz over all the web/cloud based systems where you are dependent on a third party. A party that (to their own terms) owns your data, can change it's license and API as much and at any time as it likes and could charge you (in future) to have access to your own data.

dduley
Normal user
Posts: 93
Joined: 06 Feb 2016, 17:56

Re: ESP Easy Pulse count problem / bug

#9 Post by dduley » 30 Apr 2016, 18:45

costo wrote:
In my opinion that's exactly what the ESPEasy project was meant for, collecting sensor data and sent it , wireless over IP, to a server/system where the data is saved, processed and displayed in the form you want it. That is why I use Domoticz for that purpose.
I prefer Domoticz over all the web/cloud based systems where you are dependent on a third party. A party that (to their own terms) owns your data, can change it's license and API as much and at any time as it likes and could charge you (in future) to have access to your own data.
Hi Costo,

I disagree. Here's an example: I want to have a local display for my water meter. I want ESPEasy to accumulate the pulses from the meter, multiply the value by 10 (to get gallons), display that value and also transmit it to whatever persistence service I have chosen (Thingspeak, Domoticz, or OpenHab) for trending, Max, Min, Mean etc. I would like a local button to clear the count but I don't want the local display to loose its count because of a power failure or the all-too-often reset. I can't load the count with a value so now for the remainder of the month (Until my next water billing cycle) I have to do mental math if I look at the display. It also means that I could loose count of some events if my reporting isn't very often such as Thingspeak's 15 second update rule. This might not be so important for a simple water meter but for other applications it might be. Resets for these things can come from many places. If the wifi strength is a little weak the module can loose connectivity briefly. If there are 30 errors trying to connect to OpenHab the module resets and looses its count, if the wifi drops out for too long the the module resets etc.
Value persistence would be a major plus as would local reset and pre-loading of the count register so the value doesn't always have to start with zero (like syncing the ESP with the value already displayed on the mechanical counter of the water meter)
The Formula thing and the Thingspeak transmission issues are just simple bugs that I am sure will get sorted out in the next couple of revisions.

Best regards

Dave

Yves911
Normal user
Posts: 18
Joined: 21 May 2016, 17:38

Re: ESP Easy Pulse count problem / bug

#10 Post by Yves911 » 21 May 2016, 17:43

First of all i am new here and want to thanks for all the great work you have done here.
I am considering moving my Gas/Elec counter program by ESPEasy.
I notice that from the Pulse plugin i receive only "count" values and not Total and Time into MQTT messages.
Don't know if total should be keep across reboot (because in that case you have to save the value into the flash and so the flash will die soon).
But i think that Time is needed to be send for calculation of the current consumption...

Cheers
Yves

tocks
Normal user
Posts: 12
Joined: 27 Apr 2016, 09:21

Re: ESP Easy Pulse count problem / bug

#11 Post by tocks » 25 May 2016, 20:35

any new about the problem of save total on a reboot ?

at4501
New user
Posts: 1
Joined: 12 Dec 2016, 16:05

Re: ESP Easy Pulse count problem / bug

#12 Post by at4501 » 12 Dec 2016, 16:26

Hi,
i seem not to be able to transfer to Domotics pulses, it only sends idx not the value:
checked from wireshark:
[Full request URI: http://192.168.1.10/json.htm?type=comma ... ice&idx=16]

However, pasting correct url, domoticz gets updated. Problem is in Pulse sketch somewhere. Already have the newest available EasyESP version

///// sorted by version upgrade, where, it isnt possible to set up on ESP side TOTAL for the pulses. It actually warns,that, it isnt persistent. Thus, only option is delta. Now, value is sent ok.\\\\\\\

Post Reply

Who is online

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