SKU_MBT0050_Maqueen_Plus_V3-DFRobot

1. 产品简介

In the field of STEM robot education in primary and secondary schools, traditional teaching and competition methods are facing many challenges. In the current STEM robot competitions, the insufficient performance and functions of the car result in a single and shallow competition rule. Students often can only compete in speed and fluency in the line-tracking function, making it difficult for them to fully exert their creativity. The competition scores are also difficult to be differentiated, and it is impossible to evaluate students' abilities and levels fairly and objectively.

The emergence of the Maqueen Plus V3 educational robot has brought changes to this situation. It is an innovative product specially designed for advanced teaching and competitions of STEM robots in primary and secondary schools.

Matrix laser ranging sensor

The STEM educational robots on the market are generally equipped with ultrasonic ranging sensors, but they can only measure the distance of obstacles in the front and cannot detect the position, resulting in monotonous application gameplay. Maqueen Plus V3 is standardly equipped with a matrix laser ranging sensor, whose accuracy and response speed are much better than ultrasonic sensors. Within the 60-degree angle detection range, it can not only accurately measure the distance of obstacles, but also obtain the position of the obstacles in the front, plan the driving route in advance, and effectively avoid obstacles, providing more accurate perception ability for the robot's movement.

The matrix laser ranging sensor can be set in 88 matrix mode and 44 matrix mode. In the 4*4 mode, the ranging speed can reach up to 60 frames per second. The laser beam has a 60-degree angle. When avoiding obstacles, it can be used to measure low or high obstacles, or to detect obstacles at different positions on the right or left respectively.

Motor encoder and PID control

Many STEM educational robots are not equipped with motor encoders and cannot accurately control the forward distance and steering angle of the car. They can only roughly control it through the "delay" function, and the debugging is cumbersome. Maqueen Plus V3 adds a motor encoder, which can accurately control the forward distance and steering angle of the car without repeated debugging. It performs well in scenarios that require accurate driving distance, providing a more reliable motion control guarantee for teaching and competitions.

Built-in line-tracking algorithm

Line-tracking is a key link in STEM robot teaching and competitions. However, the line-tracking functions of most STEM cars are unsatisfactory, often leading to line-tracking failures or poor effects, and the competition results overly rely on the stability of line-tracking. Maqueen Plus V3 directly integrates the line-tracking algorithm at the bottom layer. Students can directly use the line-tracking function, reducing the threshold of line-tracking. This innovation not only makes basic line-tracking no longer determine the success or failure of the competition, but also promotes the design of more abundant and creative competition task gameplay, guiding students to invest their energy in task points other than line-tracking. At the same time, because the line-tracking algorithm is built in the bottom-layer chip, the regular line-tracking function can be completed with only basic configuration, which is equivalent to having an additional independent computing core. micro:bit can achieve more functions such as obstacle avoidance, flashing lights, playing music, reading sensors and switching images at the same time of line-tracking without mutual interference.

Built-in intersection recognition algorithm

Most STEM cars lack the intersection recognition function. Even if there is related hardware, it is difficult to apply due to insufficient software support and complex algorithms, resulting in monotonous competition maps and task routes. Maqueen Plus V3 integrates a new intersection recognition function in the bottom chip, which can recognize crossroads, T-intersections, left-turn and straight intersections, and right-turn and straight intersections in real time. In STEM educational robot competitions, this function enables the design of various intersections, allowing students to complete different tasks on different routes, greatly enriching the diversity and fun of the competition.

Detachable metal motor components

Maqueen Plus V3 adopts finely parameter-matched metal motors. Through repeated tests and verifications of more than 30 types of motor samples, it is carefully adapted in terms of performance, reliability, and speed, with smooth rotation without stalling. At the same time, the motor is protected as a whole to avoid the exposure of the gearbox and reduce the risk of debris entering and damaging the motor. In advanced teaching and competitions, the car is used frequently, the brush is prone to wear, and the motor may also be damaged by students' careless squeezing and dropping. Maqueen Plus V3 adopts a detachable motor design. When the motor is damaged, it can be quickly replaced to avoid affecting teaching and competitions. In addition, a dedicated voltage stabilizing chip for the motor is added to ensure that the running speed of the car is not affected by the attenuation of the battery voltage, the speed is stable, and the program can run well without modifying parameters.

Light seeking, light following, light avoiding, automatic vehicle headlights

Light perception is one of the important functions of robots. Maqueen Plus V3 has two on-board light intensity sensors on the left and right sides in the front of the car. It has the ability to locate the light source position and detect the light intensity, and can realize interesting applications such as light seeking, light following, light avoiding, and automatic vehicle headlights. It can quickly arouse students' interest in robots and add more fun and exploration space for teaching and practical activities.

Colorful car headlights and ambient lights

Maqueen Plus V3 adopts 2 oversized color RGB front headlights and 4 color RGB ambient lights. The lights cooperate with the sensors and attract students with their colorful charm, stimulating students' creativity and imagination.

2. Function difference table of Maqueen Plus V2 / V3

Name Maqueen Plus V2 Maqueen Plus V3
WS2812 RGB ×4
Infrared receiving sensor×1
Bottom acrylic protection
Buzzer×1
Line-tracking sensor calibration function
Ultrasonic distance sensor Upgrade to matrix lidar
LED Car headlights ×2 Upgrade to RGB lights
RGB Car headlights ×2 ×
Matrix laser sensor ×
Light sensor ×2 ×
Motor encoder and PID control ×
Chip-level built-in line-tracking function ×
Chip-level built-in intersection recognition function ×
The motor is detachable ×
Special voltage stabilizing circuit for the motor ×
The firmware is upgradable ×
Adjustable-angle metal bracket ×
Whether it supports the unihiker Board K10 ×
Does the user need to assemble ×

3. Product parameters

3.1 Power parameters

3.2 Line-tracking sensor

3.3 RGB light

3.4 Light sensor

3.5 Matrix laser sensor

3.6 Motor

3.7 Motor encoder and PID

3.8 Infrared receiver and buzzer

3.9 Expansion interface and other configurations

4. Safety Precautions

Since Maqueen Plus is a STEM education product and is presented in a bare - board form, the following safety precautions should be noted during use:

  1. The use of batteries must strictly comply with the battery usage methods and safety precautions. Otherwise, it may damage the product and cause risks such as overheating and combustion.
  2. Do not touch the product, especially the circuit board part and the battery part, with sharp objects like screwdrivers. This is to avoid damaging components or causing danger.
  3. Do not touch the product's circuit board with metal objects to prevent short - circuits, which can damage the product and lead to risks such as overheating and combustion.
  4. The product is not waterproof and should not come into contact with liquid substances such as water and beverages. If liquid is accidentally spilled on the product, immediately turn off the power and remove the battery. Only attempt to power it on after the moisture has completely dried.
  5. When storing the product, do not stack multiple products together to avoid component damage, and even the risk of power short - circuits, which may cause fires and personal injury.

5. Usage methods and safety precautions of AA batteries

5.1 The AA batteries supported by Maqueen Plus V3

If you purchase the AA battery version of Maqueen Plus, it supports two specifications: 1.5V AA batteries and 1.2V nickel-metal hydride rechargeable AA batteries. When purchasing batteries, please be careful not to buy AAA batteries. AA batteries can be purchased in most supermarkets. It should be noted that 1.5V alkaline batteries are disposable batteries and cannot be charged. Otherwise, explosion or fire may occur.

5.2 Rechargeable nickel-metal hydride batteries

The nickel-metal hydride rechargeable battery is a type of rechargeable battery that is safer than lithium batteries and less prone to explosion and fire, with a voltage of 1.2V per cell. The size of the nickel-metal hydride battery is the same as that of the AA alkaline battery. Considering the danger that users might mistakenly charge alkaline batteries, Maqueen Plus has not designed an on-board charging circuit. Therefore, if you need to use nickel-metal hydride batteries, you need to purchase a nickel-metal hydride rechargeable battery and charger set.

Note: No matter what type of AA battery is used, when installing, it is necessary to pay attention to the positive and negative electrodes of the battery corresponding to those on the battery box and must not be installed reversely.

  1. Usage methods and safety precautions of 18650 lithium batteries

6.1 Function description

  1. The rechargeable battery version of Maqueen Plus V3 is powered by a 3.7V 18650 rechargeable lithium battery. Do not use other types of batteries.
  2. Supports pointed-tip batteries (67mm) and batteries with protection boards. Does not support flat-head batteries (65mm. The size of flat-head batteries is too short and may result in poor contact). As shown in the picture:

  1. Maqueen Plus has its own charging function and uses the TYPE-C or MicroUSB interface to charge the battery.

  2. Please use a charging head with guaranteed quality, a voltage of 5V, and a current of 2A or more to charge the battery. Currently, most mobile phone chargers can charge the lithium battery. When charging, the outer ring of the battery indicator light will show red. When fully charged, it will show green. As shown in the picture:

  1. Do not insert the MicroUSB and TYPE-C interfaces for charging simultaneously. Although Maqueen Plus has relevant protection inside, this is an operation that is not allowed.
  2. The charging time is about 4 hours to be fully charged.

6.2 Safety precautions of 18650 lithium batteries

The 18650 battery is a type of high-capacity battery and needs to be used in the correct way; otherwise, safety accidents such as overheating, explosion, and fire may occur.

6.2.1 Battery storage

  1. Batteries should be stored in a cool and dry environment.
  2. Batteries cannot be placed in areas with water, let alone soaked in water. Water is a conductor and can cause short circuits and overheating of the battery.
  3. Batteries cannot be stored in high-temperature or high-humidity environments, as it will intensify the battery's reaction, resulting in reduced lifespan or capacity.
  4. Batteries cannot be placed together with conductive objects such as metals, as it can easily cause short circuits of the battery.
  5. The insulating tape of the battery should not be damaged, as it can easily cause short circuits of the battery.
  6. If the 18650 battery is not used for a long time, it should be removed from the device and stored in an insulating box. For devices where it is not convenient to remove the battery, the main power switch of the device should be turned off to avoid improper placement causing short circuits of the battery.
  7. Batteries should be stored in places that are not easily accessible to children to avoid safety accidents.
  8. People under the age of 14 should use 18650 batteries under the guidance and supervision of adults.

6.2.2 Safety matters regarding battery usage

  1. During the use of Maqueen Plus, it is not allowed to touch the circuit board and battery parts with any conductive objects, such as tweezers, pliers, screwdrivers, etc., to avoid short circuits that damage the equipment or cause danger.
  2. After use, the "POWER SWITCH" on the battery board needs to be turned off in time. Long-term power-on may cause equipment damage, battery over-discharge, and even short circuits that cause fires and other dangers.
  3. When using the 18650 battery, the positive and negative electrodes need to be distinguished. Incorrect installation may lead to equipment damage, fire, explosion and other dangers.

Important safety tip: The entire cylinder of the 18650 battery is the negative electrode. On the cylindrical surface of the 18650 battery, there is a layer of insulating tape wrapped. Do not damage the tape. If the tape is damaged, the negative electrode metal surface will be exposed. When the metal surface of the cylinder touches the positive electrode with a metal object, the battery will short circuit. Do not attempt to short-circuit any negative electrode position and positive electrode position with metal items such as screwdrivers and tweezers! Any battery short circuit can cause dangers such as overheating, fire and even explosion!

6.2.3 Safety matters regarding battery installation

  1. Pay attention to the 18650 battery board on Maqueen Plus. The positive and negative electrodes are marked in multiple places on the battery board. See the picture below:

  1. Before installing the battery, please note that the power switch labeled "POWER SWITCH" needs to be switched to the "OFF" side to turn off the power of Maqueen Plus. As shown in the picture:

  1. When installing the battery, the "+" mark of the battery faces the "+" mark direction of the battery board, and the "-" faces the "-" mark direction. And put the battery pull strap on the battery. As shown in the picture below.

The 18650 battery needs to be installed by the teacher or under the guidance of the teacher. Do not allow children or students to install the 18650 battery by themselves to avoid danger.

6.2.4 Safety matters regarding battery disassembly

When you need to disassemble the 18650 battery from Maqueen Plus, please be sure to pay attention to the following points:

  1. Do not directly pull out the battery with your fingers. To ensure reliable contact of the battery, the 18650 battery box is installed very tightly. If you directly pull it out with your fingers, it is easy to cause serious damage to your fingernails.

  1. Do not pry the battery with any sharp objects such as a screwdriver. It is easy to cause a short circuit and explosion of the battery and hurt your eyes and body.

  1. To remove the battery, a "battery pull strap" is required. Gently pull the battery out of the battery compartment.

7. POWER SWITCH

  1. For the safety of use, Maqueen Plus is equipped with two power switches. They are respectively located on the battery board and the bottom plate of the car. It can operate normally only after both switches are turned on. As shown in the picture:

8. Installation methods of the battery board and the metal bracket

Maqueen Plus V3 in order to give students a certain assembly experience, the battery board and the metal bracket were not installed during production.

The specific installation methods are as follows:

8.1 Tool Preparation

8.2 Install the battery board

  1. Install the 35mm supporting copper columns, which need to be screwed in place to ensure the flatness of the battery board after installation. Due to the differences in the thread manufacturing process, some copper columns may not be easily screwed in place. At this time, please use pliers to assist in the installation appropriately. But do not install it violently to avoid damaging the thread. The installation position is as shown in the picture:

  1. Use screws to install the battery board on the copper columns, as shown in the picture:

  1. Install the connection line, as shown in the picture:

8.3 Install the metal bracket and the laser ranging sensor

  1. Install two 35mm copper columns at the position as shown in the picture:

  1. Use hand-twisted screws to install the adjustment bracket on the battery board. Please note that the front and rear directions of the bracket in the picture should not be installed wrongly, otherwise it will block the USB interface of the micro:bit, as shown in the picture:

  1. Use hand-twisted screws to install the sensor fixing bracket, as shown in the picture:

  1. Install the sensor, as shown in the picture:

8.4 The form after installation is completed

9. Motor replacement method

Maqueen Plus V3 adopts a design with replaceable motors. If the motors are damaged due to high-intensity use or being dropped, they can be replaced in the following way.

9.1 Remove the motor

  1. Turn off the power of Maqueen Plus V3.
  2. Pull out the two wheels.
  3. Pull out the connection lines on the motor. As shown in the picture:

  1. Use a screwdriver to unscrew the 4 motor screws at the bottom. As shown in the picture:

The motor disassembly is completed.

9.2 Install the motor

  1. Install the buckle on the motor, as shown in the picture:

  1. Install the motor on the base plate, as shown in the picture:

  1. Install the connection line. This position is not very easy to install and requires some patience, as shown in the picture:

  1. Install the wheels. When installing the wheels, pay attention to align the plane of the motor shaft with the plane of the wheels to avoid failure to install or damage to the wheel shaft hole. As shown in the picture:

10. Calibration method of the line-tracking sensor

The line-tracking sensor has been calibrated before leaving the factory. Usually, you don't need to calibrate it. If it is found that the line-tracking sensor cannot correctly recognize the black line, you can try to calibrate the line-tracking. The method is as follows:

  1. Place the 5 probes of the line-tracking sensor on the black area at the same time. (Make sure that all 5 probes are in the black area)
  2. Turn on the power of Maqueen Plus.
  3. Press and hold the "Calc-Key" button for about 2 seconds. The line-tracking indicator light starts to flash, and then release the button. The calibration is completed.
  4. Check the calibration result: Put the line-tracking sensor on the white background, the line-tracking indicator light goes out. Put it on the black background, the line-tracking indicator light is on. The calibration is correct.

Note: The line-tracking sensor uses the grayscale detection method to recognize the black line. Therefore, not all black lines can be effectively recognized. For materials that cannot be recognized, even if calibrated, they cannot be correctly recognized. For example, laser-printed maps may not be recognized.

11. Example tutorial based on MakeCode programming

11.1 Open the MakeCode platform and load the library

Click the link to enter the MakeCode graphical programming platform: https://makecode.micro:bit.org/

Click "New Project" to create a new project, as shown in the picture:

In the pop-up dialog box, give a name to the project and then click "Create", as shown in the picture:

Load the Maqueen Plus library:

Click the "Settings icon" and then click "Extensions", as shown in the picture:

Load the Maqueen Plus library: Search for dfrrobot in Extensions, and then select

"DFRobot_MaqueenPlus_V2", as shown in the following picture:

Note: Maqueen Plus V3 and Maqueen Plus V2 use the same library. To ensure that the link does not change, the name of the library is still V2, but all the functions of V3 have been integrated.

The loading of the library is completed. The loaded library is shown in the picture. It will contain the libraries of both the infrared and the matrix laser ranging sensors at the same time.

11.2 Start Maqueen Plus V3

Function description

Example 1: Start Maqueen Plus V3

Program description:

Program link: https://makecode.micro:bit.org/_dfr45o7rcdv8

11.3 Car turning and RGB light control

Program description:

Program link: https://makecode.micro:bit.org/_ejPPVsACU8FK

11.4 Quickly start line tracking

Function description

The quick line tracking function is a unique feature of Maqueen Plus V3. It integrates the line tracking function into the underlying chip. Students can use the line tracking function with just one black, reducing the threshold for line tracking. This not only makes basic line tracking no longer determine the success or failure of the competition but also promotes the design of more abundant and creative competition task gameplay, guiding students to invest their energy in task points other than line tracking. At the same time, because the line tracking algorithm is built into the underlying chip, it is equivalent to having an additional independent computing core. The micro:bit can achieve more functions simultaneously while line tracking, such as obstacle avoidance, flashing lights, playing music, reading sensors, etc., without interfering with each other.

Example 1: Quick line tracking

Program description:

Program link: https://makecode.microbit.org/_P7HKPV54PehD

11.5 Regular line tracking program

Function description

Maqueen Plus V3 is onboard with 5 line tracking sensors. When a black line is detected, the output state value is 1. When a black line is not detected, the output state is 0. Utilizing the sensors' sensitivity to the black line, it is used for line tracking.

Example 1: Line tracking robot

Description:

This example demonstrates the method of reading the states of 3 line tracking sensors to achieve the function of line tracking.

Program link: https://makecode.microbit.org/_V8xD5XKJj89z

Example 2: Reading the values of the analog quantities of the line tracking sensors

Description:

This example demonstrates how to read the analog quantity of the line-following sensor and display it on the computer. Through the reading of the analog quantity, the difference between the value of the line-following sensor on the black line and the value on the white background can be intuitively seen. At the same time, different values of the analog quantity can also be used for different instruction controls.

Program link: https://makecode.microbit.org/_Mw0LU8RxsFVb

Reading result:

In the figure below, the No. 1 data is on a white background, about 3800 or so, and the No. 2 data is on a black background, about 2700 or so. For the two different backgrounds, the analog quantity differs by about 1100. Through the difference, black and white can be distinguished.

11.6 Light sensor - Light-avoiding and light-chasing robots

Function description

Maqueen Plus V3 has a light sensor built in on each of the left and right sides at the front. This sensor can detect the intensity of light. Through the difference in light intensity on both sides, the car can avoid the light or travel in the direction of the light.

Example 1: Light-avoiding robot

Program description:

Program link: https://makecode.microbit.org/_C6C8o4atEhdK

Example 2: Light-chasing robot

Program description:

Program link: https://makecode.microbit.org/_WKAcLVAb8dRf

11.7 Infrared remote control (The infrared remote controller is not configured by default)

Function description:

Maqueen Plus V3 has a built-in infrared receiving sensor, which is connected to the P16 pin of the micro:bit. It can receive the transmission signal from the infrared remote controller. By identifying the values of different keys of the infrared remote controller, the car can perform different actions and be used for functions such as remote controlling the robot.

Maqueen Plus V3 does not come with an infrared remote controller by default. If you need to use this function, please contact the sales staff to purchase it separately.

Position as shown in the figure:

The following table shows the keys of the infrared remote controller and the corresponding key values for your reference:

Example 1: Read the value of the infrared remote controller

Program description:

This example demonstrates displaying the received key value of the infrared remote controller on the serial monitor. The key value is displayed in decimal format.

Program link: https://makecode.microbit.org/_YtsLyx2FXfua

Point the remote controller at the infrared receiving sensor and press any key as shown in the figure:

Then the button as shown in the figure will appear. Click this button to enter the data display page:

Try pressing other keys of the infrared remote controller. The corresponding key values will be displayed on the page, as shown in the figure:

Example 2: Infrared remote control of the car

Program description:

This example demonstrates how to control the car to move forward, turn and stop using the infrared remote controller.

Program link: https://makecode.microbit.org/_LAeTMtfvfi8k

11.8 Intersection recognition

Function description:

The Maqueen Plus V3 has an intersection recognition function built into the chip level. It can recognize intersections, T-intersections, left and straight intersections, and right and straight intersections on the black line. As shown in the figure below. Through the recognition of different intersections, different routes can be set for the car during the line-following process.

Example 1: Recognize intersections in the setting mode

What is the setting mode?

The setting mode refers to the advance setting of the detection of intersections and the execution method of the car. The advantage of this method is that it can be set once under the "on start" of the program, and the car can work in the background according to the set method all the time. There is no need to call repeatedly in the loop program.

Advantages:

It can greatly reduce the difficulty of program design and reduce the occupation of program resources. Disadvantages:

  1. The intersection recognition function in the setting mode can only be used in the built-in line-following mode. It cannot be used in other modes.
  2. If more complex applications are needed, it requires multiple uses and attempts to understand the usage method of its functions.

Program description:

Program link: https://makecode.microbit.org/_0b7V7f1L18hg

Example 2: Intersection recognition in the query mode

What is the query mode?

The query mode refers to continuously querying the status of the current intersection in the loop program and returning the status of the intersection in real time. It is similar to the method of using the sensor reading module.

Advantages:

Flexible to use, can be used independently, and does not need to be bound to the built-in line-following function.

Disadvantages:

Data must be read continuously within the loop program, and there cannot be a "delay" in the program, otherwise data may be missed.

Program description:

This example is only for demonstrating the intersection recognition function. Therefore, the car does not move. After downloading the program, just place the car at different types of intersections to complete the recognition test.

Output number 1: Intersection Output number 2: T-intersection Output number 3: Left turn and straight Output number 4: Right turn and straight

Program link: https://makecode.microbit.org/_azDgH50yjhE1

Example 3: Driving along the specified route

插入图片

Program description:

This is a comprehensive application example that uses three functions: the query mode, the setting mode, and the built-in line-following. The functions implemented by the application are as follows: Just like car navigation, in the map as shown in the above figure, let the car drive along the red arrow direction shown in the illustration.

During the route, the car needs to pass through three intersections, two T-intersections, and two right and straight intersections, but the turning directions may be different. In the program, it is necessary to adjust the forward direction of the intersection in a timely manner.

Execution process:

  1. Go straight at the first intersection ahead. And, if you encounter an intersection again ahead, turn left.
  2. After passing the intersection, you come to a T-intersection. At this time, the car needs to turn right.
  3. After turning right at the T-intersection, there is an intersection ahead. At this time, the car turns left.
  4. Soon after turning left, you encounter a T-intersection again and still turn right.
  5. After turning a corner, you encounter a right and straight intersection ahead. Turn right at this time.
  6. After turning right, there is another right and straight intersection. Go straight at this time.
  7. Then, you return to the first intersection. At this time, the car stops line-following.

Program link: https://makecode.microbit.org/_86eUF28LEAyH

11.9 Matrix Laser Ranging Sensor

Function description:

The Maqueen Plus V3 is equipped with a matrix laser ranging sensor as standard. The accuracy, speed and stability of laser ranging are significantly better than ultrasonic ranging. This sensor uses a total of 64 laser beam measurement points in an 8*8 configuration, and can measure the distance values of 64 points within a 60-degree included angle. Through the internal fusion algorithm, it can obtain the distance of the obstacle in front and also the position of the obstacle.

Schematic Diagram of Matrix Laser Point Arrangement

As shown in the figure, the upper left corner is the origin of the matrix. The direction is the upper left corner of the sensor facing directly forward.

Installation Angle Diagram

As shown in the figure, it shows the size effect of the LiDAR installed on the Maqueen Plus V3.

If the x6 and x7 rows are used for ranging, on the Maqueen Plus V3, if the measurement distance is greater than 250mm, the laser may hit the ground.

Example 1: 1-Beam Laser Obstacle Avoidance

Description:

Program link: https://makecode.microbit.org/_6YHf9ddvYYqJ

Note: The startup time of the matrix lidar is relatively long, about 3 seconds. Therefore, about 3 seconds after startup, the Makeblock Maqueen Plus V3 may not move. Please wait patiently.

Example 2: 2-Beam Laser Obstacle Avoidance

Description:

Program link: https://makecode.microbit.org/_A5cb2FTY51Dk

Example 3: 3-Beam Laser Obstacle Avoidance

Description:

Program link: https://makecode.microbit.org/_3uEapP7cpdH7

Example 4: Cliff Recognition and Avoidance

Description:

  1. As shown in the above figure, adjust the angle of the lidar to about 60 degrees. Find a paper box with a height greater than 5 cm and a slightly larger area, and place the car on the paper box.
  2. During the verification process, the distance of edge detection can be finely adjusted by adjusting the angle of the lidar.
  3. In the program, the measurement data of the laser beam at x3y3 in the matrix is read to determine whether there is a cliff ahead.
  4. Measure the distance value of the ground once when the machine is turned on and save it.
  5. When it is found that the distance ahead is greater than the ground distance measured for the first time by 50mm, let the car turn right. Thus avoiding the cliff.
  6. Schematic diagram of the laser point position:

Program link: https://makecode.microbit.org/_UYWJR192aajd

Example 5: Intelligent Obstacle Avoidance Mode (Test Function)

The intelligent obstacle avoidance mode is currently a test function and there may be errors or experience problems.

Description:

Program link: https://makecode.microbit.org/_d8xTpcRJbhHp

Example 6: The robot that can automatically turn around and follow the line

Description:

This program demonstrates that the car turns around when detecting an obstacle ahead during the line-following process and continues to follow the line. Build the scene as shown in the following figure: The car will travel back and forth between the two obstacles.

Program link: https://makecode.microbit.org/_W8qc37ePpUPu

Example 7: Data of the USB Output Matrix Laser

The laser ranging sensor supports the data of USB output matrix measurement. Depending on the different set modes, the USB interface will output 8*8 matrix data, with the unit of mm.

Tool Preparation:

Usage Method:

Connect the sensor via USB, as shown in the figure:

Open the serial port monitor software, select the corresponding COM port and open it, turn on DTR, and set the baud rate to 115200. At this time, the data will be actively pushed to the USB port, as shown in the figure:

Experience Sharing of Matrix Lidar

After using the above multiple examples, you should basically understand the usage method of the matrix laser ranging sensor. During the actual debugging process, you can try to use different laser points and adjust different angles to experience the position measured by each point, thereby achieving more functions. For example:

  1. The y value locates the up and down, and the x value locates the left and right. Using laser points that are a little lower, such as y5, y6, y7, can measure lower obstacles. Using laser points that are higher up, such as y0, y1, y2, can measure farther obstacles, and the laser is not easy to shoot to the ground to cause wrong data.
  2. Lower the angle of the bracket, and it can also detect whether there are potholes on the road surface.
  3. Multiple lasers can cooperate to detect the position of obstacles.
  4. Experience the built-in obstacle avoidance mode, and you will find that it has some intelligent algorithms, and it knows how to turn in the front.
  5. The USB interface can not only be used to upgrade the firmware but also output matrix laser data. Open the serial port monitoring tool software, and you can visually see the distance values detected by 64 laser beams.

11.10 PID Control and Vehicle Speed Detection

Function description:

The Maqueen Plus V3 integrates a magnetic induction encoder, which can obtain the real-time rotational speed of the car. Through the closed-loop control of the PID algorithm for the rotational speed, the car can travel at the required distance or angle. For example, the car moves forward 80 cm, and the car turns 100 degrees in place.

At the same time, the current real-time speed of the car can also be obtained, which is like a car speedometer. The unit is: centimeters/minute

PID control forward distance error: ±2 cm PID control angle error: ±5°

Example 1: PID Control (Non-interruptible Mode)

Non-interruptible Mode: During the process of PID control for the forward distance, before reaching the specified distance, the program does not proceed further and cannot be terminated halfway. It only executes the next program after completing the set distance. This approach can significantly simplify the program design. But the disadvantage is that it is not flexible enough and cannot be interrupted halfway.

Program Description:

Due to the existence of errors in controlling the distance and angle, as well as the different frictions of the ground, there will be a certain error when finally returning to the starting point. Moreover, after several cycles, the error will gradually increase.

Program link: https://makecode.microbit.org/_5iCRJufoMhua

Example 2: PID + Laser Ranging Stop (Interruptible Mode)

Program Description:

Interruptible Mode: Even if the distance for PID control is set, it can be interrupted and stopped halfway. This method is flexible and can stop the forward movement at any time.

This program demonstrates setting the PID control for the car to move forward 500 meters (equivalent to driving straight forward). When an obstacle within 20 cm in front is detected, the PID control stops and the car stops. And set x to 1. When the obstacle is removed, the car continues to move forward and set x to 0 for the next PID control judgment.

In the cyclic execution of this method, if the PID control command is sent again when the PID is not stopped, the program execution will go wrong. Therefore, a flag variable needs to be set to detect whether the current situation is in the stopped state of the PID control.

Program link: https://makecode.microbit.org/_7TF1Xoi7i6i9

Example 3: Read Real-Time Speed

Program Description:

Program link: https://makecode.microbit.org/_FKs8HR1c7AW5

The real-time speeds read in the example are respectively: