Gesture Controlled micro:bit Car

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)
  • Battery 
  • USB cable 

Things You Will Learn

  • Radio Communication
  • Gesture Recognition
  • Block Programming
  • Robotic Car Control

micro:bit 

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. 

Features

  • 2 Programmable buttons
  • 1 Reset button
  • 5x5 LED display
  • Temperature sensor
  • Wireless communication
  • Motion sensor 

Radio Communication

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. 

Motion sensor

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.

Motion Sensor

According to the gestures of the micro:bit you can program the micro:bit to perform some task.

Accelerometer

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.

Accelerometer

Here, we are going to use a micro:bit as a remote to control military car of the Stem:Bit via radio. 

Stem:Bit (Micro Bit Starter Kit)

Now, the question that arises in our mind is - “what is Stem:Bit?”

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.

          STEM Education 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.

 STEM BoardStem 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:

https://makergenix.com/collections/micro-bit-kits/products/stem-bit-the-programmable-blocks-kit-for-micro-bit

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. 

Program

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.

Coding Blocks

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.

radio set group

  • Select the gesture - from the given list below select the gesture.

Select the gesture

  • Set radio send number- it broadcasts the number to the other micro:bit connected.

Radio send number

Below is the whole program of the transmitter.

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.

Radio set group

  • On receiving the number - the codes written inside this block runs only if the number is received by the micro:bit.

number received by 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.

executes the codes

  • 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:

  1. Click on the extension block


     2. Copy the URL to the space provided.

              URL for the extension - https://github.com/sbcshop/pxt-stembit

    Extension

    After adding the extension you will see all the blocks of Stem:Bit required to control the robot.

    adding the extension

    Below is the whole program of the receiver.

    whole program of the receiver

    Conclusion

    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.

    Previous article How to SSH in Raspberry Pi
    Next article ALL ABOUT RASPBERRY PI

    Leave a comment

    Comments must be approved before appearing

    * Required fields

    x