Smart Light

Create a light that will only light up when someone is in the room using a PIR sensor.


YOU WILL NEED

  • 1 x Micro:bit
  • 1 x Micro USB Cable
  • 1 x Breakout Board
  • 1 x PIR Sensor
  • 1 x LED

STEP 1

Connect the Micro:bit to the Breakout Board. Then connect the PIR sensor to pin 0 of the Breakout Board and the LED to pin 1 of the Breakout Board, making sure the colours of the wires match the pins on the Breakout Board.



STEP 2

Go to makecode.microbit.org, open up the advanced tab and click on Add Package. Type "tinker kit" into the search box and click on the package shown to add it. You should now see the Tinkercademy and OLED packages.



STEP 3

In the forever block, put the following blocks. The 'If' block checks if the PIR sensor detects any movement and if it does, it turns on the LED.



STEP 4

And Presto! You have your very own smart light! Now you won't have to reach for the switch for light anymore.


Made this activity? Good Job! Now spread the word. Share a photo of your creation on social media with #letsgethacking #SmartLight