Most of us do not like to be disturbed when we are working. For example, when you stay in your office alone and ready to write a blog, suddenly a colleague break into your office and tell you tomorrow you will have a meeting. At that time you are catching a good idea flash by and preparing to write it down. You might go crazy that your idea is interrupted by this situation. If there is a small gadget on your desk which can remind you someone is near, then you will be pre-informed psychologically so that you will not feel so disappointed for missing your inspiration. Today we are going to make a small gadget with BBC micro:bit and Elecfreaks Octopus kits to help us know someone near beforehand.
When someone is near, micro:bit will display a heart sign.
BBC micro:bit ×1
USB Cable ×1
Micro:bit Breakout Board ×1
Octopus PIR sensor Brick ×1
OCTOPUS PIR Sensor module is a type of electronic building block based on AM412 pyroelectric digital smart sensor. It can be used to sense and detect human or animal motion within distance around 4-5 meters.
If there is no one close, it will output low electric voltage. And if there is someone near, it will output high electric voltage.
Plug the breakout board we prepared into micro:bit, connect OCTOPUS PIR Sensor to P0 port. Then find a cable long enough so that we can install OCTOPUS PIR Sensor onto the door frame with probe head pointing outside.
Click this link: https://makecode.microbit.org/# to open program interface. We are going to use Block method to program.
This program is very simple. Only by judging the electric voltage in the port P0 , we can know whether there is someone near. Here is the whole program code：
Next, we need to download these code into micro:bit and see what will happen.
If you know someone is closing but still feel angry, then you’d better prepare a slingshot. Once micro:bit displayed heart, you can pickup your slingshot and begin to fire.
With this principle above, we can make an burglar alarm by ourselves. You can place OCTOPUS PIR Sensor onto your door and window. Let’s try to think about if we have two human body sensor, how can we do cabling and programming? If you have good ideas, please share your comments with us.