Goals

  • Get to know the PIR Sensor Brick and moisture sensor
  • Make something with a PIR Sensor Brick
  • Make something with a moisture sensor
MATERIALS:
1 x BBC micro:bit
1 x Micro USB cable
1 x Breakout board
1 x Mini buzzer
1 x Octopus PIR sensor Brick
1 x Moisture sensor
2 x Female-Female jumper wires

 

  • Connect the USB cable to the micro:bit and then to the breakout board as shown in the picture.
  • Connect 2 wires to the buzzer

  • Plug in the buzzer to Pin 0
  • Plug in the moisture sensor to Pin 3
  • Finally, plug in the motion 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

    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

     

    • Click on Tinkercademy inside the Code Drawer to find our customs blocks for the various sensors in your kit
    • For this project, we are going to use the blocks read value from moisture sensor and motion sensor

     

    • In this step, we will code the micro:bit in Block Editor
    • We begin by coding a starting screen
    • This screen will appear when the micro:bit is powered on

     

    • Next, let’s create some music using sensor values
    • The pitch can be adjusted by multiplying the sensor values

     

    • Finally, make the buzzer produce sound when the motion sensor detects movements. Create two variables “Msensor” and “Psensor” to read the analog signals from Pin 3 and Pin 1 respectively . The variable contains the sensor value from the motion sensor
    • In this project, the pitch is controlling by the sensor value
    • Finally, you have completed your music project