Go Down

Topic: SCR gate controller circuit (Read 1 time) previous topic - next topic

nesh_reds

i think this is my 3rd post on this topic.... But i need an urgent help.. I have done my program and had the output from arduino. I have problem that the firing point is faster then usual. . I am using a potentiometer to vary the pulse position... wen i start varying the potentiometer, the skips around 30 degrees. Eg, at 90 degree's of the sine.. i m getting 60 degrees displayed on my LCD... I have included the pic of my output pulse on 0 degrees.. I hope I can guided on this... this is my output pic and code...


#include <LiquidCrystal.h>

/*
The circuit:
*LCD RS pin to digital pin 8
*LCD Enable pin to digital pin 9
*LCD D4 pin to digital pin 4
*LCD D5 pin to digital pin 5
*LCD D6 pin to digital pin 6
*LCD D7 pin to digital pin 7
*LCD R/W pin to ground
*/


LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

byte degree[8] = {
B00110,
B01001,
B01001,
B00110,
B00000,
B00000,
B00000,
};

int zcdPin = 0; //pin 2
int potPin = A0;
int sensorValue = 0;
int outputValue = 0;
int alpha;
int d;
int scrPin1 = 10;
int scrPin2 = 11;


void setup (){
lcd.begin (16, 2);
lcd.print("FYP 2012/2013");
lcd.createChar(1, degree);
attachInterrupt (0, ZCHandler, FALLING);
}

void loop (){
sensorValue = analogRead(potPin);
alpha = sensorValue/5.68;
d = (sensorValue*5)*1.955;
lcd.setCursor(0,1);
lcd.print("a:");
lcd.print(alpha);
lcd.write(1);
lcd.setCursor(8,1);
lcd.print("d:");
lcd.print(d);
lcd.print("ms");
}

void ZCHandler(){
 digitalWrite(scrPin2, LOW);
 delayMicroseconds(d);
 digitalWrite(scrPin2, HIGH);
 delayMicroseconds(1000);
 digitalWrite(scrPin2, LOW);
}
 

pylon

I have no clue what your post is about. You should describe the problem or if you've done that in an other thread include a link to it.

Code must be enclosed by code tags (use the hash sign button in the editor), else it gets changed by the forum system.

In your code you have at least two major problems:

1. Variables used in interrupt and standard context must be declared "volatile" (d).

2. Your scrPins aren't declared as outputs.

nesh_reds

Ok.. i will correct my mistakes.. the problem i am facing is that the pulse doesn't fire starting from 0 degrees of the sine wave when i set it as 0 degrees.. It begins before the zero point as it shown in the picture attached. the moment i start to vary my potentiometer to vary the pulse position, it jumps and starts at nearly 30 degrees which means, at 90 degree sine mark, my LCD is displaying 60 degress

pylon

Did you fix the two problems I mentioned?

BTW: you print d in ms to the display but use delayMicroseconds() in the sketch.

nesh_reds

Yes.. i have changed.. The to scrpins to volatile and the d as well. the ms part i haven change yet.. suppose to create the byte array like for the degree sign. for now I much more worried on the output of the pulse.

pylon

How did you connect the sine wave to the Arduino? Is the sine wave going from 0V to 5V or from -5V to 5V?

delayMicroseconds() can be called with values up to 13107, if you call it with higher value you'll have a bit overrun. So calling it with 14108 is about the same as calling it with 1000.

nesh_reds

#6
May 09, 2013, 03:32 pm Last Edit: May 09, 2013, 03:34 pm by nesh_reds Reason: 1
I have use a zero crossing detector circuit. Before I connect into the arduino, the value gives a high at the negative cycle and a low at the positive. But the moment I connect it to arduino pin, the value of the zero crossing is giving me negative value instead of a zero. Which I think is the cause for the delay and the irregularities of scr firing angle. this is the circuit I am using. its a PSIM simulation therefore the optocoupler is a standard type. I am used 4n25 at 1st then now i changed it into H11aa1. It gives me the same result

dc42

What is driving the zero crossing circuit? As you don't have a diode connected in reverse across the opto isolator input (to protect it against reverse voltage), I presume you are feeding it with low voltage from a transformer. If so, then you will probably get some phase shift in the transformer, which could explain what is going wrong. A solution would be to feed it directly from the mains (with a suitably-increased value series resistor of sufficient voltage rating, and the protection diode added) - but only if you are comfortable with doing mains-voltage wiring.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

lockinamp

Did you consider a mosfet? I always thought SCR's were kinda jumpy. :)

nesh_reds


What is driving the zero crossing circuit? As you don't have a diode connected in reverse across the opto isolator input (to protect it against reverse voltage), I presume you are feeding it with low voltage from a transformer. If so, then you will probably get some phase shift in the transformer, which could explain what is going wrong. A solution would be to feed it directly from the mains (with a suitably-increased value series resistor of sufficient voltage rating, and the protection diode added) - but only if you are comfortable with doing mains-voltage wiring.


Thanks you very much... I would try adding resistors and the protective diode as you mentioned.

nesh_reds


Did you consider a mosfet? I always thought SCR's were kinda jumpy. :)


My project is based on SCR....

pylon

Did you understand my comment about delayMicroseconds()? You don't check for that limit in your code yet.

nesh_reds


Did you understand my comment about delayMicroseconds()? You don't check for that limit in your code yet.


yes... i have changed it to 100 which was sufficient to fire the SCR.

Go Up