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.

Assembly List

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


Eric Brouwer (author)2016-05-22

Thanks for sharing.

Remember, the opto-coupler input (pins 1 & 2) are actually connected to an internal LED. Thus, you do not need a voltage divider. You only need a single current limiting resistor.


Yes indeed!!! I can give a thousand explanations, truth to be told, I'm still learnig and trying to grasp the concepts (voltage, current, comsumption, wattage, capacitance, reactance....)

Thanks!! Will try that!

DIY Hacks and How Tos (author)2016-05-21

Cool. I used a similar kind of monitor to make a back-up emergency lighting system.


Thanks for your comment. Is incredible how simple some things can really be....