Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click. It is build on Node.js. Node Red can be installed on Raspberry Pi and its server can be run on it. A sensor is connected to Raspberry Pi and this data is sent to mobile as a SMS. The whole thing is done using Node Red. The ultrasonic sensor is connected to Raspberry Pi and coding done using Python. Node Red has a inbuilt nodes installed in it. Using the exec node in Node Red it takes the data from ultrasonic sensor. This data is send to mobile using Twilio node in the Node Red. Let's do this in step by step.
Step 1: Connecting Ultrasonic Sensor to Raspberry Pi- Raspberry Pi pin number ----- Ultrasonic sensor pins
- 2 ---- Vcc
- 6 ---- Ground
- 23 ---- trig
- 24 --- Echo
After connecting the ultrasonic sensor, the Raspberry Pi code, the code given below and check it using the command:
sudo python <path of the python file>
Step 2: Installing Node Red on the Raspberry PiIf the operating system of the Raspberry Pi is Raspbian Jessie, it comes with inbuilt installation. By starting the applications, it points to a URL to open the UI of Node Red.
After starting the Node Red UI connect the nodes as shown above. Select the exec node and name it as ultrasonic. In the exec node, it asks for the path of the directory, so paste the directory of the Python code which you have saved. Later for sending SMS to your mobile you need to sign up to Twilio https://www.twilio.com/. After creating the account fill the credentials in the Twilio node and deploy the application. Now everything is done.
Comments