Skip to main content
Topic: Loggrid - Power line frequency and voltage monitor/logger (Read 14335 times) previous topic - next topic

Loggrid - Power line frequency and voltage monitor/logger

I like to have multiple projects going at the same time so I'm thinking of starting yet another. This project was triggered from a discussion elsewhere about the accuracy of the power line frequency.  How exact is the 50/60 hz and how does it vary over the day?

I'm thinking of doing this project on two separate boards.  One small board that measures the power line and sends the data to the display and storage board.

[attachment=1]

The main board would have a 7-segment display that would look something like the image below, showing the current time ( according to the time kept by the controller and OCXO), the number of seconds the time derived from the powerline frequency  vould be off from the real time, and the  current frequency + voltage of the power line.

The data would be logged in a SD memory card for later download via USB to a computer for graphing and analysis.

[attachment=2]

I'm planning to do the measuring board with a transformer-less power supply.  A small microcontroller and an optocoupler doesn't require too much power and getting 30-40 mA from the supply is not a problem.

Here I'm using a 1 uF capacitor in series with the power input to reduce the current to a level that the zener can handle. A  high ohm resistor is connected directly from the hot wire to a pin on the AVR for zero-cross detection. The AVR have internal clamping diodes that will limit the voltage to approximately VCC/GND, and as long as the current is low enough no damage will occur. The measuring of the voltage is done with a diode to remove the negative parts of the ac voltage and then a voltage divider that reduces the 235 peak voltage down to a range measurable by the internal 10-bit ACD in the AVR.

At every zero crossing the ADC value will serially be sent as two bytes via the optocoupler to the main board. Since the zerocrossings occur every 8.3 mS at 60Hz. A byte takes little bit over 1 mS to send at 9600 bps so any rate faster than 2400 bps would be sufficient.

[attachment=0]

Any comments, suggestions or questions are welcome....

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #1
[quote author="matseng"]At every zero crossing the ADC value will serially be sent as two bytes via the optocoupler to the main board.[/quote]
Watch out for byte alignment issues! If the main board starts receiving (on powerup perhaps) in the middle of the 2-byte transmission, the main board will think that Byte 2 is really Byte 1 of a two-byte packet.

Instead, could you send a three-byte packet with a fixed-value header? That way you can detect the start-of-packet even if the main board gets out of sync with the sending board. If the receiver sees an initial byte that is not the start-of-packet value, it can wait until it does see the expected value.

If you want to get REALLY fancy, then add a fourth byte for a checksum! :-)

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #2
Ah yes, that could be an issue. Three bytes at 4800 bps should fit within the allotted 8.3 mS.

Or.... since the ADC is only 10 bits the MSB of the first byte could be set to 1 to signal that it is the first byte.

Like this: (where dX is the bits of the data from the ADC to be sent)
Code: [Select]
Byte1 = 1  0  0  0  0 d9 d8 d7
Byte2 = 0 d6 d5 d4 d3 d2 d1 d0

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #3
I really should be doing some real work now and not be playing with hobby projects, but when I get an idea in my head it's hard to let go :-)

[attachment=0]

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #4
[quote author="matseng"]Like this: (where dX is the bits of the data from the ADC to be sent)
Code: [Select]
Byte1 = 1  0  0  0  0 d9 d8 d7
Byte2 = 0 d6 d5 d4 d3 d2 d1 d0
[/quote]
Yep, sounds good to me! :-)

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #5
I put the current limiting capacitor *after* the full-wave rectifiers, that was a stupid thing to do. Of course they should be *before* the rectifiers to get proper AC to limit.

And the 1uF that I've used is a bit too much to be used with 230 volts 50 Hz. XC=1/(2PI*f*C) so using 1 uF @ 50 Hz gives a reactance of 3.2 K ohm giving current at about 70 mA.  I'll change that to a 0.33 uF to get 9.6K and 24 mA. The load of the ATTiny is only a mA or two and the optocoupler is 5-10 mA when sending so 24 mA should be plenty.

For 110 volts 60 Hz the capacitor should be 0.47uF to pass a current of about 20 mA.

I soldered up a prototype of the board tonight and I also found a full tube of 0.56" 7-segment displays in my shelfs so I have the parts for doing the controller board as well.  I just have to select a microcontroller - maybe a PIC18F25K50 to keep the DP-crowd happy? The 25K50 got USB and have enough memory and I/O for this....

[attachment=0]


Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #7
Que?  Why did my schematics appear in a scrollable window/frame?  I've never seen this before here....

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #8
I think some specific output formats the forum software isn't happy about compressing/thumb nailing and it does that instead. Has happened to me in the past too.
Got a question? Please ask in the forum for the fastest answers.

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #9
Rather than an OCXO, you may want to use the Pulse-Per-Second and data streams from a GPS module.  It is more accurate long-term, and it provides an exact timing reference and absolute time.

On Digikey, even the 100+ ppb frequency stability OCXOs are about the price of a GPS module.  And those modules have ~1 ppm accuracy, which means that if you count the number of cycles in a 24 hour period, you will be off by up to 5 cycles.  With a GPS you are always within way-submicrosecond of true time.

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #10
That is a good idea, I'll include an input for a GPS NMEA data stream plus the 1pps.   

I actually have a Trimble Thunderbolt GPDSO online as my lab 10MHz reference, I also got a Rubidium "atomic clock" that I plan to some day have disciplined my the Thunderbolt.

When I installed the GPS antenna on my roof one of my neighbors recognized the antenna as a GPS antenna as asked me why I wanted to know the location of the house :-)

[attachment=0]

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #11
[quote author="matseng"]
When I installed the GPS antenna on my roof one of my neighbors recognized the antenna as a GPS antenna as asked me why I wanted to know the location of the house :-)
[/quote]

its good to know if it is moving

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #12
Quote
When I installed the GPS antenna on my roof one of my neighbors recognized the antenna as a GPS antenna as asked me why I wanted to know the location of the house :-)

I think I would have told them "it's for my earthquake monitoring system, I'm waiting for the big one."

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #13
Hi..
just find this post, and I think it's interesting to have a record of the grid behavior. A while ago I designed a equipment like that, so I leave the schematics for consideration (I apologize for using Altium Designer but what I had on hand at the time).

The equipment is like a trainer, uses a dsPIC for detecting zero crossings, a PIC18F4550 to communicate with a GPS and a Tibbo serial to ethernet converter. It was not designed to measure voltages or currents, it only required the frequency measurement history. But it can be useful for a fuller development.

The idea of measuring electrical parameters of the network is used for stability concept of power systems, allowing control of lack of load for generators to avoid blackouts.

Look for FNET on wikipedia (Frequency monitoring Network)

Best regards
Miguel Dávila.

Re: Loggrid - Power line frequency and voltage monitor/logge

Reply #14
Thank you. I'll have a look at the pdf and will read up about the FNET - sounds interesting....