Project 04:An Automatic Door

Img

1. Introduction

I find that there are many interesting inventions in our life. Last time I went to a library with my classmates to borrow a book about learning robots. When we came to the door, it opened automatically.

How magical it is! Today, let’s make a device that can open the door automatically.

Let’s look at the tools first.

2. Components

Img

Img

Img

Kidsuno Mainboard×1

PIR Motion Sensor×1

270°Servo×1

Img

Img

Img

Connection Wire×1

USB Cable×1

Automatic Door×1

Img

3. Function: Rotate the Servo

Img

4. Wiring Diagram

Connect the kidsuno mainboard and computer via a USB cable, and connect the servo to the G, V and D13 interface of the mainboard. The brown wire is connected to G, the red wire is connected to V and the orange wire is connected to D13.

Img

5. Add the Servo Instruction Module

Img

Img

Diagram of the Extension Instruction Block

Img

Add Servo

Img

6. Description of the the Building Blocks

Img

Set the rotation angle of the servo and the delayed time for a specified pin

7. Write the Program

① Drag the instruction blockImg in the Events module to the script area.

Img

② Drag the instruction block Img in the Pins module to the script area. Since the servo is connected to port G, V and D13 on the mainboard, then change the number 0 to 13 and the input to output.

Img

③Drag the instruction block Img in the servo module to the script area, then change the number 3 to 13 and the angle number 90 to 93, the delay of 200 remains unchanged.

Img

④ Drag the instruction block Img in the Control module to the script area.

Img

⑤ Drag the instruction block Img in the servo module to the script area, then change the number 3 to 13, the angle number 90 to 93 and the delay of 200 to 500.

Img

⑥ Copy the instruction blockImg 3 times in the Imgblock and place them into it, then change the angle number 93 to 62, 31 and 0.

Img

⑦ Complete Program

Img

8. Test Result

Click Img to upload the complete program to the kidsuno mainboard and power up, then the servo will rotate from 93°to 62° to 31° to 0° and rotate from 0° to 31° to 62° to 93°.

9. Assembly Steps

Download the PDF follow the link:Automatic Door Assembly

Or you can Watch the assemble video :

10. Wiring Diagram

Connect the kidsuno mainboard and computer via a USB cable, and connect the servo to the G, V and D13 interface of the mainboard and the PIR motion sensor to the No.1 interface of the mainboard.

The brown wire is connected to G, the red wire is connected to V and the orange wire is connected to D13.

Img

11. Function: Read the PIR Motion Sensor

Img

12. Description of the the Building Blocks

Img

This is the digital signal (0 or 1) for a specified pin.

13. Write the Program

① Drag the instruction block Img in the Events module to the script area.

Img

② Drag the instruction block Img in the Serial module to the script area and take the baud rate 9600 as an example.

Img

③ Drag the instruction block Img in the Pins module to the script area. Since the PIR motion sensor is connected to pin D5 of port 1 on the mainboard, then change the number 0 to 5.

Img

④ Drag the instruction block Img in the Control module to the script area.

Img

⑤ Drag the instruction block Img in the Serial module to the script area.

Img

⑥ Drag the instruction block Img in the Pins module to the script area and put it into the block Img, then change number 0 to 5.

Img

⑦ Drag the instruction block Img in the Control module to the script area and change the number 1 to 0.3.

Img

⑧ Complete Program

Img

14. Test Result

ClickImg to upload the complete program to the kidsuno mainboard and power up, then click Img in the serial monitor area to set the baud rate to 9600. When the PIR motion sensor detects a person or animal moving, the serial monitor prints a digital signal 1, otherwise it prints 0.

Img

Img

15. Function: PIR Motion Sensor Controls the Servo

Img

16. Flow Chart

First, set the angle of the servo to 93°. When the PIR motion sensor detects a person or animal passing by, it will rotate to 0° and it will not rotate if no man or animal is passing by.

Img

17. Write the Program

① Find the instruction blocks

(1)Img

(2)Img

(3)Img

(4)Img

(5)Img

(6)Img

② Complete Program

Img

18. Test Result

ClickImg to upload the complete program to the kidsuno mainboard and power up. When the PIR motion sensor detects a person or animal passing by, it will rotate to 0° and the door will be opened automatically , and it will not rotate if no man or animal is passing by and the door will not be opened.

Img

19. Extended Project

Img

The sample code is below:

Img