RMS AC voltage measurement

I have a Raspberry Pi and MCP3008 I need to measure the RMS value of AC voltage 50Hz. Can you please tell me how this can be done software in Node-red?
There is no problem with the hardware part.

I don't think Node-red is suitable for these kind of real time application.
You can do the acquisition and preprocessing in C or Python and pass the values to Node-red.

1 Like

Thank you for your reply,
I unfortunately do not know C and Python, so I chose Node-Red.
Why can't Node-red do it? Is it too slow?

There is a node-red-node-pi-mcp3008 node that should work - but I'd be more worried about hooking anything to AC (mains) voltage - so I assume you have some sort of rectifier and isolation before the mcp3008 ?

I used this Node it works fine with DC, and on AC it outputs values varying at 50Hz. How do I calculate the RMS value from these values?

If you rectify the AC voltage, the system will work, but if the AC voltage has decreased very fast, and we have a capacitor in the rectifier, will it stay charged?

It depends how fast is fast (compared to the slope of 50hz signal). If you really want to measure live then you will probably be pushing the processor ( hence suggestion to use either specific hardware or outside node-red). If it can be over several cycles then rectifying and smoothing would be much more achievable.

Let's say I do not need super great accuracy, still the question of how to measure it remains? Or rather, how to calculate from the data stream that the MCP3008 outputs?

If you use a diode bridge to rectify the signal (and a smoothing circuit) then it will be a smooth dc level which will be the rms value

Thank you, I will do the experiment and write the result.
But I am still confused by the fact that with a fast change of AC voltage, the capacitor that will smooth the pulses after the rectifier will remain charged and thus introduce an error in the measurements.

A suitable load resistance will help.

Yes, I've already thought about installing a load resistor to discharge the capacitor. After all, the MCP3008 resistance is megohms, so it won't discharge the capacitor very fast.

Thanks again.

How quickly do you need to know about a change, and why?

The device will measure the voltage across the load resistor and save the voltage change data to a file. I would like to measure with an accuracy of at least 3 to 5 periods of AC voltage, i.e. every 60 to 100ms.

If you use a time constant of 33 msec then it will get 96% of the way to the new voltage in 100ms. Would that be good enough?

100ms it will be fine, but I still don't understand how to measure the AC voltage in Node-red?
The AC to DC conversion will only work if the AC voltage is greater than 1V, at lower voltages the diodes will not open.

Well since you have not told us what voltage range you wish to measure then we could not have been expected to know that you wanted to measure accurately below 1 volt. What range of RMS are you trying to measure, and where is that coming from?

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