View Single Post
  #26   Report Post  
Posted to uk.d-i-y
The Natural Philosopher[_2_] The Natural Philosopher[_2_] is offline
external usenet poster
 
Posts: 39,563
Default Logging mains voltage: Arduino or Raspberry Pi?

On 13/04/18 15:02, newshound wrote:
On 13/04/2018 11:45, The Natural Philosopher wrote:
On 13/04/18 10:24, newshound wrote:
On 13/04/2018 07:48, Halmyre wrote:
On Thursday, April 12, 2018 at 1:59:45 PM UTC+1, newshound wrote:
On 12/04/2018 12:51, The Nomad wrote:
On Thu, 12 Apr 2018 12:37:06 +0100, newshound
wrote:

For reasons I won't bore you with, I'm interested in building a
cheap,
simple data logger to monitor mains voltage, ideally two channels
(live
to earth and neutral to earth). In the dim and distant past I have
designed and built such things more or less from scratch, but surely
someone has already done this.

I havn't used either Arduino or Pi before, but I assume one or other
would be the obvious starting point.

However ATM google isn't giving me a strong lead. Thoughts?

A quick google came up with:

https://openenergymonitor.org/forum-archive/node/58.html

https://circuitdigest.com/microcontroller-projects/arduino-ac-voltmeter


https://www.briandorey.com/post/ardu...e-and-current-
logging

Avpx

Thanks, that second one looks like a good basis.

Won't the capacitor smooth out any transients you might want to
observe?

I am looking for transients longer than maybe a second or so.
Obviously, might need to experiment with capacitors a bit.


Hmm. My instinct would be to sample MUCH more frequently than that and
sample AC as well so that you get a really good set of smaples, and
then do any filtering in 'software'

I dunno how long an arduino trakes to do a sample but it cant be that
long

Oh. It seems you can sample at up to* 9.6Khz...that should do nicley -
and take an RMS value of the waverorm and moving average it out over
the last say one second...and use that to store.

Or uses a shirfter period for more sensitivity to transients

Basically you need a small* mains transformer to step down to about
5VAC or so, then a voltage diveider to set the mean voltage in the
middle of the arduino range, and a pot to scale the output to - say
0-5V representing up to say 500V peak...


If say you are taking 5khz samples you will need a nmemoiryy buffer of
5000 16 bits (10k of RAM) to store the* samples and a further location
to do the running average in.

Well within an arduino I'd say.







Thanks, yes I agree completely about the sampling strategy, but I'd sort
out details once I knew the capability of the device. My point was that
I think I am looking for slowish variations rather than microsecond
transients. (I am trying to find what is killing electric kettle elements).


My point is, do the low pass filtering in software, though.

A bridge rectifier and smoothing cap is a peak voltage reading abortion
for this: you want to do an RMS average especially for kettle elements.

My solution is less components, but more code.

Code is cheap!

Only issue is doing a square root in binary integers...arduinos don't
have native floating point ****!






As you say, small mains transformer, a few resistors and of course a 5
volt Zener on the ADC input.


Well i'd just clamp that to the 5V rails.

You will run at a high impedance so no damage dumping the odd mA into
the supply





--
Some people like to travel by train because it combines the slowness of
a car with the cramped public exposure of an airplane.

Dennis Miller