Dejan Levec

AC Switching By Computer


I’m building a device for switching AC devices by computer program through USB. It could be used for light show, home automation system, etc.

I’ll be using 8 triacs with 8 opto-triacs (to protect microcontroller and computer from direct contact with AC line).

I haven’t build it yet because I don’t have every part needed at home. Finished circuit and working code should be published in a few days.


Short: When electric current is present on gate triac is triggered and the device conduct AC current between terminal 1 and terminal 2.

I chose triac because it’s silent and faster than relay. Opto-triac is used to trigger triac without any risk of destroying any other elements on DC side.


a) Circuit for triac and opto-triac:

Pin 1 on MOC2061 connects through 330ohm resistor to microcontroller pin and pin 2 connects to ground.
b) Whole circuit it’s not yet available … will be soon.

Parts list

– 8x MOC3061 (opto-triac)
– 8x BT139 (triac, up to 16A, 600V)
– 1x ATmega8
– 1x 28-pin socket
– 1x 12 or 16 MHz quartz
– 16x 360 ohm resistor (for triggering triac)
– 8x 39 ohm resistor
– 8x 0.01 uF 400V!! capacitor
– 8x 330 ohm resistor (for controlling opto-triac)
– 1x 10k ohm resistor (pull-up for reset pin on microcontroller)
– 2x 3.3V or 3.6V zener diode (for USB connection)
– 2x 68 ohm resistor – 1x 1,5k ohm resistor (pull-up for USB D- line)
– 1x USB type B jack (not necessary)
– 1x 10uF capacitor
– 2x 10pF – 20pF capacitor


It’s not finished because I firstly need all components. For USB communication V-USB firmware-only implementation will be used.

Leave a Reply

Your email address will not be published. Required fields are marked *