Introduction: Your Own M5Stack Hotel Security Guard

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

  1. Open your browser
  2. Go to the URL http://flow.m5stack.com/
  3. Connect your M5Stack to the M5Flow (Click here for more details [coming soon])

Step 4: Add Motion Sensor in the M5Flow

  1. Click the add Units button
  2. Select PIR
  3. Change to using Port B
  4. Click OK button

Step 5: You Can Get the Status From the Motin Sensor (PIR)

  1. PIR is now appear under the Unit
  2. 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

  1. Drag the blocks just like the picture
  2. The motion sensor will return 1 status when the door motion is detected
  3. We keep changing the color of both left and right LED and play some sounds to get your attention.