- Get to know the Crash Sensor, OLED and Buzzer
- Make something with a OLED
- Make something with a Crash Sensor
1 x BBC micro:bit
1 x Micro USB cable
1 x Breakout board
|1 x Crash Sensor|
1 x OLED
1 x Buzzer
2 x Female-Female jumper wires
- In this project, we are going to create an intruder detector which the buzzer will sound when someone opens the door.
- A message will always be displaying on the OLED, showing the status of the house
Note: You can use any jumper wire colour
- Connect 2 Female-Female jumper wires to the Buzzer.
- The longer pin on the Buzzer will connect to the yellow pin on the breakout board, while the shorter one connects to the black pin.
- Plug the other end of the jumper wires to Pin 0
- Next, plug in the OLED as shown in the picture
- You are able to plug it into any of the three rows
- For the next components, make sure the colour of the wire follows the coloured pins on the break out board
- Plug in the crash sensor to Pin 1
- Click on Advanced in the Code Drawer to see more code sections
- We’ll add a package of code to be able to use our kit components
- Look at the bottom of the Code Drawer for Add Package and click it
- This will open up a dialog box
- Copy and paste this link into the Add Package… text field: https://pxt.microbit.org/89153-37616-68542-51563
- Click on the search icon or press enter, then click on the Tinkercademy button
Note: If you get a warning telling you some packages will be removed because of incompatibility issues, either follow the prompts or create a new project in the Projects file menu.
- Click on Tinkercademy inside the Code Drawer to find our custom blocks for the various components in your kit
- After that, use blocks under the Tinkercademy section to initialize the OLED and Crash Sensor as shown in the picture
- Since there are only two conditions, we need only one ‘else-if’ statement
- When the Crash Sensor is not pressed, the buzzer will sound and a message “Intruder Detected” will be displayed on OLED. Else if there is no force is applied to the Crash Sensor, the buzzer will silence and a message “The house is safe” will be displayed on OLED.
- Finally! You have created a intruder detector