Your Business
Your Business
  • Home
  • Arduino Projects
    • List of projects
    • Traffic lights
    • Ir Car
    • LCD
    • Led remote control
    • Ultrasonic Detector
  • ESP 32 Projects
    • ESP32 & 1.28 display
  • Altro
    • Home
    • Arduino Projects
      • List of projects
      • Traffic lights
      • Ir Car
      • LCD
      • Led remote control
      • Ultrasonic Detector
    • ESP 32 Projects
      • ESP32 & 1.28 display
  • Home
  • Arduino Projects
    • List of projects
    • Traffic lights
    • Ir Car
    • LCD
    • Led remote control
    • Ultrasonic Detector
  • ESP 32 Projects
    • ESP32 & 1.28 display

Build Your Own IR CONTROLLED Car with Arduino!

Project Description:

Create an IR-controlled car using Arduino, an HW-130 motor driver, and an IR remote control. The HW-130 motor driver efficiently handles the motors, while the IR remote allows directional control.

Description

Materials Needed:

  1. Arduino Uno or equivalent.
  2. HW-130 Motor Driver:
    • To control the motors.

  1. 4 DC Motors with Gearbox:
    • Two motors grouped for left-side control and two for right-side control.

  1. IR Receiver Module (e.g., TSOP1738):
    • To receive signals from the remote.

  1. IR Remote Control:
    • For sending directional commands.

  1. Robot Chassis:
    • With wheels and a caster wheel for balance.

  1. 9V Battery for Arduino.
  2. Ni-MH AA 2400mAh Battery Pack:
    • For powering the motors.

  1. Breadboard and Jumper Wires:
    • For connecting the IR receiver.


Circuit Setup

1. Motors and HW-130 Motor Driver:

  • Motor Outputs:
    • Connect the Left Motors to OUT1 and OUT2.
    • Connect the Right Motors to OUT3 and OUT4.
  • Control Inputs:
    • IN1 → Arduino D5 (Left Motors forward/reverse).
    • IN2 → Arduino D6 (Left Motors forward/reverse).
    • IN3 → Arduino D9 (Right Motors forward/reverse).
    • IN4 → Arduino D10 (Right Motors forward/reverse).
  • Power Connections:
    • VCC → Positive terminal of the motor battery pack (6V or 7.2V).
    • GND → Common ground shared with Arduino.

2. IR Receiver:

  • VCC → Arduino 5V.
  • GND → Arduino GND.
  • OUT → Arduino A5.

3. Power Supply:

  • Use the Ni-MH AA battery pack for the motors.
  • Use a separate 9V battery for the Arduino.

Arduino Code

#include <IRremote.h>
#include <AFMotor.h>

const int RemotePin = A5;

// Initialize IR Receiver (new library usage)
//AF_DCMotor motor1(1);
//AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

void setup() {
Serial.begin(9600);
  // Start the IR receiver with LED feedback enabled
IrReceiver.begin(RemotePin, ENABLE_LED_FEEDBACK);

 // motor1.setSpeed(100); if you want to use it
 // motor2.setSpeed(100); if you want to use it
motor3.setSpeed(250);
motor4.setSpeed(250);
}

void loop() {
  // Check if the IR receiver has received a signal
if (IrReceiver.decode()) {
    // Get the raw code from the remote
unsigned long code = IrReceiver.decodedIRData.decodedRawData;
Serial.print("Received IR code: 0x");
Serial.println(code, HEX);

    // Compare the received code with known button codes
if (code == 0xB946FF00) { // Press UP Button
Forward();
} else if (code == 0xEA15FF00) { // Press Down Button
Backward();
} else if (code == 0xBB44FF00) { // Press Left Button
Left(); //
} else if (code == 0xBC43FF00) { // Press Right Button
Right(); //
} else if (code == 0xBA45FF00) { // Stop
Stop();
}

    // Ready for the next code
IrReceiver.resume();
}
}

void Backward() {
motor4.run(BACKWARD);
motor3.run(BACKWARD);
  //motor2.run(BACKWARD);
  //motor1.run(BACKWARD);
Serial.println("Moving Backward");
}

void Forward() {
motor4.run(FORWARD);
motor3.run(FORWARD);
 // motor2.run(FORWARD);
 // motor1.run(FORWARD);
Serial.println("Moving Forward");
}

void Stop() {
motor4.run(RELEASE);
motor3.run(RELEASE);
  //motor2.run(RELEASE);
  //motor1.run(RELEASE);
Serial.println("Stop Motors");
}

void Left() {
motor4.run(FORWARD);
motor3.run(BACKWARD);
Serial.println("Moving Left");
}
void Right() {
motor4.run(BACKWARD);
motor3.run(FORWARD);
Serial.println("Moving Left");
}

How It Works

  1. IR Receiver:
    • Captures signals from the remote and decodes them into commands.

  1. HW-130 Motor Driver:
    • Controls the motors based on the Arduino’s instructions:
      • Forward: Both left and right motors move forward.
      • Backward: Both left and right motors move backward.
      • Left Turn: Left motors move backward, and right motors move forward.
      • Right Turn: Left motors move forward, and right motors move backward.
      • Stop: All motors stop.

  1. Simplified Control:
    • Motors are grouped for left and right movement to streamline the control logic.


Testing Instructions

  1. Assemble the Circuit:
    • Connect the motors, motor driver, and IR receiver as described.

  1. Upload the Code:
    • Use the Arduino IDE to upload the code to your Arduino Uno.

  1. Test the Remote:
    • Use the IR remote to send commands and observe the car’s movement:
      • Forward, Backward, Left, Right, and Stop.

  1. Adjust Speed:
    • Modify the motor speed in the analogWrite() function if needed.

List of parts

  1. Assemble the Circuit:
    • Connect the motors, motor driver, and IR receiver as described.

  1. Upload the Code:
    • Use the Arduino IDE to upload the code to your Arduino Uno.

  1. Test the Remote:
    • Use the IR remote to send commands and observe the car’s movement:
      • Forward, Backward, Left, Right, and Stop.

  1. Adjust Speed:
    • Modify the motor speed in the analogWrite() function if needed.

Download Stl

I file saranno disponibili presto.

Copyright © 2025 Alex3dworks - All rights reserved

Gestito da

  • Politica sulla privacy

Questo sito web usa cookie.

Utilizziamo i cookie per analizzare il traffico sul sito web e ottimizzare l'esperienza con il tuo sito. Accettando l'uso dei cookie da parte nostra, i tuoi dati saranno aggregati con i dati di tutti gli altri utenti.

RifiutaAccetta