Project 07:Astern Indicating Device
1. Introduction
With the development of science and technology, cars boast the ability of intelligent environment perception, which can automatically analyze the safety and danger when driving.
For example, we can observe the specific situation behind the car if we turn on the astern indicating device when backing up, which can avoid the car being knocked. Let’s make an astern indicating device together!
The following are the tools we need.
2. Components
Kidsuno Mainboard×1 |
Ultrasonic Adapter Board×1 |
Ultrasonic Sensor×1 |
Astern Indicating Device×1 |
8×8 Dot Matrix Display×1 |
Connection Wire×2 |
USB Cable×1 |
3. Assembly Steps
Download the PDF follow the link:Astern Indicating Device Assembly
Or you can Watch the assemble video :
4. Function: 8*8 Dot Matrix Displays Expression Patterns
5. Wiring Diagram
Connect the kidsuno mainboard and computer via a USB cable. Then connect the 8×8 dot matrix module to the No.8 interface of the mainboard and the ultrasonic adapter board to the No.9 interface of the mainboard. The Vcc, Trig, Echo, and Gnd of the ultrasonic sensor correspond to the same port of the ultrasonic adapter board.
6. Add the Instruction Library of the 8*8 Dot Matrix
To use the 8×8 dot matrix , we need to call the “Display” module in the “Extension” function. Click “Matrix 8*8 IIC” then tap to return to the programming interface.
Extension Instruction
Add Matrix 8*8 IIC Display
7. Write the Program
① Drag the instruction block in the Events module to the script area.
② Click the Matrix HT16K33 module on the left of the instruction area, then all the 8*8 dot matrix instruction blocks will be displayed.
③ Drag the instruction block and in the Matrix HT16K33 module to the script area.
④ Drag the instruction block in the Control module to the script area.
⑤ Drag the instruction block , and in the Matrix HT16K33 module to the script area.
⑥ Drag the instruction block in the Control module to the script area and change the number 1 to 2.
⑦ Copy the instruction block10 times and put them into the block respectively, then change the expression pattern to.
⑧ Complete Program
8. Test Result
Click to upload the complete program to the kidsuno mainboard and power up, then the the 8*8 dot matrix will display colorful expression patterns.
9. Function:Ultrasonic Sensor Detects Distance
10. Add the Instruction Library of the Ultrasonic Sensor
To use the ultrasonic sensor , we need to call the Sensor module in the Extension function. Click Ultrasonic then tap to return to the programming interface.
Extension Instruction
Add Ultrasonic Sensor
11. Description of the the Building Blocks
This is the ultrasonic sensor instruction block used to measure the distance for the specified pin. The distance unit can be selected as cm or inch.
12. Write the Program
① Drag the instruction block in the Events module to the script area.
② Drag the instruction block in the Serial module to the script area and take the baud rate 9600 as an example.
③ Drag the instruction block in the Pins module to the script area and copy once. Since the ultrasonic sensor is connected to port 9 on the mainboard(Trig corresponds to pin D10 and Echo corresponds to pin D11), then change the number 0 to 10 and 11, and change the input behind number 10 to output.
④ Drag the instruction block in the Control module to the script area.
⑤ Drag the instruction block in the Serial module to the script area.
⑥ Drag the instruction block in the Ultrasonic module to the script area and put it into the block, then change the number 2 to 10, 6 to 11, and take the distance unit cm as an example.
⑦ Drag the instruction block in the Control module to the script area and change the number 1 to 0.3.
⑧ Complete Program
13. Test Result
Click to upload the complete program to the kidsuno mainboard and power up, then click in the serial monitor area to set the baud rate to 9600.
Moving your hand in front of the ultrasonic sensor, the distance displayed becomes smaller when we are close to the sensor and larger when we are far away from it.
14. Function: Ultrasonic Sensor Controls the 8*8 Dot Matrix
15. Flow Chart
Initialize the 88 dot matrix and read the distance value of the ultrasonic sensor. If the distance is greater than 0 and less than 10cm, the 88 dot matrix shows a “stop” pattern, otherwise, it displays a “backward” pattern.
16. Write the Program
① Find the instruction blocks
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
② Complete Program
17. Test Result
Click to upload the complete program to the kidsuno mainboard and power up. When the ultrasonic sensor detects the object within a range of 0cm to 10cm, the 8*8 dot matrix shows a “Stop” pattern, otherwise, it displays a “backward” pattern.
18. Extended Project
The sample code is below: