Raspberry pi and Node-RED kwh meter pulse counting?

Hi,

Any advice how to get Kwh-meter pulse data from GPIO to node-red?
Im planning to use similar connection as this project: Engineer's Principles: Power meter logging with Pi and Emoncms (skding.blogspot.com)

rpi - gpio in and rpi - gpio out nodes?

And how to count pulses to kW and kWh?

Br
Teemu

I did some experimentation with this and I found that the PI's GPIO pins wern't accurate enough to detect the pulses from an LDR, so I ended up using a dedicated microcontroller to connect to the sensor then reading that into node-red on the pi over serial.

Have a look at https://www.espruino.com/

Did you use node-red with raspberry and microcontroller? Could you share node-red script?

How often do the pulses come in?

I have the same question too. PI's GPIO is not accurate in timing compared to FPGA, but it can still reach us (microsecond) level accuracy, which should be more than good enough to detect most pulses. But I don't know about timing accuracy of PI GPIO in Node-RED.

Unless he is checking the level of the light, in which case he needs an ADC.

My meter gives a pulse every 100 Wh so the timing accuracy is not important.

1000pulses / 1kwh. And measurement through S0 pins from kwh meter, not blinking light.

That doesn't answer the question unless you also tell us what the maximum load will be.

This is for testing purposes. For this case load is about 300w-1500w.

It doesn't matter what the test case is, what matters is what the system has to cope with.

16A is max current so 3600W is max load.

So, answering the question for you, that is a max of one pulse per second so a pi should have no difficulty with that, provided it is not heavily loaded with other stuff.

1 Like

Any advice how to count pulses in node-red?

What end result are you trying to achieve?

On my system I don't add them up, I just write each pulse to influxdb as they come in. Then if I want the total for a period I get influx to calculate it.

...or if you are not intending to use a database, you can save & increment the values in context (create a running total) see Working with context : Node-RED
As Colin has said, it depends what you intend to do with the data.

Just to see realtime consumption in dashboard and trend for 1-2days is enough.

Again that does not fully define what you want. Is it real time power or accumulated total that you want?

Realtime is enough

So all you need is the rate at which messages are coming in. If you search the node red flows site for 'speed' or 'rate' you will find a number of possible nodes. For example node-red-contrib-msg-speed (node) - Node-RED might do what you want.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.