Arduino scr connection

Arduino Controlling Low-Voltage Driveway Lights

by 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.

pulsating DC
Full wave pulsating DC.

In the main circuit diagram above transformer T1, D1, and D3 produce a positive going pulsating DC with a peak voltage of about 18 volts and a frequency of 120 Hertz. Diode D2 blocks the filtering effect of capacitor C2, which with U2 supplies positive five volts for the microcontroller. See Basic AC Rectification and Filtering



Zero crossing pulse
Zero crossing pulse from 4N25 in relation to AC sine wave.

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)

full-wave unfiltered D.C.
This illustrates to process with full-wave unfiltered D.C.

CdS photocell R6 and R3 form a voltage divider. As light intensity increases the resistance of R6 decreases causing the voltage to rise at the junction of R3, R6, and analog to digital converter pin Ad0 on the controller. (R3 can be a 10k resistor, which is what I used.) When read by the program this 10-bit AD converter will produce a value between 0 and 1023. This value is used in a delay routine to determines the firing point of the SCR. The longer the delay, the less power to the LED strings and less light output. See Using a CdS Photocells

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.
Arduino  using MOC3010 series triac opto-coupler
Same schematic using MOC3010 series triac opto-coupler.



 
// 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: