HOME / SIMULATORS / SIMULATOR // IR CAR 2WD TWIN & L293D INSPECTOR
Arduino Uno R3 · L293D DIP-16 · 38kHz NEC IR · Protoshield

Control a Small Car with an IR Remote & Arduino Protoshield

Breadboard jumper wires inevitably shake loose the moment a wheeled chassis starts vibrating. In this guide, we decode 38kHz NEC infrared remote commands, wire a DIP-16 L293D dual H-bridge motor driver, and migrate the circuit onto a rugged, stackable Arduino Protoshield.

BUILD SPECIFICATIONS
MCU BOARD:Arduino Uno R3 (ATmega328P)
MOTOR IC:L293D Dual H-Bridge (600mA/ch)
IR SENSOR:38kHz TSOP38238 / VS1838B
POWER RAIL:Separate 6V–9V Motor Supply
02 // Parts & Bill of Materials

Components, Boards & Hardware

HOVER CARDS FOR AI VISION TARGET LOCK
Arduino Uno Hologram
MCU // QTY: 1

Arduino Uno R3

38kHz IR Receiver Hologram
SENSOR // PIN D11

38kHz IR Receiver

IR Remote Hologram
TX // NEC HEX

IR Handheld Remote

DC Geared Motor Hologram
DRIVE // QTY: 2

3V-6V Geared Motors

COMPONENT QTY FUNCTION IN CIRCUIT ENGINEERING NOTE
Arduino Uno R3 / Q 1 Main Controller PWM timer pins 5, 6, 9, 10 for motor H-bridge speed control
ElectroCookie Uno Protoshield 1 Component Carrier Headers un-soldered; clean power rails and through-hole solder pads
L293D Dual H-Bridge IC + 16-Pin Socket 1 Bi-Directional DC Motor Driver DIP-16 package; drives 2 independent DC motors up to 600mA/channel
L7805 Voltage Regulator + Heatsink 1 Isolated 5V Power Supply Powers motors independently to protect Arduino from voltage sags
38kHz IR Receiver (VS1838B / TSOP) 1 Remote Command Sensor Connected to Digital Pin 11; demodulates 38kHz infrared pulses
3V-6V TT Geared Motors + Wheels 2 Chassis Propulsion 1:48 gear ratio provides high torque for 3D printed chassis
10 µF 50V Electrolytic Capacitors 2 Noise & Ripple Filter Placed on input and output of L7805 regulator to suppress motor spikes
3mm Red LED + 1KΩ Resistor 1 IR Signal Activity Indicator Blinks in real time whenever an IR packet is received from remote
Critical Hardware Warning: IR Receiver Pinout Differences

IR receiver pinouts vary between manufacturers! A VS1838B module often uses OUT - GND - VCC, while other 3-pin sensors use OUT - VCC - GND. Double-check your specific sensor datasheet before applying power—reversing VCC and GND will instantly destroy the component.

Watch a Protoshield Come to Life (Visual Comparison) BEFORE: 50% // AFTER: 50%

Drag the comparison handle across the ElectroCookie Arduino Protoshield photographs below to inspect the bare PCB alongside the soldered L293D + IR receiver circuit.

ElectroCookie Protoshield — After Soldering ElectroCookie Protoshield — Before Soldering Before After
◄►
03 // Circuit Architecture & Live Bench Test

Interactive NEC IR Remote & L293D Simulator

CLICK REMOTE KEYS TO FIRE 38KHZ HEX & DRIVE H-BRIDGE
38KHZ NEC IR TRANSMITTER HEX: 0xFF18E7
PWM DUTY (ENA D5 / ENB D10): 200 / 255 (78%)
STATE: FORWARD DRIVE PIN D13 IR LED
38kHz IR → D11 L293D SHIELD L: ▲ FWD R: ▲ FWD
MOTOR DIRECTION CONTROL (CLICK ROWS OR REMOTE) L293D H-BRIDGE TABLE
FORWARD DRIVE (UP ARROW) Left: IN1(D6)=HIGH, IN2(D7)=LOW • Right: IN3(D8)=HIGH, IN4(D9)=LOW
NEC: 0xFF18E7
REVERSE DRIVE (DOWN ARROW) Left: IN1(D6)=LOW, IN2(D7)=HIGH • Right: IN3(D8)=LOW, IN4(D9)=HIGH
NEC: 0xFF4AB5
SPIN LEFT (LEFT ARROW) Left: IN1(D6)=LOW, IN2(D7)=HIGH • Right: IN3(D8)=HIGH, IN4(D9)=LOW
NEC: 0xFF10EF
SPIN RIGHT (RIGHT ARROW) Left: IN1(D6)=HIGH, IN2(D7)=LOW • Right: IN3(D8)=LOW, IN4(D9)=HIGH
NEC: 0xFF5AA5
STOP / COAST (OK BUTTON) Left: IN1(D6)=LOW, IN2(D7)=LOW • Right: IN3(D8)=LOW, IN4(D9)=LOW
NEC: 0xFF38C7
PROTOSHIELD SOLDERING STRATEGY MAKER CRAFT

*"I couldn’t come up with a way to use software to plan the layout for the circuit because I wanted to use both sides, so I decided to just place the components on the shield, visualize the layout, and solder as I thought best. I utilized the existing traces as much as possible."*

1. IC Socket First: Solder a 16-pin DIP socket so the L293D chip is never exposed to direct heat.
2. Isolate Motor Rail: Dedicated L7805 + 10µF caps prevent inductive brownout resets.
3. 10 Spare Pins: Reserved for LDR night headlights or piezo horn expansion.
L293D DIP-16 H-BRIDGE PIN READOUT VCC1=5V (D) · VCC2=7.4V (M)
EN1,2 (Pin 1 / D5): PWM 200
EN3,4 (Pin 9 / D10): PWM 200
IN1 (Pin 2 / D6): HIGH (5V)
IN2 (Pin 7 / D7): LOW (0V)
IN3 (Pin 10 / D8): HIGH (5V)
IN4 (Pin 15 / D9): LOW (0V)
115200-BAUD SERIAL UART STREAM FORWARD DRIVE
[RX 115200] UART PACKET:
IR:0xFF18E7,RAW:MOT_L=FWD|MOT_R=FWD (ENA=200, ENB=200)
04 // Step-by-Step Protoshield Wiring

Soldering & Pinout Blueprint

Step 1: Isolate Digital 5V from Motor Supply (VCC2)

Connect L293D Pin 16 (VCC1) to the Arduino's regulated 5V rail, and connect L293D Pin 8 (VCC2) to your external 6V–7.4V battery pack. Always tie battery GND and Arduino GND together across the center ground sink pins (Pins 4, 5, 12, and 13).

Step 2: Solder the 16-Pin IC Socket onto the Protoshield

Solder a 16-pin DIP socket straddling the center channel of the Arduino Protoshield before inserting the L293D IC. Place a 0.1µF (104) ceramic decoupling capacitor close to Pin 16 to suppress brush noise from resetting the ATmega328P.

Step 3: Capture Your Remote's NEC Hex Codes

Wire the 38kHz IR receiver signal pin to Arduino D11. Open the Serial Monitor at 115200 baud, press each arrow key on your remote, and verify the hex literals in the C++ sketch.

vtm_ir_car_protoshield.ino
// VideotronicMaker — IR Remote Car + Arduino Protoshield (L293D)
#include <IRremote.hpp>

const int IR_RECEIVE_PIN = 11;
const int EN_LEFT        = 5;   // L293D Pin 1 (PWM Speed Control)
const int IN1_LEFT       = 6;   // L293D Pin 2 (Direction Logic)
const int IN2_LEFT       = 7;   // L293D Pin 7 (Direction Logic)
const int IN3_RIGHT      = 8;   // L293D Pin 10 (Direction Logic)
const int IN4_RIGHT      = 9;   // L293D Pin 15 (Direction Logic)
const int EN_RIGHT       = 10;  // L293D Pin 9 (PWM Speed Control)

void driveMotors(int l1, int l2, int r1, int r2, int speedPwm) {
  digitalWrite(IN1_LEFT, l1);
  digitalWrite(IN2_LEFT, l2);
  digitalWrite(IN3_RIGHT, r1);
  digitalWrite(IN4_RIGHT, r2);
  analogWrite(EN_LEFT, speedPwm);
  analogWrite(EN_RIGHT, speedPwm);
}

void setup() {
  Serial.begin(115200);
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
  pinMode(EN_LEFT, OUTPUT);  pinMode(EN_RIGHT, OUTPUT);
  pinMode(IN1_LEFT, OUTPUT); pinMode(IN2_LEFT, OUTPUT);
  pinMode(IN3_RIGHT, OUTPUT); pinMode(IN4_RIGHT, OUTPUT);
  driveMotors(LOW, LOW, LOW, LOW, 0);
}

void loop() {
  if (IrReceiver.decode()) {
    uint32_t code = IrReceiver.decodedIRData.decodedRawData;
    Serial.print("IR:0x"); Serial.print(code, HEX);
    Serial.print(",RAW:"); Serial.println(code);

    if (code == 0xFF18E7) driveMotors(HIGH, LOW, HIGH, LOW, 200);      // ▲ FORWARD
    else if (code == 0xFF4AB5) driveMotors(LOW, HIGH, LOW, HIGH, 200); // ▼ REVERSE
    else if (code == 0xFF10EF) driveMotors(LOW, HIGH, HIGH, LOW, 200); // ◄ SPIN LEFT
    else if (code == 0xFF5AA5) driveMotors(HIGH, LOW, LOW, HIGH, 200); // ► SPIN RIGHT
    else if (code == 0xFF38C7) driveMotors(LOW, LOW, LOW, LOW, 0);     // ■ STOP / COAST

    IrReceiver.resume();
  }
}
SIMULATOR FAQ // HARDWARE TWIN SPECS

Frequently Asked Questions

Technical details on how this digital twin models NEC 38kHz infrared decoding, L293D dual H-bridge motor logic, PWM speed control, and C++ sketch execution.

1. How does this simulator model the physical 2WD IR car? +
This interactive twin simulates the complete electronic drive circuit: NEC protocol 38kHz infrared decoding on Digital Pin 2, L293D dual H-bridge motor driver direction logic (IN1-IN4 on Pins 4, 5, 7, 8), speed modulation via PWM (ENA and ENB on Pins 3 & 6), live tachometer speed readouts, and real-time UART serial telemetry output.
2. How does the L293D H-bridge control motor direction and coasting? +
The L293D uses dual H-bridge transistor switches to reverse DC motor polarity. Setting IN1=HIGH and IN2=LOW drives the left motor forward; IN1=LOW and IN2=HIGH drives it in reverse. Setting both inputs LOW (or pulling ENABLE low) places the motor into coast mode. Setting both inputs HIGH acts as an active electronic brake.
3. Why does the schematic specify separate power for the DC motors? +
DC motors create heavy inductive back-EMF spikes and momentary current draws exceeding 1A upon acceleration. Powering motors from the Arduino 5V regulator will drop the voltage below 4.5V, triggering an MCU brownout reset. In the physical build, supply the L293D pin 8 (VCC2) with an external 6V-9V battery pack while powering the Uno logic and L293D pin 16 (VCC1) separately, keeping a common ground rail.
4. How does the IR receiver differentiate between remote button codes? +
The onboard TSOP/VS1838B sensor strips the 38kHz carrier wave and outputs active-low demodulated pulse widths. The Arduino IRremote library measures the duration of these pulses (using mark and space intervals conforming to the NEC protocol) and decodes them into unique 32-bit hex words (e.g. 0xFF18E7 for forward) that drive the motor control logic.
5. How does this IR Car simulator integrate with VTM Studio? +
This simulator pairs with VTM Studio Reference Mode (for protoshield pinout mapping and L293D IC pin configurations) and Code Mode (for flashing and debugging motor control sketches). In Science Mode, the serial stream (IR:...,RAW:...) populates live gauge dials to monitor speed control PWM values on your bench.