Skip to main content

Case 09: Automatic Doors

Purpose​


To make an automatic door.


micro:bit Wonder Building Kit

Materials Required​


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

Bricks build-up​


Installation Mthods of Hardwares​

Install the sonar:bit with the bricks.

Hardware Connection​

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

Software Platform​


MakeCode

Coding​


Add extensions​

Click "Advanced" in the MakeCode to see more choices.

Search with Wukong in the dialogue box to download it.

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

Program​

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

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.