Introduction: Arduino - AC Main Frequency Monitor
Hi, this is my first time, so please, be gentle!
WARNING: Working with AC voltage can be lethal. If you don't know what you 're doing please don't try this.
I've had in mind developping a monitor system, for my emergency power, consisting of 4 6V batteries and a power inverter to generate 110V AC at 60Hz. I do have a good idea on how to do it, but I'm nowhere near of starting it -yet.
Also, I've been thinking on how to be able to monitor frequency, as accurately (and cheap) as possible. The winning idea was to use a wall transformer (110VAC in 12VAC out) to drive an optocoupler which in turn drive an input pin on the arduino. The rational:
AC current will cycle from + to - and when in its possitive cycle it could lit the led on the optocoupler, closing its output. It will happens once per cycle. If we count anough pulses, if we divide the number of samples (pulses) by the time it took, that will render the frequency.
I used a voltage divider to drop the voltage to a level workable for the optocoupler. and a pull down resistor to make sure to have a know state for the input pin. The wall transformer leads connect to the lower power rails.
Label Part Type Properties
Parte1 Arduino Uno (Rev3) Tipo Arduino UNO (Rev3)
R2 100kΩ Resistor
R3 12kΩ Resistor
R4 12kΩ Resistor
U1 Optocoupler part 4N35