11. Case 09: Automatic Doors#

11.1. Purpose#


To make an automatic door.

../../_images/case-09-01.png

11.3. Materials Required#


../../_images/case-09-02.png

Video link: https://youtu.be/JimDF7ArSjQ

11.4. Bricks build-up#


../../_images/step-case-09-01.png

../../_images/step-case-09-02.png

../../_images/step-case-09-03.png

../../_images/step-case-09-04.png

../../_images/step-case-09-05.png

../../_images/step-case-09-06.png

../../_images/step-case-09-07.png

../../_images/step-case-09-08.png

../../_images/step-case-09-09.png

../../_images/step-case-09-10.png

../../_images/step-case-09-11.png

../../_images/step-case-09-12.png

../../_images/step-case-09-13.png

../../_images/step-case-09-14.png

../../_images/step-case-09-15.png

../../_images/step-case-09-16.png

../../_images/step-case-09-17.png

../../_images/step-case-09-18.png

../../_images/step-case-09-19.png

../../_images/step-case-09-20.png

../../_images/step-case-09-21.png

../../_images/step-case-09-22.png

11.5. Installation Mthods of Hardwares#

Install the sonar:bit with the bricks.

../../_images/Wonder-Building-Kit-step-sonar-bit-3.png

11.6. Hardware Connection#

Connect a sonar:bit to P1 and the servo to S0 port on Wukong breakout board.

../../_images/Wonder-Building-Kit-case-09-06.png

11.7. Software Platform#


MakeCode

11.8. Coding#


Add extensions#

Click “Advanced” in the MakeCode to see more choices.

../../_images/case-01-03.png

Search with Wukong in the dialogue box to download it.

../../_images/case-01-04.png

Search with https://github.com/elecfreaks/pxt-sonarbit in the dialogue box to add the sonar:bit extension.

../../_images/case-04-04.png

Program#

../../_images/case-09-03.png

Link:https://makecode.microbit.org/_eUPf4XEudVKY

Result#

When the ultrasonic sensor detects someone passing by, it will display √ on the micro:bit and control the servo to open the door and close it automatically after 5 seconds, if the ultrasonic sensor does not detect anyone, it will keep displaying × on the micro:bit and the door is closed.