Pulse Counter log to feed showing accumulated value

I’m new to Emoncms and have a problem. I tried to dig through the documentation and the community forum but unfortunately I’m still “fumbling in the dark”.

I have the following setup:
A Raspberry Pi with the pre-built SD card (emonSD) for the Raspberry Pi, emonSD-10Nov22 (Stable).
I have an optical pulse sensor connected directly to the RPI’s pin 15 (GPIO 22). The sensor is placed on my meter’s pulse indicator LED, the LED is blinking with 1000 imp/kWh.

I have the following config for EmonHub:

    [[pulse]]
        Type = EmonHubPulseCounterInterfacer
        [[[init_settings]]]
            pulse_pin = 15
            # bouncetime = 2
            rate_limit = 2
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,
            nodeoffset = 3

In the log I can see that EmonHubPulseCounterInterfacer is created:

2022-12-24 14:27:04,219 ERROR    MainThread Could not open serial port: /dev/ttyUSB0 @ 115200 bits/s (retry every 10s)
2022-12-24 14:27:04,220 INFO     MainThread Creating EmonHubPulseCounterInterfacer 'pulse'
2022-12-24 14:27:04,221 INFO     MainThread pulse : Pulse pin set to: 15
2022-12-24 14:27:04,243 DEBUG    MainThread Setting pulse nodeoffset: 3
2022-12-24 14:27:04,244 DEBUG    MainThread Setting pulse pubchannels: ['ToEmonCMS']
2022-12-24 14:27:04,245 INFO     MainThread Creating EmonHubRFM69LPLInterfacer 'SPI'
2022-12-24 14:27:04,258 INFO     MainThread Creating RFM69 LowPowerLabs interfacer
2022-12-24 14:27:04,258 INFO     MainThread node_id = 5

I can also see that the pulses from the sensor is received:

2022-12-24 14:25:01,227 DEBUG    MQTT       Publishing: emon/3/Pulse 3484
2022-12-24 14:25:01,466 DEBUG    Dummy-7    pulse : pulse received -  count: 3485
2022-12-24 14:25:02,661 DEBUG    Dummy-7    pulse : pulse received -  count: 3486
2022-12-24 14:25:03,004 DEBUG    pulse      Data to Post: last_time: 1671888301  time_now: 1671888303
2022-12-24 14:25:03,005 DEBUG    pulse      1523 NEW FRAME : 
2022-12-24 14:25:03,005 DEBUG    pulse      1523 Timestamp : 1671888303.004409
2022-12-24 14:25:03,006 DEBUG    pulse      1523 From Node : 3
2022-12-24 14:25:03,006 DEBUG    pulse      1523    Values : [3486]
2022-12-24 14:25:03,007 DEBUG    pulse      1523 Sent to channel(start)' : ToEmonCMS
2022-12-24 14:25:03,007 DEBUG    pulse      1523 Sent to channel(end)' : ToEmonCMS
2022-12-24 14:25:03,235 DEBUG    MQTT       Publishing: emon/3/Pulse 3486
2022-12-24 14:25:03,867 DEBUG    Dummy-7    pulse : pulse received -  count: 3487
2022-12-24 14:25:05,013 DEBUG    pulse      Data to Post: last_time: 1671888303  time_now: 1671888305
2022-12-24 14:25:05,014 DEBUG    pulse      1524 NEW FRAME : 
2022-12-24 14:25:05,015 DEBUG    pulse      1524 Timestamp : 1671888305.013193
2022-12-24 14:25:05,016 DEBUG    pulse      1524 From Node : 3
2022-12-24 14:25:05,016 DEBUG    pulse      1524    Values : [3487]
2022-12-24 14:25:05,017 DEBUG    pulse      1524 Sent to channel(start)' : ToEmonCMS
2022-12-24 14:25:05,018 DEBUG    pulse      1524 Sent to channel(end)' : ToEmonCMS
2022-12-24 14:25:05,044 DEBUG    MQTT       Publishing: emon/3/Pulse 3487

I’m trying to set up a HomeEnergyMonitor to measure power consumption, my device looks likes this:
emon1

My input looks like this:

And my feeds:

Now to my problem / the part I don’t understand. It seems like the use value is the accumulated value of the pulses from the sensor rather than the number of pulses since the last “post / frame”. I expected “use” would show me the current power consumption.

Is there a way to show the current power consumption using a Rpi and optical sensor connected directly to Rpi’s gpio?

[Edited for presentation - Moderator (RW)]

1 Like

Welcome.

I’d remove the standard interfacer to get rid of this error.

By definition a pulse counter triggers after a certain amount of energy has been used - it is not an instantaneous reading as it has no way of knowing how long it was since the last pulse. You can average that so if the increment is 2 pulses that is 2 Wh of energy used in 10s so you can determine the average Power consumption over that 10s period. However, if no increment happens, that average gets an error as your average should be over 2 periods, not one, but that gets lost.

You can get the difference between 2 readings, create a new input process

image

Just add it below this one, just make sure the ‘period’ is the same as the other processes.

image

You can only find the period for the feed by rolling your mouse over the Feed Name (so do that first) - you need ‘Feed Interval’

image