firing angle control for an SCR

Dear friends

I have an arduino mega board and I used an op-amp as a zero crossing detector, the signal generated by the op-amp is then injected into a digital pin to read it, but unfortunately the signal has dropped to a small value.

What I want is to read the signal from the op-amp then after some time"using delay command " I get a pulse.

By the way, I used a pull down and Pull up resistors.

What’s wrong?

can anybody explain what happened?

Please post your schematic.
A picture of a hand-drawn circuit diagram is fine.

Pieter

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

I'm sorry because I've just subscribed .

int pi=30;
int po=26;

void setup() {

Serial.begin(9600);
pinMode(pi,INPUT);
pinMode(po,OUTPUT);
}

void loop() {
int m=digitalRead(pi);
if(m==HIGH)
{

delay(5);
digitalWrite(po,HIGH);
Serial.println("5V");
delay(2);
digitalWrite(po,LOW);
}
else
{
digitalWrite(po,LOW);
Serial.println("0V");
delay(500);
}}

It seems you didn't read the link in #2 (or you would have known how to post code properly - i.e. use code tags around it - and please format it properly, do CTRL-T in the IDE), and you also didn't post the circuit diagram as requested, without which it's pretty hard to see what's going on.

We also need to see you schematic.

but unfortunately the signal has dropped to a small value.

How do you know that? i.e. Do you have an oscilloscope? …That 5mS pulse could measure very-low on a multimeter, especially if it’s followed by a 500mS delay.

Are you seeing any indication of any switching on the serial monitor? (BTW - The serial.print statements take-up time and could possibly mess-up your timing.)

Your code should be enclosed in code tags which you can get by clicking the menu icon that looks like this: </>

Then your code will look like this:

int pi=30;
int po=26;

void setup() {

  Serial.begin(9600);
pinMode(pi,INPUT);
pinMode(po,OUTPUT);  .....

Re: firing angle control for an SCR

Angle relative to what? …That 500mS delay is awfully long relative to 50/60Hz line frequency. And, if we’re talking about power line voltage it needs to be electrically isolated (optically with a transformer) from the Arduino on both the phase-sensing input and the SCR-controlled output. And, an SCR only conducts in one direction so it only works on half of the AC waveform. (Light dimmers & motor speed controllers usually use TRIACs.)