Purchasing link

Buy from OSOYOO Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

Content

1Objective

In this lesson, you will control your OSOYOO V3 Robot Car using an infrared (IR) remote controller.

Unlike Bluetooth or WiFi control, infrared communication does not require wireless pairing or network configuration. Instead, commands are transmitted using invisible infrared light and received by an onboard IR receiver module.

This project introduces one of the simplest and most widely used forms of wireless communication in embedded systems. Infrared remote control technology is commonly found in televisions, air conditioners, media players, and many consumer electronic products.

After completing this lesson, you will be able to:

2Parts and Devices:

For the initial assembly phase, the following components are required. Please ensure all parts are accounted for prior to commencing the build

No. Picture Device Qty. Accessories Link
1 IR receiver 1 M3 Plastic Screw x 2
M3 Plastic Nut x 2
M3 Plastic Pillar x 2
Click here to buy
2 IR remote controller 1 Click here to buy
3 20Pin jumper wire Male to female 20cm some Click here to buy
4 Hex Screwdriver 1 Click here to buy
5 M3 plastic screw 2
6 M3 plastic pillar 2
7 M3 plastic nut 2

3How Infrared Remote Control Works

Unlike Bluetooth or WiFi, infrared communication uses pulses of invisible light.

When you press a button:

  1. The remote controller generates a digital command.
  2. The command modulates an infrared LED at 38 kHz.
  3. The IR receiver detects the infrared signal.
  4. The receiver removes the carrier frequency and outputs the decoded pulse sequence.
  5. The Arduino decodes the pulse timing into a button code.
  6. The robot performs the corresponding action.

This entire process takes only a few milliseconds.

4Hardware Installation

Step 1: Install basic framework as robot car Lesson 1 . If you have already completed hardware installation in Lesson 1 , just keep it as is.

Step 2: Add an IR receiver module onto the car. Install the IR receiver module with 2pcs M3 plastic screws, M3 plastic pillars and M3 plastic nuts at the front of upper chassis.

Step 3: Connect the S pin in IR receiver to D10 pin in your board, GND to GND, VCC to 5V, as the following photo (Remember : DO NOT remove any existing wires installed in Lesson 1 )

5Software Installation

Open-source Arduino
Software(IDE)
Download software here:
https://www.arduino.cc/en/Main/Software?setlang=en
7 zip is a free zip
utility that unzips zip files
Download 7zip here for free
https://www.7-zip.org/

1. Arduino IDE Setup: Download and install the latest version of the Arduino Integrated Development Environment (IDE) from https://www.arduino.cc/en/Main/Software?setlang=en.


2. Code Acquisition: Download the provided sample code for Lesson 8 from here. Extract the contents and you will get a v3car-lesson8.ino in the folder v3car-lesson8.

3. Board and Port Selection: Connect the OSOYOO Basic Board (compatible with Arduino UNO) to your computer via a USB cable(Crucially, ensure the robot car’s power switch is OFF and the battery is disconnected before connect the board to your PC). Launch the Arduino IDE. Navigate to Tools > Board and select Arduino Uno. Then, go to Tools > Port and select the appropriate serial port. If unsure, check your operating system’s device manager for the assigned port.

4. Install Libraries:
Firstly, download Libraries zip files from following links:
https://downloads.arduino.cc/libraries/github.com/z3t0/IRremote-4.3.1.zip
Second, do NOT unzip them, open Arduino IDE ->Sketch ->Include Library ->Add Zip Library. Then upload above zip file to Arduino.

5. Code Upload: Open the v3car-lesson8.ino sketch in the Arduino IDE. Click the “Upload” button (right arrow icon) to compile and transfer the sketch to OSOYOO Basic Board.


6Test the Car

Now you can put the car onto the ground, turn on the power. Point the remote controller toward the IR receiver and press the control buttons.

Expected Behavior

Remote Button Robot Action
Move Forward
Move Backward
Turn Left
Turn Right
OK Stop

For best performance:


7 Troubleshooting

1. Robot Does Not Respond

Check:

Some user found that this IR remote does not work. The reason might be the IR remote sends different button code which does not match our sample code. In order to solve this problem. Please take following steps:
Step A) Get the IR code of each button in your IR remote.
https://osoyoo.com/download/driver/irdemo.zip

upload above sketch into your board and open the serial monitor in your upper-right corner.

press the ◄ ► ▲ ▼ “OK” button in your remote, you will see their IR code as following picture:

Write down the IR code of your control buttons ◄ ► ▲ ▼ “OK” button,

STEP B)replace the IR code in lesson 2 sketch file:
Open your Lesson 2 code again, then you will see following lines define the IR CODE of each button:
#define IR_ADVANCE       24       //code from IR controller “▲” button
 #define IR_BACK          82       //code from IR controller “▼” button
 #define IR_RIGHT         90       //code from IR controller “>” button
 #define IR_LEFT          8       //code from IR controller “<” button
 #define IR_STOP          28       //code from IR controller “OK” button
 #define IR_turnsmallleft 13       //code from IR controller “#” button
Please change the value of each button in above lines to match the code from Step A). If you don’t know how to change, just Send Email to us and give us the code of each button from Step A), I can help you to change the code and email new sketch file to you.
Above method can also allow you to use other IR sending device (i.e TV remote, DVD remote, air conditioner remote etc) to control the car. Just use Step A) to get the key code of your remote and change the sketch file in Step B), it will work.
Note:
1) Please try to align the transmitter port of the IR remote control with the IR receiver head as the picture in the attachment.
2) Please press remote control gently and at regular intervals

2. Remote Works Only Occasionally

Possible causes:

3. Compilation Errors
If you encounter library conflicts, remove the RobotIRremote library before compiling the sketch.