Thursday, 23 April 2020

Wireless DC Motor Speed and Direction Control using Arduino with IR Remote


Please Subscribe For More Project Videos --► http://bit.ly/29vPrS9
PROJECT VIDEO LINK:

Please Subscribe For More Project Videos --► http://bit.ly/29vPrS9
Block diagram:
 Please Subscribe For More Project Videos --► http://bit.ly/29vPrS9
 Please Subscribe For More Project Videos --► http://bit.ly/29vPrS9
SAMPLE SOFTWARE CODE:
----------------------------------------
#include <IRremote.h>
const int RECV_PIN=11;
IRrecv irrecv(RECV_PIN);
decode_results results;
///////////////////////////////////////////////////////////
int P1=A0;
int P2=A1;
int P3=A2;
int P4=A3;
int P5=A4;
///////////////////////////////////////////////////////////
int aa=0;int bb=0;
int PWM1Pin = 9;
int PWM2Pin = 10;  
int motor1Speed = 0;
int motor2Speed = 0;
int fr=0;
int br=0;
///////////////////////////////////////////////////////////
void setup()
{
pinMode(P1, OUTPUT);
pinMode(P2, OUTPUT);
pinMode(P3, OUTPUT);
pinMode(P4, OUTPUT);
pinMode(P5, OUTPUT);

irrecv.enableIRIn();
irrecv.blink13(true);
analogWrite(PWM1Pin, motor1Speed);analogWrite(PWM2Pin, motor2Speed);
digitalWrite(P1,LOW);digitalWrite(P2,LOW);digitalWrite(P3,LOW);
digitalWrite(P4,LOW);digitalWrite(P5,LOW);
}
///////////////////////////////////////////////////////////
void loop() 
{
if (irrecv.decode(&results)) 
{
delay(100);
///////////////////////////////////////////////////////////////////////////
if(results.value==0x11111111)////forwad
{
fr=1;br=0;aa=bb;
}
///////////////////////////////////////////////////////////////////////////
if(results.value==0x22222222)////backward
{
br=1;fr=0;bb=aa;
}
///////////////////////////////////////////////////////////////////////////
if(fr==1)
{
if(results.value==0x33333333)
{
aa=aa+1;br=0;
}
///////////////////////////////////////////////////////////////////////////////////////////////
if(results.value==0x44444444)
{
aa=aa-1;br=0;
if(aa<0){motor1Speed=0;motor2Speed=0;
analogWrite(PWM1Pin, motor1Speed);
analogWrite(PWM2Pin, motor2Speed);
aa=0;digitalWrite(P1,LOW);
digitalWrite(P2,LOW);
digitalWrite(P3,LOW);
digitalWrite(P4,LOW);
digitalWrite(P5,LOW);}
}
}
///////////////////////////////////////////////////////////////////////////
if(br==1)
{
if(results.value==0x55555555)
{
bb=bb+1;fr=0;
}
///////////////////////////////////////////////////////////////////////////////////////////////
if(results.value==0x66666666)
{
bb=bb-1;fr=0;
if(bb<0){motor1Speed=0;motor2Speed=0; 
analogWrite(PWM1Pin, motor1Speed);
analogWrite(PWM2Pin, motor2Speed);
bb=0;digitalWrite(P1,LOW);
digitalWrite(P2,LOW);
digitalWrite(P3,LOW);
digitalWrite(P4,LOW);
digitalWrite(P5,LOW);}
}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(results.value==0x7777777)
{
motor1Speed=0;motor2Speed=0; analogWrite(PWM1Pin, motor1Speed);analogWrite(PWM2Pin, motor2Speed);aa=0;bb=0;br=0;fr=0;
digitalWrite(P1,LOW);digitalWrite(P2,LOW);digitalWrite(P3,LOW);digitalWrite(P4,LOW);digitalWrite(P5,LOW);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
irrecv.resume(); // Receive the next value
delay(100);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Please Subscribe For More Project Videos --► http://bit.ly/29vPrS9 Slice--►http://www.svskits.in/ blog --►http://www.svskit.com/ site --►http://www.svsembedded.com/ ------------------------------------------------------------------------- ✽ FOLLOW ME! Twitter: --►https://bit.ly/2Vms5Eq Facebook: --►https://bit.ly/2wyQkH0 linkedin: --►https://bit.ly/3ekwccQ flickr: --►http://bit.ly/29nunKE Pinterest: --►http://bit.ly/29A4Ocq Thumbs up if you want to see more projects! *What would you like to see next?! Links: Android projects:--► http://bit.ly/29nlAs5 GSM Based Projects:--► http://bit.ly/29nA0Y7 Bluetooth Based Projects:--► http://bit.ly/29G93nV women safety projects:--► http://bit.ly/29BEhNv Touchscreen+Restaurant:--► http://bit.ly/29tB2oz LabVIEW Projects:--► http://bit.ly/29IlY8W Agriculture Projects:--►http://bit.ly/29ATa0z Touch Screen Home Automation:--►http://bit.ly/29po3RN IOT Based Projects:--►http://bit.ly/29Cai60 ♥ Business Email:--► info@svsembedded.com, Email:--► svsembedded@gmail.com *Feel free to send me a mail about u r project abstract/synopsis! :]

No comments:

Post a comment