Optical pulse sensor: shall I report "w" or "wh"?

Hi there !
I have an emonTX arduino SMT shield as well as an optical pulse sensor from the shop.
I build my own arduino software to report data to emoncms (my own server) by ethernet (no RF on my emonTX).
So I plan to use the available IRQ pins of the emonTX shield to connect my pulse sensor to arduino IRQ (should be no problem).

I found this code example to use the optical sensor:
https://learn.openenergymonitor.org/electricity-monitoring/pulse-counting/interrupt-based-pulse-counter
The code is pretty easy and collect elapsed Wh as well as calculating instant power

I was wondering what shall I report to emoncms from here? watt or Wh ?
watt is calculated from timing between to pulses. So I assume itâ€™s a little less accurate.
Also,I assume it will not send the power for each single pulses, but a sampling, maybe every 10sec.
So, Is it possible and does it make sense to report Wh (or kWh) periodically to emoncms ?

I would say Wh, as that is the actual measured unit. As you intimate, power is the derived unit, so thereâ€™s little to gain, and potentially something to lose, by sending a derived unit when youâ€™re probably going to integrate it again inside emonCMS to accumulate kWh.

But you could send both, if you want to display the power. But bear in mind itâ€™s â€śhistoricalâ€ť in that you only know power has been used after the meter has emitted a pulse.

Thatâ€™s asking for trouble . You can read what the sketch does to see how it calculates. I struggle with understanding what â€śpower for each single pulsesâ€ť actually means, because a pulse represents one unit of energy, so â€śpowerâ€ť can only ever be the average power between the pulse before and this one.

Hi Robert,
sending both seems a good idea

Thatâ€™s asking for trouble . You can read what the sketch does to see how it calculates. I struggle with understanding what â€śpower for each single pulsesâ€ť actually means, because a pulse represents one unit of energy, so â€śpowerâ€ť can only ever be the average power between the pulse before and this one.

Let me explain what I meant
The sketch calculate the average power between 2 pulses (like you mention).
Letâ€™s assume you consume a lot of power (winter is coming? ), the LED may flash very quickly (letâ€™s say 7200kw => 2 blink per seconds ?)
Does it make sense to feed emoncms several time per second with the average power of each LED blink ?

The sketch show the calculation, not what to de next (ie: send to emoncms).
Today I plan to send my CT probes data every 10sec.
So regarding pulses I can (lazy solution) juste use last pulse measurement and send a sampled measure every 10sec (juste like I plan for CT probe)

Yikes! I wouldnâ€™t want to pay that electricity bill.

Surely you mean 7200 Watts?

yes

7200w, if continuous for 1h = 7.2kwh, 1 blink per Wh => 7200 blink per hours, 2 blink per seconds

1 Like

That depends on which database you wish to use. It would not be hard to alter that sketch so that it sends the count of pulses once every 30s (say) so that - using your numbers - when you are using more than 120 W, you send a count of pulses received over the previous 30 s, and when using less, you send a count of one only after you have seen the pulse from the meter, otherwise you send zero.

Or you could do something complicated like: Send the number of pulses received on the first pulse to arrive more than 10 s after sending the last count. That would give you a count of 20 pulses every 10 s with your 7200 W load, but a count of one pulse ever 72 s with a 50 W load.

When deciding what you want to do, consider the options emonCMS gives you in relation to the storage requirements for the various formats. The most efficient in terms of storage space is to send the count of pulses regularly, and store the data with PHPFINA, but if you send a pulse (or a count of pulses) at irregular intervals and therefore need to record the time each sample was received, then you want PHPTimeseries.

If you want to send data to emonCMS more frequently than once every 10 s, then you must use your own emonCMS, not emoncms.org.

Thanks for all those explanation !
To answer last sentence: I plan to use my own emoncms, but I do not plan to increase the measurement rate quicker than 10secâ€¦it seems already pretty fast to me.

Today my sketch send every 10sec, just because my starting point was re-using this code:
emonTXEthernet.ino
I didnâ€™t really check if it worth to slow it down a bit (â€śemonxxxâ€ť is quite a topic, I foresee tenths of questions and quite a lot of funny hours to spend on it )

What about sending â€śwattsâ€ť calculated from optical pulses at same frequency as ct probe (say every 10sec or 30sec or â€¦) using PHPFINA and send accurate pulse count every say 100 pulses (100wh) using PHPTimeseries ?

Maybe I can just try and see