Vehicle Sharing | Maqueen Plus Advanced Tutorial Lesson 2
userhead
ShadowNie 2021-05-21 16:11:32
projectImage

With the development of society, all kinds of sharing transportation systems are shown in our daily life, such as, sharing bikes and sharing vehicles.

The promotion of the concept of "sharing", on the one hand, satisfies the consumers driving demand; on the other hand, it avoids the waste caused by idle vehicles and ineffective utilization of resources.

Here we are going to make a sharing vehicle with Maqueen Plus and HUSKYLENS.

projectImage

Function

This project aims to realize face unlock on Maqueen Plus with the face recognition function of HUSKYLENS. The mileage is calculated by the formula after counting the revolution the wheel turns via encoders. When you don’t want to use the vehicle anymore, just press button A to return it. Meanwhile, the OLED screen will display mileage, duration, and cost.

Bill of Materials

projectImage

Hardware Connection

Connection Diagram: Both the HUSKYLENS sensor and the OLED screen use I2C interfaces, so you need to pay attention to the wiring order and avoid wrong connections.

projectImage

Assembly Diagram: The HUSKYLENS sensor comes with a bracket structure which can be screwed on the Maqueen Plus. And the sensor can be freely adjusted among certain angles. The OLED display can also be screwed to the Maqueen Plus car.

projectImage

Knowledge Field

Like other biological characteristics of the human body (fingerprint, iris, etc.), human face is inherent, unique and unrepeatable. It is the first kind of image that has been studied, and also the widely used one in the field of computer vision. This project is making use of the face recognition of HUSKYLENS.

1. What is Face Recognition?

Face recognition is a biological recognition technology for identity recognition based on information about facial features. It uses a camera to collect images and videos containing human faces and automatically detects and tracks the faces, then performs a series of analytical techniques of the detected faces.

projectImage

2. Operating Principles of Face Recognition

There are four key steps of face recognition:

projectImage

 

Here is a brief explanation of these four steps.

Face Detection: detect the face positions and select them by frames.

Face Alignment: recognize faces from different angles by locating the features.

Face Encoding: extract face information and make it understandable for a computer.

Face Match: match the face information with the existing database to get a similarity score and give out the matching result.

3. Application Scenarios of Face Recognition

Access Control System: through face recognition, the identity of the person entering into the protected areas such as prisons, detention houses, neighborhoods, schools and houses, can be recognized.

Camera Monitoring System: It can be used for monitoring the crowd in public places such as banks, airports, stadiums, shopping malls, and supermarkets.

Internet Application: Make use of face recognition as assistance for online payment to prevent others from embezzling credit cards and social security.

At present, face recognition is widely used in all walks of life, such as attendance system, unlocking phones, the all-in-one machine of human identity verification, face payment and so on.

 

projectImage

4. Demonstration of HUSKYLENS Face Recognition

1. Select “Face Recognition” Function

Dial the “function button” to the left till “face recognition” is displayed at the top of the screen.

projectImage

2. Learn Faces

Point HUSKYLENS at the area with faces on it. When a face is detected, it will be automatically selected by a white frame with the word "Face" on the screen.

projectImage

Point the “+” symbol at the face that needs to be learned and short press the “learning button”. If the same face is detected by HUSKYLENS, a blue frame with words "Face: ID1" will be displayed on the screen, which indicates that HUSKYLENS has learned the face before and can recognize it now.

projectImage

Note: Long-press the “learning button” then let HUSKYLENS learn the face from different angles.

*If there is no “+” symbol on the screen, it means that HUSKYLENS has already learned it in the current function. When HUSKYLENS is in the face recognition mode, short press the "learning button", the screen will display "click again to forget". Before the countdown ends, short press the "learning button" again to delete the learned face information.

projectImage

If you want to learn multiple faces, long-press the “function button” to enter the submenu of face recognition and move the “multiple learning” bar to the maximum value (far right).

projectImage

Different from single face learning, in Multiple face learning mode, the learned face information will be named in order, such as face: ID1, face: ID2, face: ID3... And different face IDs have different frame colors.

projectImage

 

1. Short press the "learning button" before the countdown ends to learn the second face.

2. For learning the third face, short press“learning button”before the countdown ends.

Note: The face learning is done when the countdown ends.

The information of the learned face will be automatically saved. When the camera detects the learned face from multiple faces, it will select the learned face with a frame and display the corresponding ID number.

 

projectImage

Project Practice

How do we use face recognition of HUSKYLENS in sharing vehicles? How does it count the mileage and cost? Let’s finish this project with three steps.

First, learn how to use the face recognition function of HUSKYLENS, and scan the face to unlock the vehicle; then, learn how to count the mileage and duration; finally, complete the whole project and display relevant information.

Task1: Unlock Maqueen Plus with Face

1. Program Design

Step1: Face Learning and Recognition

Here we can let HUSKYLENS learn a few face images at will. (Note: Turn on the "multiple learning" function first)

projectImage

Step2: Instruction Learning

projectImage
projectImage

Step3: Function Analysis

Assuming there are only three faces, the program is easy to implement. As shown in the figure below, we just need to determine them one by one.

projectImage

But how do we achieve it with the program when we have to learn five, ten, or more faces? Should we determine them one by one? That's a little verbose, and makes the program lengthy. Do you find any patterns in the above program?

In fact, as long as we add a variable, we can greatly simplify the repetitive part of the above program. The program is as follows:

projectImage

According to the above program, we may find that the Maqueen Plus can not stop after it is started? If another person wants to unlock it, they can only cut off the power and restart. So, we still have to improve this program. When the Maqueen Plus is not used, the stop of Maqueen Plus will be triggered by its button pressed. And We only need to scan the face one more time for the next use.

projectImage

2. Sample Program

projectImage

 

3. Operating Effect

projectImage

Task2: Pricing

1. Program Design

Step1: Charging Formula

How do we charge users for sharing vehicles? To figure out the final cost, we need to calculate the following figures. The calculation formula is shown in the following table:

projectImage

Assume that the charging standard of the sharing vehicles is: 1yuan/km+0.1yuan /min.

Step2: Instruction Learning

projectImage

Step3: Function Analysis

In real life, the charging starts at the point of unlocking, and ends when the vehicles returned.

Corresponding to our project, when the face is recognized, it starts to record the mileage and duration; when the A button is pressed, the end time and final mileage are recorded. Finally, it will calculate the duration and cost through the formula. The program flowchart is shown as follows.

projectImage
projectImage

2. Sample Program

projectImage

 

3. Operating Effect

projectImage

Task3: Set A Flag Bit to Realize Charging Reset

1. Program Design

Step1: Instruction Learning

projectImage

Step2: Function Analysis

From life experience, after each user has paid the fee, the sharing car will re-record the mileage, duration and cost when it is restarted.

Corresponding to our project, after the ID1 user has paid the fee, when the ID2 user uses the car, the mileage, duration, and cost will be recalculated.

On the basis of the task2, we need to add that when the Maqueen Plus stops and detects the face again, it will reset the tire revolutions and duration. The program flowchart is as follows.

projectImage

2. Sample Program

projectImage

 

3. Operating Effect

After the user ID1 finishes using, if the user ID2 scans the face to unlock the Maqueen Plus car, the car starts. The data of the user ID1 will be reset and data recording restarts.

FILE
Program.zip 883KB Download 0
License
1
All Rights
Reserved
[[i.text]]
licensBg
0
0
COMMENTS ([[commentTotla]])
[[c.user_name]] [[c.create_time]]
[[c.parent_comment.count]]