Arduino 8 Relay Car

Arduino 8 Relay Car

Introduction
Today we use a 8-way relay to make a four-wheeled car.

Components
- 1 * Adeept UNO R3 Board
- 1 * 8 Channel Relay Module
- 4 * DC Motor
- 10 * Male To Female Jumper Wires
- 1 * 18650 battery box
- 2 * 18650 lithium battery
- 1 * Adeept Acrylic plate
- 4 * Wheel
- 9 * M3*30 Screw
- 10 * M3 Nut
Some Jumper Wires

Experimental Principle 

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: Program  Adeept8RelayCarCode.ino

/***********************************************************
File name: Adeept8RelayCarCode.ino
Description: Use 8-way relay to make a 4-wheel car.The car runs 
             forward for 1 second, for 1 second for backward,
             1 second for left, and 1 second for right. Cycle operation.
Website: www.adeept.com
E-mail: support@adeept.com
Author: Tom
Date: 2017/01/04
***********************************************************/
void setup() {
   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() {
  // 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);//
    // 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);//
    // 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(1000);//
     // 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(1000);//
}

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

Leave a Reply