SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By webtuto
#195481
Hi everyone,

I am making an arduino project to heat a heater (LAMP in my example ) using thyristor, it is working fine, but the only problem is the frequency.

when i give a frequency of 1 Hz in the Pulse R3(2) the curve is perfect, but when i change the frequency to 50 Hz, the curve become disturbed, and unfortunately i want to use the frequency of 50 Hz.

Im attaching the circuit.

the code :
Code: Select all
float value = 1;

void setup() {
  
  Serial.begin(9600);
  
  pinMode(13, OUTPUT);
}


void loop() {
  
  int sensorValue = analogRead(A0);
  
  float voltage = sensorValue * (5.0 / 1023.0);
  
  Serial.println(voltage);

 
  if (voltage > value) { 

delay(200); 

digitalWrite(13, HIGH); 

Serial.println("UP"); } else { 

digitalWrite(13, LOW); 

}

  
}
thanks alot
By webtuto
#195494
I forgot to attach the circuit , I attached it in this response
You do not have the required permissions to view the files attached to this post.
By n1ist
#195495
In the schematic, there are some major safety issues to watch out for when you go from a simulation to something that's really connected to the AC mains. You will need another optoisolator to isolate the triac's gate drive, and you must not have a common ground between the AC powered side and the arduino. Failure to do this could be lethal.

Also, if probing this circuit with a real oscilloscope, watch out for ground loops. Ground on a scope probe most of the time is connected back to AC line ground.

/mike
By webtuto
#195497
ok i attached the new circuit , i hope it is what you were aiming for

the problem is that the pulse that the triac (thyristor) getting is not sinosoidal , so it wont work in my case , since i want the output to be like the yellow pulse in my first attachment
You do not have the required permissions to view the files attached to this post.
By n1ist
#195500
No, this one would go bang...

- U3 needs to go between the SCR/triac and the arduino. It can't go across the AC line.
- There is a common "ground" symbol on the AC side (U3 pin 2) and all over the low voltage side. Making this connection can blow up your scope, PC, or you.

While experimenting with this, make sure you use an isolation transformer to power it for safety.

As for the gate pulse, it shouldn't be a sine wave. Thyristors and triacs turn on with a pulse, and off when the current through them goes to 0. You just need to generate a brief pulse a certain delay from the zero cross. The delay determines the duty cycle and how much heat you will get from your load.

Look at http://www.instructables.com/id/Arduino ... e-circuit/ for some pointers.
By webtuto
#195509
hi , thanks for the answers

I tried to follow your guidelines and i come up with the circuit im attaching

the arduino code i used is
Code: Select all
int AC_LOAD = 9;    // Output to Opto Triac pin
int dimming = 128;  // Dimming level (0-128)  0 = ON, 128 = OFF

void setup()
{
  pinMode(AC_LOAD, OUTPUT);// Set AC Load pin as output
  attachInterrupt(0, zero_crosss_int, RISING);  // Choose the zero cross interrupt # from the table above
}

//the interrupt function must take no parameters and return nothing
void zero_crosss_int()  //function to be fired at the zero crossing to dim the light
{
  // Firing angle calculation : 1 full 50Hz wave =1/50=20ms 
  // Every zerocrossing thus: (50Hz)-> 10ms (1/2 Cycle) 
  // For 60Hz => 8.33ms (10.000/120)
  // 10ms=10000us
  // (10000us - 10us) / 128 = 75 (Approx) For 60Hz =>65

  int dimtime = (75*dimming);    // For 60Hz =>65    
  delayMicroseconds(dimtime);    // Wait till firing the TRIAC
  digitalWrite(AC_LOAD, HIGH);   // Fire the TRIAC
  delayMicroseconds(10);         // triac On propogation delay (for 60Hz use 8.33)
  digitalWrite(AC_LOAD, LOW);    // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC
}

void loop()  {
  for (int i=5; i <= 128; i++){
    dimming=i;
    delay(10);
   }
}
but the output (the yellow wave) is not what im aiming for .

the first problem is that it is cutting only the positive wave

the second problem is that the angle of cutting change

Thanks
You do not have the required permissions to view the files attached to this post.