Hi
I have problems with pulse count.. I think the basic problem is the time between pulses and perhaps the pulse time(1pulse/kWh, 125ms pulse).
It calculates several(hundreds) pulses in one real pulse and the power is positive or sometimes negative. I don't understand why it calculates like that?
I found similar problems in here http://openenergymonitor.org/emon/node/702
Has anybody found a solution? I was thinking somekind of filter and calculate the pulses only without power.
Re: Pulse counter with pollucom
If your input pulse is 125 ms long, and you are counting "hundreds" of pulses, then you must be using logic that says "if the input is HIGH, count a pulse" each time it does loop( ). You need to remember what the state of the input was the last time and only count a pulse when the last state was LOW and the present state is HIGH (or vice versa). Look at how the switch inputs are handled in the emonGLCD example sketches.
While you are doing that, and if your pulses come from a mechanical switch, you also want to think about contact bounce, which is when the two contacts bounce off each other and you get many short pulses at the start (and sometimes at the end too) of each real pulse. The cure in this case is, after you have detected the first change, to do nothing for a period of time until the bouncing has stopped.