|
Controlling Low-Voltage Driveway Lights with the ATMEGA168/Arduinoby Lewis Loflin In this circuit we demonstrate how to use SCRs to control low-voltage pulsating DC to operate homemade LED light panels. While in this circuit I use the Arduino, the concepts should work with any number of micro-controllers using either hardware interrupts or polling. We must use pulsating DC or the SCR won't operate properly. See Basic SCRs/Triacs.
The 4N25 opto-coupler provides a narrow 120 Hertz pulse at zero and 180 degrees of the sine wave. This pulse is fed to digital pin 2 (DP2) of the controller to trigger an interrupt when the sine wave passes zero and 180 degrees. (There's 360 degrees in a sine wave.) See 4N25 Opto-Coupler (PDF file)
When the power on switch is pressed at DP4 a 100 uSec. positive-going pulse is sent to the H11C6 opto-coupler through a 470 ohm resistor. This in turn fires the SCR at the desired time during the delay time 120 times per second. The H11C6 contains a LED light source used to fire the light activated silicon-controlled rectifier (LASCR) in order to fire the main power SCR Q1. R5 limits the gate current of Q1 while R7 and R8 limit the current in the LED strings. See H11C6 spec sheet. (PDF file) The LED strings are composed of four high intensity white LEDs in series. At 3 to 3.5 volts each four in series operate at 12-14 volts. Q1 used in this test was a S4015L 400 volt SCR that can handle 15 amperes of current. That can handle a lot of LED strings.
// LED must be connected between digital pin and ground #define triac_control 5 #define powerIndicator 12 // indicator #define sensorPin 0 // potentiometer #define irq_Pin 2 #define powerOn 4 // when using values in the main routine and IRQ routine must be volatile value volatile byte flag_bit1 = LOW; // declare IRQ flag int analogValue = 0; // HIGH = 1, LOW = 0 void setup() { pinMode(triac_control, OUTPUT); pinMode(powerIndicator, OUTPUT); digitalWrite(triac_control, 0); // LED off digitalWrite(powerIndicator, 0); // LED off pinMode(irq_Pin, INPUT); pinMode(powerOn, INPUT); digitalWrite(irq_Pin, 1); // pull up on digitalWrite(powerOn, 1); // pull up on attachInterrupt(0, flag1, FALLING); // interrupt 0 digital pin 2 connected ZC circuit } void loop() { if (!digitalRead(powerOn)) digitalWrite(powerIndicator, 1); else digitalWrite(powerIndicator, 0); if ((flag_bit1 == 1) && (digitalRead(powerOn)== 0)) { analogValue = analogRead(sensorPin); delayMicroseconds(analogValue * 7 + 500); // set value between 4 and 14 digitalWrite(triac_control, 1); //triac on delayMicroseconds(100); digitalWrite(triac_control, 0); //triac off flag_bit1 = 0; // clear flag } } // end loop void flag1() // set bit { flag_bit1 = 1; } You Tube Arduino Microcontroller Video Series March 2012:
Arduino demos:
» About me » Bristol VA/TN » E-Mail » Hobby Electronics » Arduino Microcontroller
General Electronics
Added January 2012: PICAXE Micro-controller Projects!The PICAXE series of micro-controllers rank as the easiest and most cost effective way to use Microchip processors. I wanted an easier and less expensive way to introduce my students to the "PIC" micro-controller. Here I hope to get those starting out past poorly written literature and lack of simple working code examples.
|