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
    • This will open up a dialog box
    • Copy and paste this link into the Add Package… text field: https://pxt.microbit.org/50544-64675-33322-24641
    • 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

     

    • 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. The micro:bit will only show an icon on the screen if there is no movement. 
    • In this project, the pitch is controlling by the sensor value
    • Finally, you have completed your music project