IoT is going to be one of our life parts. we are trying to gather data from our behavior of environment behavior to use it as a torch in dark. the important thing is to monitor data each seconds or micro seconds. So imagine that every single moment, a lot of data are generating. loosing any kind of these data are very
What Is Node-REDNode-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. Using Node-RED in IoT projects will help you to get results very fast and reliable.
Set Up Raspberry Pi for Node-REDAfter all we have Node-RED added to Raspbian os by default. all you need is just run it. go to Programming menu, then click on Node-red. after that you will face raspberry pi command line, like picture below. check the IP in upper right corner. my IP is 192.168.1.91:1880 now I can access to the Node-Red dashboard.
.
Set Up Node-RED, Raspberry Pi and Lux SensorIn this tutorial I'm going to get data from a Gy-30 sensor which is very good to have light data, in LUX parameter. for this project we need 7 nodes, like the picture below.
.
Let's start setting up Node-RED. we need to add these nodes: inject, i2c in, change, function, json, HTTP requests and debug node. look at the picture below. Add them all in your Node-RED flow.
.
Set Up Each NodeFor setting up each node we should double click on every one. For better results, I add a photo of each one. first node is inject.
.
Next one is I2C node. connect inject node to this one. Again set it up like picture below.
.
Next one is Change node. connect the i2c node to this one. then set it up like picture below. we have tow rules, first should be on "msg." and next one should be on "expression."
.
Next step is the Function node. you can write JavaScript in this node for any kind of output, there is much more description about this node, on Node-RED.
.
As I introduce the uBeac IoT platform, in previous post, we gonna need Json format, to connect any kind of data to this platform. indeed we need to use Json Node. take a look at this picture below, very easy we just need to translate JavaScript codes to JSON.
.
The last part is setting the HTTP protocol for sending data to the IoT platform. there is a unique URL on uBeac platform. in next steps I will show you how to get this URL.
After all I use a debug node, to show every details on this project.
.
Setup uBeac IoT PlatformuBeac is a perfect and easy to setup IoT platform. after all we did with Raspberry pi, now we need to set up uBeac in a minute. so follow my steps to finish all setups. login to uBeac then go to Gateway from left side menu. if you don't know how to add new gateway, just take a look at previous post. in gateway choose "uBeac Multiple Sensors" then choose a "Gateway URL" and "Submit."
.
.
After this you should see data in Live Data section. like picture below.
.
Next step is the device setup. go to Device from left side menu. click on add device. fill the "Device UID" and choose a name and description for your device. check picture below.
.
After click on Submit you should see the sensor results, like picture below. now we have to set up a dashboard to visualize data and see real time on uBeac IoT platform.
.
Go to dashboard menu, then click on + to add new dashboard. pick a name and description, and submit the form. now click on dashboard you just made. in the 0.0.214 version you can add any kind of widgets from the menu. just drag and drop it to crate your dashboard view. I this tutorial choose indicator. after that you should manage the indicator view and parameter. It's just very easy.
.
If you have any question just ask me in the comments below. answer to your question is like a meal to me, so go on and ask any kind of questions you have.
Comments
Please log in or sign up to comment.