IoT project: Create a Santa detector

Table of Contents
IoT project: Create a Santa detector

Introduction

Santa and Baby Jesus are highly secretive people, but with IoT you can catch either of them in the act of bringing presents. 🎄 The PIR Module: motion detector will help you

Under this project, you will learn how to detect motion in a remote room. Thanks to this you can check whether Santa Claus, Baby Jesus, Grandpa Frost or someone else is in your home. 😲

If you already have the Starter Kit, you will only need the PIR Module. Alternatively, the Motion Detector Kit contains all the equipment you need.

Prepare the box

  1. Put your kit together. You need the bcf-radio-motion-detector firmware for the Core Module. If you don't know how to download the firmware or what it is,you can find out here. Radio motion detector

  2. If the firmware is correctly installed, you will see the motion detector under the Devices Alias tab in Playground. Motion detector

Set up Node-RED

  1. Start programming in Node-RED. First, click on the Functions tab in Playground.

  2. Drag a light purple MQTT node (bubble) onto the empty desktop. You can find it under the Input section.

mqtt

  1. Double-click the node. In the Topic line, specify the key value. It will now function as a counter of movements that are recorded:
node/motion-detector:0/pir/-/event-count

Key value Confirm with the Done button.

  1. Behind this node, place a Switch node from the Function section. This allows the device to recognize that the detector is on and can report any movements. Switch

  2. In the node, fill in the Property line as flow. detectorActive and edit the condition in the field to is true (take a look at the screenshot). Our tip: Read more about this feature. Property

Confirm with the Done button.

  1. Behind the switch node, place a Change node from the same Function section. Change

  2. In the node, you set the message that you want to pop up when our bearded friend (or Baby Jesus) brings their presents. 🎅 👼 For example: Santa/Baby Jesus is in the living room. Our tip: If you also want to set notifications for your mobile, do not use accent marks (čárky) or hooks (háčky), Blynk does not like them. Message setting

Confirm with the Done button.

  1. Above this flow, start another one to be able to switch the detector on and off. It should consist of two nodes. The first is a Switch node from the Dashboard section. Switch node

  2. In this node, edit Label to Detector Status. This is how your Dashboard project will be labelled. Detector Status

Confirm with the Done button.

  1. Behind the switch node, place a Change node from the Dashboard section. That´s right, just like the one you already have a little lower down. 👍 Change node

  2. In the Rules field, set the function to: flow. detectorActive (see screenshot). This enables the device to recognize if the button is on or off. Beware of making typing errors! Rules Confirm with the Done button.

  3. Now connect all the nodes as shown in the screenshot, but don't press the Deploy button yet. The last node, which we will add shortly, is still missing. With the last node you set up a notification to your mobile. 🤳 Connection node

Set up notification to mobile

  1. Take your smartphone and turn on the Blynk app. If you turn it on for the first time, you can find out everything you need to know in our Blynk manual.

  2. Create a new project and a token will be sent to your e-mail. In Blynk, place Notification onto your desktop using the small plus in the wheel.

notification
  1. Press the Play triangle in the upper right corner and go to Playground on your computer.

  2. Here, place the last node for the whole project, i.e. the Notification node from the Blynk ws section. It should be placed directly behind the flow with the switch (see screenshot). 👀 Playground

  3. Unclick it and click on the little pencil on the right. Little pencil

  4. Fill in the URL here by simply copying it from the field below. Subsequently, copy and paste the token here that you received by e-mail from Blynk. Token copying Confirm by pressing the Add and Done buttons.

  5. Finally, connect this attractive green node to the previous flow and hit the Deploy button. Deploy

Ready, steady… go!

  1. It's high time to spy on those who come bearing gifts. Under the Dashboard tab in Playground, turn on your detector. 🕵️ Turning on detector

  2. The PIR Module senses even the slightest movement and sends the message that something is afoot to your mobile in no time. Santa or Baby Jesus don´t stand a chance! Quick! Catch them while you can!

notifikace do mobilu
  1. Only keep in mind: After catching Santa or Baby Jesus, you will have to placate them in order for them to leave you any presents at all. 😜