BI DIRECTIONAL AND SPEED CONTROL OF AC MOTOR USING ARDUINO

HARDWARE

SIMULATION IN PROTEUS

WORKING
IN THIS PROJECT WHEN THE SMOKE IS DETECTED SPEED OF MOTOR WILL BE INCREASED USING TRIAC AND TWO TEMPERATURE SENSOR ARE USED TO SENSE THE TEMPERATURE OF ROOM AND TEMPERATURE OUTSIDE OF ROOM .IF ROOM TEMPERATURE IS MORE THAN OUTSIDE TEMPERATURE ,AIR FROM THE ROOM WILL BE PUSHED TO OUTSIDE WORLD BY CHANGING THE DIRECTION OF MOTOR USING RELAYS AND VICE-VERSA
CIRCUIT
PROGRAM -ARDUINO
#define relay1 2
#define relay2 3
#define tempsensor1 A5
#define tempsensor2 A4
#define gassensor A3
#define pot A2
#define zerocrossingpin A0
#define triacpin 9
int temperature1,temperature2,gas,temperature_difference1,temperature_difference2;
int temperature_threshold;
int a,i;
int rotating_direction=0;

void setup()
{
pinMode(zerocrossingpin,INPUT_PULLUP);//ZERO CROSSING INPUT
pinMode(gassensor,INPUT_PULLUP);
pinMode(triacpin,OUTPUT);//OUTPUT

pinMode(relay1,OUTPUT);pinMode(relay2,OUTPUT);
digitalWrite(relay1, HIGH);   digitalWrite(relay2, HIGH);
  digitalWrite(triacpin, HIGH); delay(2000);
Serial.begin(9600);  Serial.println("hii");
}
void loop()
{
temperature1 = analogRead(tempsensor1)/2;//delay(1);
temperature2 = analogRead(tempsensor2)/2;//delay(1);
temperature_threshold= analogRead(pot)/32;//delay(1);
//if(temperature_threshold>4){Serial.print("temperature_threshold");Serial.println(temperature_threshold);}
//Serial.print("temperature=");Serial.println(temperature);
//Serial.print("temperature 2=");Serial.println(temperature2);
gas = analogRead(gassensor);//delay(1);


if(gas<200 && ( rotating_direction==1) )
{
stop_motor();  
digitalWrite(relay1, HIGH);   digitalWrite(relay2, HIGH);
rotating_direction=0;delay(100);
digitalWrite(triacpin, HIGH); delay(2000);
}

else if(temperature1 > temperature2 )
{
temperature_difference1=temperature1-temperature2;
if((temperature_difference1>temperature_threshold) &&( rotating_direction==1) && (temperature_threshold>4) )
{
//Serial.print("temperature_difference 1=");Serial.println(temperature_difference1);
stop_motor();
digitalWrite(relay1, HIGH);   digitalWrite(relay2, HIGH);
rotating_direction=0;delay(100);
digitalWrite(triacpin, HIGH); delay(2000);
}}

else
{
temperature_difference2=temperature2-temperature1;
if(temperature_difference2>temperature_threshold && rotating_direction==0 && (temperature_threshold>4))
{
Serial.print("temperature_difference 2=");Serial.println(temperature_difference2);  
stop_motor();
digitalWrite(relay1, HIGH);   digitalWrite(relay2, LOW);
rotating_direction=1;delay(100);
digitalWrite(triacpin, HIGH); delay(2000);
}}
gassection();
}



void gassection(void)
{
if(gas<200)
{
digitalWrite(triacpin, HIGH);
Serial.print("GAS=");Serial.println(gas);  
}
else
{
waitfornextzerocrossing ();delay(4);
digitalWrite(triacpin, HIGH); delayMicroseconds(100);   digitalWrite(triacpin, LOW);
}
}


void stop_motor(void)
{
digitalWrite(relay1, LOW);   digitalWrite(relay2, LOW);
delay(5000);      
}



void waitfornextzerocrossing (void)
{
 do
   {
     a =digitalRead(zerocrossingpin);
   }
   while(!a); //wait until zero reaches
}
   


WAVE FORMS 

  • BLUE -ZERO CROSSING DETECTOR OUT 
  •  YELLOW - TRIAC GATE PULSE ABOUT 100 DEGREE FIRING ANGLE



  • YELLOW - INPUT AC VOLTAGE TO TRIAC
  • BLUE - OUTPUT AC VOLTAGE TO TRIAC


MAIN COMPONENTS