Build a radar controlled by Micro:bit

Micro:bit 26-11-24
39 0

Tutorial plan

1- What is a radar ?

2- Operation of the radar controlled by Micro:bit:

3- Radar components

4- Radar mounting

5- Programming the system

 

 

What is a radar ?

A radar (short for Radio Detection and Ranging) is a system that uses electromagnetic waves, specifically radio waves, to detect, locate, and track objects. It operates by transmitting radio waves and analyzing the signals that bounce back (echoes) after hitting an object. Here's a breakdown of its main components and functions:

Key Components

1- Transmitter: Generates radio waves and sends them into space.

2- Antenna:

Transmits the radio waves into a desired direction.

Receives the reflected waves (echoes) from objects.

3- Receiver: Processes the returned echoes to extract information.

4- Processor/Display Unit: Analyzes the data and displays it as images or signals for interpretation.

How Radar Works

1- Transmission: The radar emits a burst of radio waves.

2- Reflection: These waves travel through space, hit objects, and are reflected back toward the radar.

3- Reception: The radar antenna picks up the returning signals.

4- Processing: The time delay between transmission and reception, along with the strength of the reflected signal, helps calculate:

Distance to the object.

Speed of the object (using the Doppler effect).

Direction or bearing of the object.

Applications of Radar

Weather Monitoring: Detecting rain, storms, and other weather phenomena.

Air Traffic Control: Tracking and guiding aircraft.

Military: Detecting and tracking ships, planes, and missiles.

Maritime Navigation: Avoiding obstacles at sea.

Automotive: Advanced driver assistance systems like adaptive cruise control.

Space Exploration: Mapping surfaces of planets and moons.

 

Operation of the radar controlled by Micro:bit:

A radar system controlled by Micro:bit, a servo motor, and an HC-SR04 ultrasonic sensor operates as a scanning or sweeping radar that maps its surroundings by detecting objects and measuring distances. Here's how it works:

1. Initialization:

The Micro:bitinitializes the servo motor and ultrasonic sensor.

It connects to the PC via USB or Wi-Fi, depending on the setup.

The PC runs visualization software (e.g., a Python script with libraries like Matplotlib or Processing for graphics).

2. Servo Scanning:

The Micro:bit controls the servo motor to rotate the sensor incrementally over a specified range (e.g., 0° to 180°).

At each angle, the Micro:bit pauses momentarily to allow the sensor to make an accurate distance measurement.

3. Distance Measurement:

- The HC-SR04 emits an ultrasonic pulse when triggered by Micro:bit.

- It measures the time taken for the echo to return after bouncing off an object.

- The Micro:bit calculates the object's distance.

4. Data Transmission:

The Micro:bit sends the angle and measured distance to the PC in real time using serial communication (via USB or Wi-Fi).

5. Visualization:

- The PC software receives the data and plots it dynamically.

- A polar graph is typically used, where:

Angles represent the servo position.

Radii represent the measured distances.

- The screen updates continuously as the radar sweeps back and forth.

6. Continuous Scanning:

- Once the servo reaches its maximum angle (e.g., 180°), the Micro:bit reverses the servo's direction for another sweep.

- The process repeats to create a continuous radar-like display.

Radar components

Micro:bit:

Micro:bit board

Controls the radar system, collects data from the HC-SR04, and sends it to the PC for display.

The GPIO expansion card for the Micro:bit card

The GPIO expansion card for the Micro:bit card

The GPIO expansion board for the Micro:bit board expands the capabilities of the Micro:bit board by adding more input/output (GPIO) pins and additional functionality.

Servo Motor:

Rotates the HC-SR04 sensor to enable scanning over a range of angles.

HC-SR04 Ultrasonic Sensor:

HC-SR04

Measures distance by emitting ultrasonic waves and calculating the time it takes for the echo to return after bouncing off an object.

PC:

Displays the radar's data as a visual map (e.g., polar plot) via a connected program (like Python or Processing).

 

Radar mounting

HC-SR04:

Connect the VCC and GND pins to the Micro:bit’s 3.3V and GND pins, respectively.

Connect the Trigger (TRIG) and Echo (ECHO) pins to P2 et P1  pins on the Micro:bit.

Servo Motor:

Connect the servo's power (usually red) to a 5V supply.

Connect the ground (black/brown) to the Micro:bit’s GND.

Connect the control (signal) wire (yellow/white) to P0 pin on theMicro:bit.

 

Programing the system

Here’s two  programs with Python to control a radar system using Micro:bit, a servo motor, an HC-SR04 ultrasonic sensor, and a PC for visualization.

Programming the Micro:bit board with Makecode

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

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

3- Go to advanced :

4- Go to Pin and choose 'servo write pinP0 to 180' instruction :

5- Go to Serial and choose 'serial write line' instruction to send data to computer :

6- Use the blocks to control the servo motor to rotate the hc-SR04 sensor.

7- Add the HC-SR04 extension:

Look for "Extensions" and click on it.

In the search box, type "sonar" to find the HC-SR04 extension.

7- Now, you can start programming the Micro:bit using this Makecode program :

Download program

Python program executed by the computer

 

Test the System

1- Upload the micro:bit script and connect the setup to the computer.

2- Run the Python visualization script on the computer.

3- Observe the radar sweep displaying object distances on the polar plot.

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

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info