# Case 01: Smart Saving Light Bulb Level:  
## Goal
## Background
Smart light bulb is a smart light bulb that helps automation and saving electricity. When there is people coming in, the bulb will be turned on automatically. People always forget to turn off the light when he/she leave. After 10 mins, if there are no any motions inside the room, it will close the LED to save energy.
Smart Saving Light Bulb Principle
Motion sensor is used to detect the presence of human activity in the room. If there are people moving in the room, the light bulb will be turned on, vice versa.

## Part List
## Assembly step
Step 1. To start with, build the Big House Model.

Step 2
Pick one corner of the house. In this example, we pick the left upper corner, install the 2 walls (E1 & E2) to build a small room.

Step 3
Attach the PIR Motion Sensor to model B3 using M4 * 10mm screws and nuts.

Step 4
Attach the Multi-color LED to the model B3 using M4 * 10mm screws and nuts.

Step 5
Installation completed!

Step 6
To build a Bed. Put model J2 onto the model J1, then put together all the cardboard parts (J1-J3).

Step 7
The bed completed!

Step 8
Place the bed inside the bedroom.

Step 9
Assembly completed!

## Hardware connect
## Programming (MakeCode)
* Before using the Multi-Color LED, need to do initialize * Pull the `set strip to NeoPixel at pin P1 with 1 leds as RGB(GRB format)` to `on start` 
Step 2. Change the LED Color by motion sensor result
* In `Forever`, add a `if-else` statement
* Set (`Get motion (triggered or not) at Pin P0` = `true`) as condition
* Snap `strip show color white` into the `if` segment
* Snap `pause(ms) 10000` into `if` segment to keep light up for 10 second
* Snap `strip show color black` into the `else` segment
* When the condition is correct, that’s say motion is triggered, someone passes by.
The program will run the `if` segment to turn on the light
* Otherwise, the program will run the `else` segment to turn off the light

Full Solution
MakeCode: https://makecode.microbit.org/S44525-40482-50586-80115
You could also download the program from the following website:
## Result

## Think
Q2. Suggest addition of any component that allows the light bulb to be even smarter.
Q3. Can you add the timer in the program to make it only turn off after 10min of no activity?
When the people are moving in the room, the motion sensor will trigger and keep the LED turned on. When there is no one moving, the LED will turn off.
Q1. Besides implementing the smart light bulb into the toilet, where other places can the light bulb also be implemented? Discuss the place and briefly explain the point on energy reservation.