Gesture Controlled micro:bit Car
Radio communication is one of the types of wireless communication (no physical connection is required for communication.). Radio communication requires both transmitting and receiving equipment. The equipment which includes a radio transmitter is known as a radio transmitter and a transmitting antenna is installed at the transmitter end. The equipment, which includes a radio receiver and a receiving antenna is known as a radio receiver.
In this blog, we will learn the concept of radio communication in the micro:bit.
Things You Need
- 2 micro:bit
- 1 robot car (military car)
- USB cable
Things You Will Learn
- Radio Communication
- Gesture Recognition
- Block Programming
- Robotic Car Control
micro:bit - as the name suggests it is a tiny single-board ARM-based embedded system. It is a fully programmable computer designed to actively involve youngsters into software and developing new things out of it.
micro:bit a pocket-sized computer, having lots of features in it. There are lots of features that make this device powerful.
- 2 Programmable buttons
- 1 Reset button
- 5x5 LED display
- Temperature sensor
- Wireless communication
- Motion sensor
micro:bit offers a low-level radio communication.Two micro:bit can communicate with each other using radio signals. The on-board 2.4GHz transceiver supports Nordic Gazell protocol. This protocol provides a very simple small-packet broadcast radio interface between the devices. It has 255 group codes to connect.
It consists of both accelerometer and magnetometer to sense the 3 axes (x, y & z) and the strength of the magnetic field respectively. It also offers an additional feature of detecting gesture of the micro:bit.
What is gesture?
It basically tells you the position of the micro:bit logo whether it is facing up or down, tilted to left or right, screen up or down, free-falling etc.
Different types of gestures are shown in the image below.
According to the gestures of the micro:bit you can program the micro:bit to perform some task.
The micro:bit has an accelerometer on the board. Accelerometer sense the acceleration or you can say it sense the motion in 3 different axes.
Here, we are going to use a micro:bit as a remote to control military car of the Stem:Bit via radio.
Now, the question that arises in our mind is - “what is Stem:Bit?”
Stem:Bit is a combination of two terms -
“Stem” comes from STEM education (i.e Science, Technology, Engineering & Maths) &
“:Bit” comes from the BBC micro:bit.
The kit was designed basically for all age groups to play and have fun along with learning to program. The Stem:bit is made by keeping in mind the importance of STEM subjects for students.
Features of Stem:Bit
- Easy to assemble
- Easy to code
- Unlock imagination and improves creativity
- Learn the basics of electronics
- Programming concept
The Kit consists of 260+ small building blocks (programmable blocks) and a Stem board, whose core is the micro:bit.
It helps the techies/non-techies to learn the basics of electronics, robotics, and also the concepts of programming.
For more information, you can visit our shop, the link is given below:
Here, we are going to control the Stem:Bit car movement by the gesture of the micro:bit via radio communication. Let’s see how to program the micro:bit to control a car.
As we all know that there are various ways to program a micro:bit but here we are using Block programming(drag-n-drop). BBC micro:bit offers an online editor makecode powered by Microsoft.
When you open the makecode editor (https://makecode.microbit.org/) you will see a RADIO block inside it which has all the functionalities.
Program of the transmitter micro:bit
- Set radio group - before starting any communication we must set a group ID which is required to start the communication between the two micro:bit.
- Select the gesture - from the given list below select the gesture.
- Set radio send number- it broadcasts the number to the other micro:bit connected.
Below is the whole program of the transmitter.
Program for the receiver micro:bit
- Set radio group - the group ID of the sender and the receiver must be same then only the communication starts between the two devices.
- On receiving the number - the codes written inside this block runs only if the number is received by the micro:bit.
- if-else condition - on receiving the number from the transmitter, checks the condition first and then executes the codes when the condition is fulfilled.
- Car control - to control the movement of the car (forward, backward, left, right).
The blocks for controlling the car can be imported from the extension. The extension can be imported either by URL or by the name of the extension.
Follow the steps below:
- Click on the extension block
2. Copy the URL to the space provided.
URL for the extension - https://github.com/sbcshop/pxt-stembit
After adding the extension you will see all the blocks of Stem:Bit required to control the robot.
Below is the whole program of the receiver.
micro:bit have lots of inbuilt features, it was made for exploration and creativity. The Stem:Bit increases its capability by adding customization blocks to the micro:bit. In the article, we used a micro:bit to control a Stem:Bit car which controls its movements and another micro:bit to read sensor data and send a signal to the car. This gesture-controlled car has lots of things to learn like accelerometer, radio communication, and robotic car control.