Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based IR Remote-Controlled Robotic Car with L298N Motor Driver

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based IR Remote-Controlled Robotic Car with L298N Motor Driver

Circuit Documentation

Summary

This circuit is designed to control a set of motors using an Arduino UNO and an IR remote control. The circuit includes an IR receiver to capture signals from the remote, a motor driver to control the motors, and a battery case to power the components. The Arduino UNO processes the IR signals and sends appropriate commands to the motor driver to control the direction and movement of the motors.

Component List

  1. My battery case

    • Pins: +, -
    • Description: Provides power to the circuit.
    • Purpose: Supplies power to the motor driver and other components.
  2. HX1838 Infrared IR Wireless Remote Control

    • Pins: FFA25D (1), FF629D (2), FFE21D (3), FF22DD (4), FF02FD (5), FFC23D (6), FFE01F (7), FFA857 (8), FF906F (9), FF9867 (0), FFB04F (#), FF6897 (*), FF18E7 (↑), FF5AA5 (→), FF10EF (←), FF4AB5 (↓), FF38C7 (OK)
    • Description: Remote control for sending IR signals.
    • Purpose: Allows user to control the motors wirelessly.
  3. VS1838B IR Receiver

    • Pins: OUT, GND, VCC
    • Description: Receives IR signals from the remote control.
    • Purpose: Captures IR signals and sends them to the Arduino for processing.
  4. L298N DC Motor Driver

    • Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
    • Description: Controls the motors based on signals from the Arduino.
    • Purpose: Drives the motors in forward, backward, left, and right directions.
  5. Motor and Wheels

    • Pins: vcc, GND
    • Description: Motors with attached wheels.
    • Purpose: Provides movement to the robot.
  6. Arduino UNO

    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
    • Description: Microcontroller board.
    • Purpose: Processes IR signals and controls the motor driver.

Wiring Details

My battery case

HX1838 Infrared IR Wireless Remote Control

VS1838B IR Receiver

L298N DC Motor Driver

Motor and Wheels

Arduino UNO

Code Documentation

Arduino UNO Code

#include <IRremote.hpp>
#include<IRremote.h>

const int RemotePin = 8;
IRrecv irrecv(RemotePin);
decode_results results;

int in1 = 3;
int in2 = 5;
int in3 = 6;
int in4 = 9;

void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn();
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
}

void loop() {
  if (irrecv.decode(&results)) {
    if (results.value == 0xFF629D) { // Press UP Button
      Forward();
    } else if (results.value == 0xFFA857) { // Press Down Button
      Backward();
    } else if (results.value == 0xFF22DD) { // Press Left Button
      Left();
    } else if (results.value == 0xFFC23D) { // Press Right Button
      Right();
    } else if (results.value == 0xFF02FD) { // Stop
      Stop();
    }
    irrecv.resume();
  }
}

void Backward() {
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
}

void Forward() {
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
}

void Stop() {
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
}

int Left() {
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
}

int Right() {
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
}

This code initializes the IR receiver and sets up the motor control pins. In the main loop, it checks for IR signals and calls the appropriate function to move the motors forward, backward, left, right, or stop based on the received IR signal.