Building an infrared remote-controlled robot car using Micro:bit

Micro:bit 25-11-26
129 0

Tutorial plan

1- Objective of the project

2- Required Components

3- Circuit Connections of system

4- Makecode program for Micro:bit board

 

 

Objective of the project

This project consists of designing and building a four-wheel robot car controlled remotely using an infrared (IR) remote control and a Micro:bit board. The system uses a KY-032 infrared receiver module to receive commands transmitted by the remote control and send the corresponding signals to the Micro:bit.

The Micro:bit processes the received commands and controls the rotation direction and speed of the DC motors through a motor driver module. By pressing different buttons on the remote control, the user can move the robot car forward, backward, turn right, turn left, or stop it.

This project provides a practical introduction to educational robotics, infrared communication, electronic components, and programming with Micro:bit. It also helps students understand how wireless remote-control systems work and how electronic boards can be used to control a mobile robot.

 

Required Components

1. Micro:bit Board

Micro:bit board

The Micro:bit is a programmable electronic board that acts as the brain of the robot car. It receives the signals decoded by the infrared receiver and executes the corresponding instructions. It then sends control signals to the motor driver to manage the movement of the vehicle.

2. Driver Expansion Board

The Driver Expansion Board is used to connect the Micro:bit to the car's motors and control their operation. It receives commands from the Micro:bit and controls the speed and direction of rotation of the four DC motors.

3. KY-032 Infrared Receiver Module

Capteur infrarouge KY-032

The KY-032 infrared module is an electronic sensor designed primarily for obstacle detection using infrared light. In this project, the infrared reception function must be verified according to the module's actual configuration. A standard IR remote-control receiver, such as the VS1838B, is generally used to receive and decode commands transmitted by an infrared remote control.

4. Infrared Remote Control

Télécommande infrarouge

The infrared remote control allows the user to operate the robot car wirelessly. It contains several buttons, each associated with a specific infrared code. Pressing a button transmits an infrared signal that is received by the IR receiver module.

4. Four-Wheeled Car Chassis

The four-wheeled car chassis provides the mechanical structure of the robot. It consists of four DC motors, four wheels, and a supporting frame. The motors allow the car to move forward, backward, turn left, and turn right.

4. Jumper Wires

Jumper wires

Jumper wires are used to make the electrical connections between the Micro:bit, the GPIO expansion board and the servo motor.

5. Two 3.7V Rechargeable Batteries

The two 3.7V rechargeable batteries provide the electrical power required to operate the robotic car. They supply energy to the Driver Expansion Board and the four DC motors, allowing the car to move autonomously according to the commands received from the sender Micro:bit.

Circuit Connections of system

 

To assemble the robotic car, follow these steps:

1. Micro:bit Receiver: Insert the receiver Micro:bit into the dedicated connector on the Driver Expansion Board, ensuring that it is correctly positioned.

2. the Infrared Receiver Module

The infrared receiver is connected to the Micro:bit through three main terminals: VCC, GND, and OUT.

- VCC (+) : Connected to 3.3 V pin of Micro:bit.

- GND (-) : Connected to the GND terminal of the Micro:bit.

- OUT: Connected to P0 pin of the Micro:bit.

3. DC Motors : Connect the four DC motors to the motor output terminals (M1, M2, M3 and M4) of the Driver Expansion Board. These motors control the rotation of the four wheels.

4. Power Supply : Connect the two 3.7V rechargeable batteries to the power input of the Driver Expansion Board, respecting the positive (+) and negative (−) terminals.

5. Car Chassis : Fix the four motors and wheels to the chassis, then secure the Driver Expansion Board and battery holder onto the car.

6. Final Check : Verify all electrical connections, battery polarity and mechanical assembly before switching on the car.

 

MakeCode Program for the Micro:bit Board

Adding the Motor Control Extension and OSYOO-IR-Silvery-Receiver in MakeCode for Micro:bit

1- Go to Microsoft MakeCode and start a new project.

2- In MakeCode, open the Blocks Editor (https://makecode.microbit.org/).

3. Opening the Extensions Library

Click on Extensions at the bottom of the MakeCode toolbox to access additional programming libraries.

4. Installing the DFROBOT Motor Extension 

In the Extensions search field, enter the following GitHub address: https://github.com/DFRobot/pxt-motor

Select the motor extension to add the DFRobot motor-control library to the MakeCode environment.

This extension provides programming blocks for controlling DC motors, stepper motors and servos.

6. Using the DF-Driver Category

After installing the extension, a new category named DF-Driver appears in the MakeCode toolbox.

For this project, the Motor block is particularly important because it allows the receiver Micro:bit to control the four DC motors connected to the Driver Expansion Board.

7. Add OSYOO-IR-Silvery-Receiver Extension:

Click on the "Extensions" option in the bottom left corner.

Enter the following URL in the search field to add the extension: https://github.com/osoyoo/OSOYOO_IR_V3/

After importing the extension, a new category called OSOYOO_SilveryIR_V3 appears in the MakeCode toolbox. It contains the blocks required to initialize the infrared receiver and detect the buttons pressed on the remote control.

 

Programming the Micro:bit

This MakeCode program allows the robot car to be controlled remotely using an infrared remote control. It uses the OSOYOO_SilveryIR_V3 extension to initialize the infrared receiver, detect the buttons pressed on the remote control, and execute the corresponding motor commands.

1. Initializing the Infrared Receiver

In the On Start block, the infrared receiver is initialized by selecting pin P0 and the OSOYOO decoding mode. This configuration enables the Micro:bit to receive and decode infrared signals transmitted by the remote control.

2. Moving the Robot Car Forward

When button 2 on the infrared remote control is pressed, the program activates the four motors (M1, M2, M3, and M4) in the clockwise (CW) direction at a speed of 50. This command makes the robot car move forward.

3. Moving the Robot Car Backward

When button 8 is pressed, the four motors rotate in the counterclockwise (CCW) direction at a speed of 50, allowing the robot car to move backward.

4. Turning the Robot Car Left

When button 4 is pressed, the program controls the motors in opposite directions: M1 and M3 rotate counterclockwise, while M2 and M4 rotate clockwise. The motor speed is set to 70, allowing the robot car to turn.

5. Turning the Robot Car Right

When button 6 is pressed, the motor directions are reversed: M1 and M3 rotate clockwise, while M2 and M4 rotate counterclockwise. The motor speed is set to 70, allowing the robot car to turn in the opposite direction.

6. Stopping the Robot Car

When button 5 is pressed, the Motor Stop All block stops all four motors, bringing the robot car to a complete stop.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

Pictures of the articles

Robotic site created by Mohamed Ali Haj Salah - Teacher info