Infrared remote control four wheel car

Infrared remote control four wheel car

Introduction

Today we use a 8-channel relay module to make a four-wheeled car. When press 4 keys(2,4,6,8) on the remote control, and you will see the car forward, back, left and right.

Components

- 1 * Adeept UNO R3 Board

- 1 * Adeept IR Receiver Module

- 1 * Remote Controller Module

- 1 * 8 Channel Relay Module

- 4 * DC Motor

- 1 * 18650 battery box

- 2 * 18650 lithium battery

- 1 * Adeept Acrylic plate

- 4 * Wheel

- 9 * M3*30 Screw

- 10 * M3 Nut

- 1 * 4-Pin Wires

- 10 * Male To Female Jumper Wires

Some Jumper Wires

Experimental Principle 

The 1838B IR Receiver is a 38KHz IR receiver that can receive signals modulated by a standard 38KHz remote control. By programming the Arduino UNO R3 board, we can decode the signals.

The Fritzing image:

Pin definition:

The schematic diagram:

In this experiment, by programming the Arduino board, we encode the data received by the IR Receiver that is sent by the remote control, and display the deciphered data on Serial Monitor via the serial port. In the program, we use the Arduino-IRremote-master library (provided).
Note: 
Before using this library, you have to delete the RobotIRremote directory in your Arduino IDE directory (check in IDE by File->Preference, and see the path in the Browse dialog box), and delete the RobotIRremote directory in the system Documents folder. For example, if your computer is running on Windows 7, you need to delete the RobotIRremote
Directory in
C:\ProgramFiles(x86)\Arduino\libraries and C:\Users\SJG\Documents\Arduino\libraries.
Otherwise, when you compile the program, errors will be prompted.

This is a 5V 8-channel replay interface board which is able to control various appliance, and other equipments with large current. It can be controlled directly by Microcontroller(Arduino,8051,AVR,PIC,DSP,ARM,MSP430,TTL logic). 5V 8-Channel reply, interface board, and each one needs 15-20mA driver current. It equippes with high-current relay AC250V 10A and DC30V 10A also screw holes to install easily.

Experimental Procedures
Step 1: Build the circuit

Step 2: Install the function library (Arduino-IRremote-master.zip).
Please refer to this article:https://www.adeept.com/blog/problem-for-ir-remote-controller_b0024.html
Step 3: Program  AdeeptLCD12864SPI.ino

/***********************************************************
File name: Adeept8RelayCarCode.ino
Description: Use 8 Channel relay module to make a 4-wheel car. 
When press 4 keys(2,4,6,8) on the remote control, and you will 
see the car forward, back, left and right.
Website: www.adeept.com
E-mail: support@adeept.com
Author: Tom
Date: 2017/01/04
***********************************************************/
#include <IRremote.h>

int RECV_PIN = 11;//The definition of the infrared receiver pin 11
IRrecv irrecv(RECV_PIN);
decode_results results;
int temp = 0;
void setup() {
   irrecv.enableIRIn(); // Initialization infrared receiver
   pinMode(3, OUTPUT);          // Control the first relay
   pinMode(4, OUTPUT);          // Control the second relay
   pinMode(5, OUTPUT);          // Control the 3rd relay
   pinMode(6, OUTPUT);          // Control the 4th relay
   pinMode(7, OUTPUT);          // Control the 5th relay
   pinMode(8, OUTPUT);         // Control the 6th relay
   pinMode(9, OUTPUT);         // Control the 7th relay
   pinMode(10, OUTPUT);         // Control the 8th relay
}

void loop() {
    if (irrecv.decode(&results)) {
    irrecv.resume(); //Receiving the next value
  }
    if(results.value == 16718055){
  // Four-wheeled car forward
    digitalWrite(3, HIGH); // Control wheel number 1 forward
    digitalWrite(4, LOW);       
    digitalWrite(5, HIGH); // Control wheel number 2 forward
    digitalWrite(6, LOW);      
    digitalWrite(7, HIGH); // Control wheel number 3 forward
    digitalWrite(8, LOW);       
    digitalWrite(9, HIGH);// Control wheel number 4 forward
    digitalWrite(10, LOW);        
    delay(1000);
  }
  if(results.value == 16730805){
    // Four-wheeled car Back
    digitalWrite(3, LOW); // Control wheel number 1 Back
    digitalWrite(4, HIGH);       
    digitalWrite(5, LOW); // Control wheel number 2 Back
    digitalWrite(6, HIGH);      
    digitalWrite(7, LOW); // Control wheel number 3 Back
    digitalWrite(8, HIGH);       
    digitalWrite(9, LOW);// Control wheel number 4 Back
    digitalWrite(10, HIGH);        
    delay(1000);
  }
  if(results.value == 16716015){
    // Four-wheeled car Turn left
    digitalWrite(3, HIGH); // Control wheel number 1 forward
    digitalWrite(4, LOW);       
    digitalWrite(5, LOW); // Control wheel number 2 Back
    digitalWrite(6, HIGH);      
    digitalWrite(7, HIGH); // Control wheel number 3 forward
    digitalWrite(8, LOW);       
    digitalWrite(9, LOW);// Control wheel number 4 Back
    digitalWrite(10, HIGH);        
    delay(500);
  }
  if(results.value == 16734885){
    // Four-wheeled car Turn right
    digitalWrite(3, LOW); // Control wheel number 1 Back
    digitalWrite(4, HIGH);       
    digitalWrite(5, HIGH); // Control wheel number 2 forward
    digitalWrite(6, LOW);      
    digitalWrite(7, LOW); // Control wheel number 3 Back
    digitalWrite(8, HIGH);       
    digitalWrite(9,HIGH );// Control wheel number 4 forward
    digitalWrite(10, LOW);        
    delay(500);
  }
    digitalWrite(3, HIGH); // Control wheel number 1 Back
    digitalWrite(4, HIGH);       
    digitalWrite(5, HIGH); // Control wheel number 2 forward
    digitalWrite(6, HIGH);      
    digitalWrite(7, HIGH); // Control wheel number 3 Back
    digitalWrite(8, HIGH);       
    digitalWrite(9, HIGH);// Control wheel number 4 forward
    digitalWrite(10, HIGH);     
  delay(10);//
}

Step 4: Compile and download the sketch to the UNO R3 board.

When press 4 keys(2,4,6,8) on the remote control,and you will see the car forward,back,left and right.

Leave a Reply