+21622886281
Arduino Car Project

Construction of a remote control car with Arduino

Purpose of this project:

In this project we will build a remotely controlled car (by infrared) controllable by the Arduino board.

The user will be able to drive the car by a remote control in three directions (forward, right and left) and stop it.

necessary components

  • Arduino
  • Two relays
  • Remote control
  • IR sensor
  • connecting wires
  • two wheel
  • car chassis
  • two DC motor
  • one wheel

Construction of the car

Assembly of the car with Arduino

Pour réaliser le montage, on peut connec ter:

 For first relay:

  • (S) pin to pin 2 of Arduino
  • (+) pin to 3.3V pin of Arduino
  • (-) pin to GND pin of Arduino
  • ON pin to 5V pin of Arduino

 For second relay:

  • S) pin to pin 3 of Arduino
  • (+) pin to 3.3V pin of Arduino
  • (-) pin to GND pin of Arduino
  • ON pin to 5V pin of Arduino

For each of the two motors:

  • first terminal to COM pin of relay
  • second terminal to GND pin of Arduino

For IR sensor:

  • OUT pin to pin 4 of Arduino
  • (+) pin to 3.3V pin of Arduino
  • GND pin to GND pin of Arduino

Program

Here is the program for the Arduino connected to the car:

#include <IRremote.h>
int RECV_PIN = 4;
IRrecv irrecv(RECV_PIN); // IR sensor connected to pin 4 of Arduino
decode_results results;

const int relais_moteur1 = 2; // relay connected to pin 2 of  Adruino
const int relais_moteur2 = 3; // // relay connected to pin 3 of  Adruino

void setup()
{ irrecv.enableIRIn(); ////Initializes the infrared receiver
pinMode(relais_moteur1, OUTPUT);
pinMode(relais_moteur2, OUTPUT);
}

void loop()
{ if (irrecv.decode(&results)) {
if (results.value==0xFF18E7)//press the 2 key
{
digitalWrite(relais_moteur1, HIGH);// the car is moving forward
digitalWrite(relais_moteur2, HIGH);
}
if (results.value==0xFF5AA5)//press the 6 key
{
digitalWrite(relais_moteur1, HIGH);
digitalWrite(relais_moteur2, LOW); // the car is moving right
}
if (results.value==0xFF10EF)//press the 4 key
{
digitalWrite(relais_moteur1, LOW);
digitalWrite(relais_moteur2, HIGH); //the car is moving left
}
if (results.value==0xFF38C7)// press the 5 key
{
digitalWrite(relais_moteur1, LOW);// car stops
digitalWrite(relais_moteur2, LOW);
}
irrecv.resume(); // Get the following value
}

}




0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top