Introduction: Motion Alerts From Anywhere in the World
We love the idea of using signals from sensors to kick off all sorts of
different processes. We use NodeCode to orchestrate many different signals from many different devices and direct them to perform actions.
In this tutorial, we'll demonstrate how NodeCode Studio and the NodifyMe Android app can be used to build and monitor a motion alerting system!
NodeCode is a self-hosted system that routes data via virtual wires (DataStreams) that connect things to things, people to things and people to people. You can download NodeCode for free at NodeCode.
This tutorial will assume that you've had a chance to work through the getting started guide:
Step 1: We Need to Setup a Raspberry Pi and Motion Detector
We wire up the positive of the PIR Motion Detector to the 3.3v pin on the Raspberry Pi and then negative to negative as well.
We then hook up the Out of the Motion Detector to GPIO pin 17 on the board.
Step 2: Add Pin Reader to NodeCode Program
If you've worked through some of the projects and read the Program documentation then you are able to complete this step with ease.
If you still have the Pin Writer node from the tutorial, you will need to delete it and then drag on an Interrupt Pin Reader node from the RPiGpio service.
In this example, as previously stated, we are using GPIO pin 17 which is Pin 0 in NodeCode since we use the WiringPi pin naming scheme. We simply input a '0' without quotes to tell the node which pin to listen on.
Every time this motion detector changes, the pin will change with it and will send a signal to NodeCode and through the NodeCode DataStreams (the virtual wires).
Step 3: Adding Notifications to Node Outputs
Each Node has little dots on either side representing inputs and outputs. The output dots (NodeEdges) allow you to create notifications each time there is a change.
In this case, we will add a message that says Motion Changed as the notification, check all of the boxes and then hit save.
We will now get a notification each and every time the signal changes on the motion detector.
This notification goes to NodeCode Studio as well as the NodifyMe App!
Step 4: Bonus: (Views)
You can add real-time views for your motion detector. There is a basic view tutorial for setting up custom views on https://www.nodecode.io
The view for this project is an LED View Element. When you wire up a datastream from the output of the Interrupt Pin Reader node to the input of the View, you will get real-time updates as motion is detected!
Check us out on other platforms: