frequency problem [ HELP ]

Hi everyone,

I am making a project to heat a heater 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 :

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

Please post your code.

it is attached (picture) , but i will post it here :

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); }
  
  

  

  
  
}

it is attached (picture)

We can't compile a picture.

I won't even try to guess what your code does when I have to scroll back and forth because you won't follow the convention of ONE STATEMENT PER LINE.

sorry , i edited the thread

webtuto: sorry , i edited the thread

I don't help people that do THAT, either.

its okey, thank you friend , hope someone else can help me

What, exactly is doing the heating (“L1”)?

jremington: What, exactly is doing the heating ("L1")?

the heater in the circuit is the Lamp , ( to see if it will shine or no ) , the pulse R3(2) [ 230V and 1Hz] is giving a pulse that goes throught the zero crossing detector (its pulse is in green), then i send the output to arduino to analog A0, and give back a pulse from the output pin 13 to the thyristor , the output pulse is in yellow

webtuto: 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.

I'm not sure what you're expecting, but that's how thyristors work. You can't do high speed PWM with them, everything is based on the timing of the zero crossings. Phase angle control is going to cause the output waveform to be significantly distorted.

Jiggy-Ninja: I'm not sure what you're expecting, but that's how thyristors work. You can't do high speed PWM with them, everything is based on the timing of the zero crossings. Phase angle control is going to cause the output waveform to be significantly distorted.

so is there something i have to change to be able to use the 50 Hz frequency ?

Your circuit looks hazardous as there is no isolation between the Arduino and the mains. This could have lethal consequences. Depending on the neutral side to be grounded is not an acceptable solution.

webtuto: so is there something i have to change to be able to use the 50 Hz frequency ?

No. You have to wait until a zero crossing is detected then do a delay before giving the thyristor a pulse. That delay is changed to change the power.

As well as being a death trap you have no current limiting in the gate circuit so it is a toss up who dies first. You or the thyristor.

Also your circuit shows no ground connection to the Arduino, but perhaps that is just as well given the rest of the circuit.

You or the thyristor.

You AND the thyristor would be another possibility.

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

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

Inline image: |500x229

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

Because you're using an SCR, not a TRIAC.

the second problem is that the angle of cutting change

Elaborate, that's not telling us what's wrong.

OK still lethal still crap. But the simulation is right. You will only be able to control half a cycle with an SCR.

If you know so little you should not be playing with mains when it is clearly beyond your current capabilities.