Do you want to have your own security guard in your hotel's room? Elm will use M5Stack to become your own guard and alert you while other people open your door.
Step 1: Get Ready Your M5Stack and Motion Sensor Unit (PIR)
Get one M5Stack, a jumper wire and a motion sensor unit.
The motion sensor unit (PIR) is used to detect whether the door is opened or not.
Step 2: Connect Your Motion Sensor to M5Stack's Port B
We connect the Motion Sensor to the M5Stack's port B using the jumper wire. Port B is on the top of the M5stack.
Step 3: Open M5Flow and Connect to Your M5Stack
- Open your browser
- Go to the URL http://flow.m5stack.com/
- Connect your M5Stack to the M5Flow (Click here for more details [coming soon])
Step 4: Add Motion Sensor in the M5Flow
- Click the add Units button
- Select PIR
- Change to using Port B
- Click OK button
Step 5: You Can Get the Status From the Motin Sensor (PIR)
- PIR is now appear under the Unit
- Click on the PIR and a new block is show "Get pir0 status"
The "Get pir0 status" block is used to read the detection result from the Motion Sensor(PIR). If the PIR detects the motion, the block will return "1". Otherwise, it will result "0" to indicate nothing is moving.
Step 6: Add Some Codes for Alerting When the Door Is Opened
- Drag the blocks just like the picture
- The motion sensor will return 1 status when the door motion is detected
- We keep changing the color of both left and right LED and play some sounds to get your attention.