## Background

While studying Electrical Engineering, I was introduced to AC Power and it's properties.

Through some experiments I tried to understand how to work with AC Power and study it's practical behaviour.

I built a Zero-crossing detector, an Arduino-based Frequency Monitor and an AC Dimmer, all in my hostel room. ## The Experiments

Chopping the 9V AC Signal Converting it to a square wave Triac Dimming with Phase-Angle control Frequency values from the 10 sec window over Serial Zero Crossing Detection

My first experiment was detecting zero-crosses of the AC Sine Wave

To do this, I built a circuit that generated a pulse every time the sine wave crossed zero and fed it to an LED. So the LED flickered at a frequency twice that of the mains AC supply.

I used a transformer to step the voltage of the Sine wave down from 230V to 9V and fed this to my circuit. My circuit first rectified this using diodes and then used a voltage regulator to chop the waveform to a maximum of 5V (safe for Arduino).

Using an internal comparator, this waveform was converted to a square-wave. By detecting the rising and falling edges of this square waveform, the Arduino sketch was able to detect zero-crosses. Based on the zero-crosses detected, the Arduino switched the LED through a GPIO.

Frequency Monitor

I used an Arduino Uno to monitor the frequency of the mains AC supply.

Instead of lighting an LED, here the zero crossing pulse was fed to the Arduino interrupt pin. Using by recording the time between two zero-crossing pulses, my Arduino sketch calculated the frequency of the AC supply waveform.

To view the calculated frequency values, the Arduino needed to communicate over Serial UART. Since Serial communication caused a delay in the frequency detection, I modified the sketch to sample the frequency for 10 seconds and then using Serial send the average frequency calculated over that period.

By doing this, I was able to get near-realtime frequency values from the Arduino. I used these values received over Serial to plot a realtime graph of the signal Frequency using Processing.

Phase Angle Control based Dimmers

I used a triac to implement a Phase Angle Control operation on the waveform.

Phase Angle Control involves cutting off a part of each Sine wave, based on the intended output.

Using the zero-crossing detection and calculating the time delay between zero-crosses, I controlled the gate trigger of the Triac with a pulse at a calculated time interval after the zero-crossing detection. This let me vary the output power by changing the delay before the triac trigger

I supplied this controlled waveform to a incandescent bulb and the result was a controlled dimming.

Further, I used Processing to send the intended bulb brightness to the Arduino over Serial. The Arduino stored the received value and accordingly adjusted the trigger delay.

This project was purely out of curiosity at the time, but the experience really helped me with the development of my Home Automation Product a few years later.

The process of developing the circuit involved a lot of trial & error and debugging, which led me to understand a lot about hardware and circuit design.

My PCB for Zero-cross Detection and Dimming A correction on the PCB How it worked Setting it up The frequency plot from Processing (49.9 Hz to 50.1 Hz) First run of the Dimmer

Using a GUI with the Dimmer

## Get In Touch

• Pune (MH), India
• ranjitbhinge@gmail.com