7. Lesson 7

../_images/7_16.png

7.1. Introduction

Welcome to Micro:bit Smart Car tutorial! In this course, we will explore Micro:bit and learn how to develop Micro:bit Smart Car by programming

7.2. Learning Target

Let students clearly understand Micro:bit Smart Car’s extension tools and its functions, moreover, understanding its install and block coding method

7.3. Meet the Micro:bit Expansion Tool - Bulldozer

Micro:bit mechanical bulldozer is mainly composed of push plate, servo motor and ultrasonic sensor, and is installed at the front of the car. This time we mainly connect the pins of the servo to the S1 port (the red box shows the different pin bits).

../_images/7_210.png

This time, we mainly connect the pin of the servo to the S1 port (pin position shown in the blue box), and generally the dark wire (black or brown) is connected to the black GND port.

../_images/7_32.png

7.3.1. Principle and function of mechanical bulldozer

In real life, a bulldozer is an engineering vehicle with a large metal bulldozer in front of it, which can push mud, sand and stones, etc. The position and angle of the bulldozer can be adjusted to suit shoveling, filling, etc. It can also be used to remove obstacles.

../_images/7_4.jpg

Whereas the Micro:bit mechanical bulldozer does not use a sharp dozer, but instead uses a push plate with a hole to handle the job, so as sphere.

../_images/7_52.png

7.3.2. To install the bulldozer

../_images/7_62.png

7.3.3. Components – with an ultrasonic sensor:

1)Use two M3*5mm screws to connect the push plate and pan-tilt-zoom mount plate.

../_images/7_72.png

2)Assemble the servo with three M2.5*5mm screws, and install the pan-tilt-zoom mounting plate.

../_images/7_82.png

3)Put the ultrasonic sensor into the universal expansion mounting plate, and use two M3*5mm screws to attach the universal expansion mounting plate to the pan-tilt-zoom mounting plate.

../_images/7_92.png

4)Use two screws, two screw pads, and two copper pillars to install the pan-tilt-zoom mounting plate together with the ultrasonic sensor on the car.

../_images/7_102.png

Finished diagram:

../_images/7_112.png

7.4. Exercise 1

Design a program using the buttons of the Micro:bit board to make the ultrasonic sensor look in different directions.

The A button looks straight to the left (270°), the B button looks straight to the right (90°), and the A+B button looks straight ahead.

../_images/7_121.png

Hint:

  • First adjust the installation angle of the servo so that the angle value of the servo module is 85 as the front

  • Only using the servo module 0-180 degrees cannot make the servo ultrasonic sensor look to the left and right

  • Negative numbers and values above 180 degrees must be tried

Ultrasonic sensor facing direction Angle value
Straight Left
Straight Right

7.5. Exercise 2

Design a program makes the ultrasonic sensor complete the task, put down the car on the circular field, let the car drive automatically and use the push plate to push all the objects in the field out of the field, and the car cannot go out of bounds.

../_images/7_131.png

Hint: Refer to Backwards to either side when the car reaches the boundary.

7.6. Answer

7.6.1. Exercise 1

The actual total rotatable angle value of the ultrasonic sensor is about 210 degrees, -20 degrees is the actual 270 degrees, 85 degrees is the actual 270 degrees, and 190 degrees is the actual 90 degrees.

Ultrasonic sensor facing direction Angle value
Straight Left -20
Straight Right 190

../_images/7_141.png

7.6.2. Exercise 2

../_images/7_151.png

When the car reaches the boundary of the black line, it backs to the back right side for 2000 milliseconds, otherwise it keeps going forward.

../_images/7_161.png