Emergency Lane Watchdog | Study Pack of HUSKYLENS for micro:bit 12

userhead
Meimei Aug 08.2022

Lesson 12: Emergency Lane Watchdog

The emergency lane is the only "passage of life" for rescue vehicles in the event of an emergency.

According to the Road Traffic Safety Law, except for police cars, engineering rescue vehicles, and ambulances that perform emergency tasks, other motor vehicles are not allowed to enter the "emergency lane".

projectImage

With the increasing number of vehicles, road traffic is seeing mounting pressure. At the same time, the violation of highway emergency lanes takes up a great proportion of all kinds of traffic violations, which need to be tackled urgently. Currently, people mainly deal with it through patrol cars and manual photography. However, these two methods are extremely inefficient, costing manpower and material resources greatly and bringing inconvenience to management. 

projectImage

So, for intensifying investigation and punishment of occupation of emergency lanes, how can we use HuskyLens to make an emergency lane watchdog make up for the shortage of the two traditional methods?

Learning Goals

1. Use the program to trigger the camera function

2. Use the HuskyLens to make an emergency lane watchdog

Preparation

projectImage

Note: The memory card is not included in this kit.

Learning Contents

How to judge whether the vehicle occupies the emergency lane? We can make it by installing a camera above the emergency lane. In this case, when HuskyLens detects that a vehicle is in the lane, it will take a picture of it, and then use the flashing RGB lights to warn the vehicle to leave quickly.

Later, the traffic police only need to check the photos in the memory card to know which vehicles have occupied the emergency lane in violation of regulations, which can save them a lot of time and energy.

HuskyLens Object Recognition Function Demonstration

1. Detect Objects

Align HuskyLens to the target object – car, there will be a white box to select it automatically and its name will be displayed as well on the screen.

projectImage

2. Mark Objects

Firstly, align HuskyLens to the target object. When it is detected and its name is displayed on screen, align the “+” on screen to the center of the white box of the object, short press the "learning button" to mark it. At this point, the color of the box will change from white to blue, and the name and ID1 of the object will be displayed as well.

projectImage

3. Recognize Objects

When HuskyLens comes across objects it marked again, there will be a blue box to select them on the screen, as well as their names and ID.

projectImage

Note: For this project, the functions of learning multiple objects and learning a single object are both suitable.

Project Practice

Next, we will complete this project by dividing it into two tasks. First, we must use object recognition and camera functions of HuskyLens to take photos of the vehicles peccancy in the emergency lane. Then add the alarm warning function on the basis of the previous function.

Task 1: Vehicle Photo

In the program, all the vehicles appearing on the HuskyLens screen will be regarded as vehicles that occupy emergency lanes illegally and HuskyLens will take pictures of them.

Task 2: Alarm Warning

Based on task 1, add RGB lights and alarm to warn the vehicle to leave the emergency lane.

Task 1: Vehicle Photo

Hardware Connection
projectImage
Program Design

Function Description:

When HuskyLens detects that there is a vehicle in the emergency lane, it will display “shooting” on screen (x=230, y=10) and take a picture, which will be stored on the SD card.

Program Flow Chart Analysis:

projectImage

Sample Program:

projectImage
projectImage

Operating Effect

Run the program. The word "Please learn" will be displayed on the screen until HuskyLens learns something. After learning the car, when HuskyLens detects it, the word "shooting" will be displayed on the screen.

projectImage

Task 2: Alarm Warning

Hardware Connection

projectImage
Program Design

Function Explain

When the HuskyLens detects that vehicles are occupying the emergency lane illegally, how to signal them to leave quickly? In this case, we can warn the vehicles by the alarm sound and flashing RGB lights.

Program Flow Chart Analysis:

projectImage
projectImage

Sample Program:

projectImage

Operating Effect

Run the program. When HuskyLens detects a car occupying the emergency lane, it will take a picture of it, and then make some lights and alarm sound to warn the car to leave the lane quickly. Besides, you can also view the photos of vehicles on the memory card through the card reader.

projectImage

Project Review

In this project, we have used the function of object recognition and triggered the camera function by program judgment. That is, it will take a picture once the car is recognized. Moreover, the project can also remind the vehicles occupying the emergency lane to leave by lighting up RGB lights and making alarm sounds.

The emergency lane watchdog, to a large extent, saves traffic police a lot of time and energy. Their work efficiency can be improved owing to the fact that manual photography is no longer required. Because they can know which vehicles have illegally occupied the emergency lane by checking the picture on the memory card.

Project Expansion

projectImage

You can use waste corrugated paper to draw a complete lane, and then fix HuskyLens above the emergency lane to ensure that HuskyLens can detect vehicles in it.

License
1
All Rights
Reserved
[[i.text]]
licensBg
0
0
COMMENTS ([[commentTotla]])
[[c.user_name]] [[c.publish_time]]
[[c.parent_comment.count]]