Go Down

### Topic: Frequency meter/voltmeter (Read 3775 times)previous topic - next topic

#### navybeans

##### May 26, 2008, 07:01 pm
I would like to make a device that monitors the electrical grid frequency and voltage.  In my mind, the Diecimila would plug into the USB port of a computer and there would be an attachment that plugged into an wall outlet.

It seems like this guy's frequency meter could easily be modified to measure 60Hz frequency (http://www.ikalogic.com/freq_meter.php), but I'm unsure on the best way to do the volt metering.  I haven't been able to find a good 120v AC voltage sensor, but I'm probably overlooking something.

Does anyone have suggestions on how to accomplish this without frying the circuit or computer or burning down the house?

#### PlastBox

#1
##### May 27, 2008, 01:14 pmLast Edit: May 27, 2008, 01:20 pm by PlastBox Reason: 1
Well, first of I just have to say that tinkering with mains voltage can very well be lethal if you are not extremely careful, and probably isn't legal either. At least it isn't here in Norway, or any other place I know of.

However, for the purpouse of knowing, I guess I can tell you one way of doing what you want.

A voltage divider.

You connect 2 resistors in series between the two main phases of your mains wireing. These two have to be very large to keep the current passing through them very low thus keeping the effect (watts) as low as possible. Also, they must be rated above the voltages you are going to be working with (wether it is 115V or 230V).

The ratio between these two resistors is what determines your range of output voltage. If one resistor is 50 times larger than the other, the voltage measuret between them will be 1/50 of the mains voltage. If you used (this is an example, do NOT go out and kill yourself by taking my advice or using my numbers!) one resistor of 60MOhms (60 million Ohms) and one of 10MOhms you would measure roughly 3,83 volts if your mains voltage is 230V.
Ok, sorry, I just read up on the wikipedia page below and I was a bit off on the ratio of the resistors in the voltage divider. Read about it or experiment on low voltages yourself until you understand it before you try it on mains voltage!
http://en.wikipedia.org/wiki/Voltage_divider

You'd need to rectify (turn AC to DC) the voltage you get out before measuring it too, but this is quite simple and uses only 4 diodes. http://en.wikipedia.org/wiki/Diode_bridge

With that setup (again, do NOT trust my values for resistors, etc.! I do NOT take responsibility for anything you might screw up and damage as a result of reading this!) connected to an analog input, you can measure both frequency and voltage with a little bit of nifty programming. The rectifier I linked to does not smooth the signal, just turns it into DC, so it would be jumping up and down between max voltage and 0V at the same frequency as your mains voltage.

Hope it helps, and again, I am not responsible for you killing/hurting yourself and/or others, or damaging/destroing equipment (or burning down your house/neighbourhood). With that said, Happy Hacking! =P

#### wayoda

#2
##### May 27, 2008, 01:51 pm
Hi,
the voltage divider is possible, but as already mentioned by the poster pretty much unsafe.

I suggest you do not deal with the mains directly but measure the voltage coming out of a transformer instead. Get a AC-Wallwart that outputs something like 3V and a single diode for turning the AC-Voltage into DC that can be measured by the arduino. That should do the trick in a safe way.

Eberhard

#### Grumpy_Mike

#3
##### May 27, 2008, 03:10 pm
If you make it into a DC voltage as suggested above you will never be able to measure frequency, only voltage. So two ideas:-
1) Get a low voltage AC wall wart.
2) Use a low value of capacitor and a resistor to make your voltage divider. Then feed in the resulting waveform through an opto isolator and use the pulses to measure the frequency. It's a lot safer.

#### wayoda

#4
##### May 27, 2008, 04:25 pm
Hi,
Quote
If you make it into a DC voltage as suggested above you will never be able to measure frequency, only voltage.

Why shouldn't that work?
The diode will simply cut off the negative swing of the sinus signal, to prevent a negative voltage on the analog inputs of the arduino. No capacitors are involved !
You will get a nice pulsating dc-voltage at 50/60 Hz.  see http://en.wikipedia.org/wiki/Rectifier#Half-wave_rectification

Opto-isolators are another option, but then you still have to build a circuit that is connected to mains.

Eberhard

#### PlastBox

#5
##### May 27, 2008, 04:29 pm
DO'H! Didn't even think about using a transformer. Damn it! =P

If you get a small 3V wall wart or something like that, you _could_ pull it apart and get rid of the capacitors (but leave the rectifier itself the way it is). That would leave you with a signal that bounces between 0 and 3V at the frequency of the mains wire. And, if the mains voltage drops or spikes a bit, you'd be able to see that as well. Much safer than a voltage divider, but you are still fiddeling with potentially lethal (to you and your precious equipment) voltages.

Good luck!

Go Up