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 case, a simple signal from a motion detector will be sent to a service that has the ability to convert the true/false signal from the motion detector into a text signal that is then passed to another service that is able to tweet.
Getting startedTo get started with NodeCode, go to NodeCode, download the installer and then try the LED tutorial. If you are able to get through that then you should be able to set this up (as well as anything else you can imagine) very easily.
First, we wire up our PIR Sensor.
We will need a RPiGpio Service Pack downloaded and added to the Raspberry Pi with the Motion Detector hooked up.
We can then drag-n-drop an Interrupt Pin Reader onto the Program Canvas and set the Pin Number to 0. NodeCode uses the excellent Wiring Pi library and has inherited the Wiring Pin numbering scheme. We've renamed the pin to 'Motion Detector' here as well.
We then need the Transform Service Pack downloaded and added to any device that has a NodeCode Agent installed. The same machine that is running NodeCode Studio works in this case.
We've added a Bool To Signal Node as well as a Constant Signal To Text Node from the Transform Service. The Constant Signal To Text Node has one property that you need to set. This will be the text value that is sent to the Twitter Service.
You can also use the Dynamic Signal to Text node if you would like to auto update the text that is tweeted via another service or view.
Adding the Twitter service packWe now need the Twitter Service Pack downloaded and added to the same machine that NodeCode Studio is running on (or any other Windows machine, a Debian/Raspbian service pack is coming soon).
Once you've added the Twitter service pack, set your Username and Password and then click save.
Once we have that, we can drag-n-drop a Send Public Status node from the Twitter service.
We've also added a simple view that allows us to see the state of the pin in real-time but this is optional as is the companion app, NodifyMe (currently being alpha tested in the play store Play Store.
That is it! We really hope you can see how easy this is to build off of and create something much more interesting!
Follow us on:
Comments
Please log in or sign up to comment.