How to Make a Infrared (IR) Remote Controlled Car With a TV Remote for University Project, Science Fair and Robotics Competition
by square1a in Circuits > Arduino
4479 Views, 27 Favorites, 0 Comments
How to Make a Infrared (IR) Remote Controlled Car With a TV Remote for University Project, Science Fair and Robotics Competition
Follow the instructions below to build the remote control car car. This project is ideal for science fair, robotics competition and university projects. The design is highly adaptable, you can modify it easily and add your own components.
Table of contents
Step 1: video demo
Step 2: circuit diagram
Step 3: Arduino code (software)
Step 4: Fixing common error, if your car does not work
Step 5: Notes for modifying this design
Safety instructions:
- Take the batteries out of car when not in use. If you cannot see/supervise the car, take the batteries out.
- Do NOT short the circuit. A common symptom of this is the circuit overheats.
- If you are using your own power supply, use less than 12 volts, unless you know what you are doing.
Supplies
- Chasis car kit: (e.g. https://www.phippselectronics.com/product/2wd-intelligent-robot-car-kit/?gclid=Cj0KCQiAqsitBhDlARIsAGMR1RhVJQm_5bbR5MACucAAQUzIxo9Umyy1rzdiAdgYnaA5uZS3CZ2HafQaApBtEALw_wcB)
- IR sensor
- L293D motor control module
- 6X AAA battery holder (the chasis car kit only includes a 4X AAA battery holder which does not supply enough voltage)
- Aduino UNO
- 220uF capacitor (or bigger capacitance)
- Breadboard and jumper wires
- TV remote (ensure its batteries have charge)
- 6X AA rechargeable* batteries
- A cross-head screw driver
- Soldering iron (for attaching wires to the TT motor)
*rechargeable ones are recommended, since DIY car typically have poor power efficiency and drains batteries quickly
Watch the Video
Timestamp in the video:
0:17 assembling the chassis and motors
4:30 electronics
5:48 circuit diagram
5:54 software (Arduino code)
7:50 demo of the driving (with precision mode code)
8:20 demo of the driving (with racing mode code)
Circuit Diagram
Wire it up according the diagram above.
Arduino Code
There are two modes on offer:
Precision Mode: when it turns left/right, it spin on a fixed axis (see Step 1 video at timestamp 7:49)
- Download 'IR_car_precision.ino' AND 'PinDefinitionsAndMore.h', which are attached below
- Then save them into a folder called 'IR_car_precision'
- To change the speed of car, find the variable "carSpeed" and change it
- To change how fast the car turns left/right, change the variable "turnTime"
Racing Mode: it turns left/right, while going forward, like a real-life road car. (see Step 1 video at timestamp 8:19)
- Download 'IR_car_racing.ino' AND 'PinDefinitionsAndMore.h', which are attached below
- Then save them into a folder called 'IR_car_racing'
- To change the speed of car, find the variable "upperSpeed" and "lowerSpeed"
- To change how fast the car turns left/right, change "upperSpeed" and "lowerSpeed", so the difference between them is bigger/smaller
If you have never used an Arduino before, check out https://www.arduino.cc/en/Guide/ArduinoUno
Fixing Common Errors
If you do not have any errors, skip this step (and congratulations!).
Arduino does not respond to infrared signals.
- Go into serial monitor of the Arduino, which would provide you with information
- Check the TV remote's battery has power
- Have you change 'command' number, which is shown in Step 1's video at timestamp 7:15?
- Have you inserted the capacitor into the circuit?
- Move the car closer to the TV remote
- Do the check mentioned under 'Arduino is not powered on' section below, voltage under 7 volts leads to instability and inaccurate reading by the infrared sensor
Arduino is not powered on
- Use a multimeter or voltmeter to measure the voltage between the black and red wire of battery holder. Then measure voltage between pin 8 and 4 of L293D chip, when it is connected to the battery. If any of the two voltage measurements is less than 7 volts, replace with fully charged batteries.
Motor does not move, or very weakly.
- Check if the Arduino is powered on
- Ensure pin 16 of L293D is connected to 5V on Arduino.
- Both wires of each motor are plugged in properly
Car does not drive straight.
- A bit of deviation from straight path is expected, and there is little can be done.
- Ensure the wheels are mounted properly and are parallel to each other
- Ensure pin 16 of L293D is connected to 5V on Arduino.
- Try all the commands: drive forward, backward, left, right and stop. You might have mixed up the keys.
For all issues.
- Ensure everything is connected as shown in Step 2's diagram
- Read the error message in the black window at the bottom of Arduino IDE. Copy the error message into Google.
- Go to Tools in Arduino, ensure the Board is "Arduino UNO". And port is usb something, not BlueTooth.
Customise Your Own
For you to design your own car, you need to understand:
- Pin 0, 1 and 13 on the Arduino are special, so avoid using them. Pin 2 is reserved for the infrared sensor.
- For stable operation, Arduino UNO board needs 7 to 12 volts of power via its Vin port. That's why this design uses six rechargeable AA batteries (voltage of one rechargeable AA is about 1.2V, so 6 X 1.2 = 7.2 > 7 volts.
- The L293D motor control chip needs 4.5 to 36 volts of power via its pin 8.
- The L293D also has clamp diodes to protect against Inductive Flyback (aka Flyback voltage) voltage spike. So if you want to replace it, the substitute also needs to offer this protection.
- The capacitor keeps the voltage at 5V pin on the Arduino constant, using the fact that voltage across a capacitor cannot change instantaneously. A constant voltage is vital for the infrared sensor, which is very sensitive.
- If the infrared sensor stops working after adding a servo motor (or any other type of inductive load), replace the 220 µF capacitor with one of bigger capacitance, to enhance constancy of voltage at 5V pin on the Arduino.
component specifications:
Arduino: http://store-usa.arduino.cc/products/arduino-uno-rev3
L293D chip datasheet: https://www.ti.com/lit/ds/symlink/l293.pdf