AC Box - AC Phase Control by using Arduino

Title: AC Box

I have built a box working with Arduino to adjust AC output by using phase control. The first part of the circuit lets Arduino know when AC zero crossing happens, then calculates the average time length between two consecutive crossings from three measurements. This time length approximately equals to half of an AC sine wave. If there is a desired AC phase that we want the Triac to be triggered, we can let Arduino send a pulse to the second part of the circuit to do the job, and repeat it every half of an AC sine wave. This means you can do a lot of AC phase control applications. For example, a temperature sensor, a step motor, a step motor driver and an AC power furnace can be put together to make a perfect BBQ machine. Two wireless drivers (like xbee) and a light (or AC fan) can work as a wireless phase control system for light dimmer (or fan speed control). Such applications can be realized through either a computer or the Arduino itself.

Keyword: AC phase control, Arduino, light dimmer, AC motor speed control

!!!Warning: This circuit is mixed with AC and DC. You need to know what you do. You must be careful when you try this circuit. If you do something wrong, the mistake can lead to damage. If you want to watch AC waveform from this circuit, one by one isolator transformer is recommended for safe purpose.

Part List
1x Arduino
Vcc: 5 Vdc

For Zero Crossing to Arduino Circuit

Resistor
01, 02, 03, 04: 100k ohm
05: 470 ohm
06: 10k ohm
07: 5.6k ohm

Diode
01, 02, 03, 04: 1N4002

Transistor
01: 2N3904

Optoisolator
01: H11A1

LED
Normal LED

For Arduino to Vac Triac Circuit

Resistor
08, 09, 11, 12, 13, 14, 15, 16, 17, 18: 1k ohm
10: 5.6k ohm

Optoisolator
02: MOC3063

Capacitor
01: 33nF

Triac
01: MAC15DG

Code for Arduino

The AC phase control code is written by ryanjmclaughlin and koyaanisqatsi. If you want to know more detail, you can follow this link http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236998971.

Pins of Arduino are uses:
Analog Pin:01, 02, 03, 04 (You can set values to replace this option.)
Digital Pin 02: detect zero crossing.
Digital Pin 04, 05, 06, 07: Phase control outputs

Result

AC to Zero Crossing

Input value: 975

Input value: 825

Input value:550

Input value:225

The relation: Input value V.S. Power output

If you use this circuit for high current applications, don't forget add a heat sink and fan for your Triac.

There are several pictures on my flickr. If you have interest, you can follow this link http://www.flickr.com/photos/ac_box/sets/72157617089567963/.

Hey, that's pretty cool. A good way to test out whether triac dimming would work for a particular device.

Sorry, I made a mistake at the arduino to triac circuit. Here is a correct circuit.

Thanks for your work on this, I had been been examining doing something like this for xmas/halloween outside the house, but never got around to it.

Old thread, I know, but I'm also looking at using the Arduino to measure mains frequency via zero crossing.

I have a couple questions on your zero-crossing circuit :slight_smile:

  1. Why the four 100k resistors in parallel? Is this for power dissipation?
  2. Why the transistor connected to the output of the optoisolator? Couldn't you just connect the arduino pin straight here?

Grateful for any replies!

Thanks