Smart Light

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


You'll need

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

Step 1

Instructions

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.




Materials


Step 2

Instructions

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.




Materials


Step 3

Instructions

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.




Materials


Step 4

Instructions

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




Materials


Code and References

Completed this tutorial?

Spread the word! Let's get this trending on social media with #letsgethacking #SmartLight