Build a reclusive robot that makes a sound anytime it is toggled, touched or when it detects motion
- 1 x micro:bit
- a box large enough to fit a micro:bit
- 1 x PIR Sensor
- 1 x potentiometer
- 1 x passive buzzer
- 2 x F-F jumper wires
- 1 x breakout board
- 1 x battery holder
Attach the battery holder to the micro:bit and insert the micro:bit into the breakout board.
Then, attach the buzzer to P0 of the breakout board. The positive side goes to the yellow (S) port.
Attach the soil moisture sensor to pin 1.
Connect the PIR sensor to pin 2.
Connect the Potentiometer into pin 3.
We will add a package of code to enable us to use our kit components. Click on Advanced in the Code Drawer to see more code section and look at the bottom of the Code Drawer for Add Extensions.
This will open up a dialog box. Type in “tinker kit”. Click on the search icon or press enter, then click on the tinkercademy-tinker-kit 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.
Put on the Micro:bit code- Coding your reclusive robot
Your program consists of a few “if” statements. We want the robot to only react to four conditions.
The first condition is the robot being picked up.
If the acceleration is greater than 1, the buzzer will play the high A#.
The second condition is someone touching the soil moisture sensors.
If it is greater than 50, the same tone will be played.
The third condition is if the robot detects movement in front of it.
If there is movement, it will once again play the same tone, high A#.
The last condition is someone toggling the potentiometer.
If it reads greater than 50, high A# will be played.
And you're done! Enjoy your recluse bot!