The basics of any Internet of Things application using Ubidots are: devices, variables, math engine, dashboards, and alerts. In this tutorial, we will address each of these and explore device management in a quick video in at the end.
A device is any asset taking in sensor data and transmitting said data through a connection protocol to Ubidots' cloud. Click here for current firmware examples and tutorials for connecting your device to Ubidots.
All devices are different, but the standard setup on any device entails:
- A library that should be installed in the device's IDE.
- Filling parameters for authentication and connection such as a token (i.e. the unique ID for each account or user), device label, variable label (i.e. devices and variables identifiers or names in Ubidots), Wi-Fi SSID, or Wi-Fi password, depending on the device and requirements.
- Making API request (i.e a call from a device to the web server). Ubidots’ libraries spare the need to manually make these requests. However, if you’re working with a device we aren’t currently supporting, you can choose a connectivity protocol such as MQTT or HTTP to make a request.
Once a device is created and connected to Ubidots, the data created from your sensors are known as variables.
- Default - raw data coming from devices (people counted).
- Derived - the result of a mathematical operation of a default variable (people counted -5).
- Rolling Window - correspond to statistical operations of default variables in a determined spam(average daily traffic this month)
Below you will read more of derived and rolling window variable setup.
There are two ways to create variables: by starting from Ubidots, or assigning a label to the respective variable from your device's IDE.
Math & Stats Engine
Ubidots Math & Stats Engine is simple but effective with Derived and Rolling Window variables that create additional insights from your default variables.
For example, to calculate energy consumed by a device (refrigerators,, we will need to create a derived variable called Power, which is the product of Current and Voltage (P=C*V). Default variables refer to the result of a mathematical operation of a default variable (e.g. Current/1000).
Ubidots powerful math engine allows to do much more than multiplications; beyond basic math operations, you can perform further functions, such as trigonometric functions.
Also, we will create a variable that will tell us the total energy consumed for the last day by the Machine 1. To do so we will use a Rolling Window variable that refers to the result of a statistical operation of a default variable in a span (e.g today’s Current average). Choose Machine 1 (Device), Power (Variable), Sum (operation) and today (Periodicity), as seen below.
And we're done. If you set up the variables the same as we did, you should see something like this:
Note that default variables are yellow, and variable and Rolling Window variables are green. Anyhow, you can customize their colors by setting up your app's branding.
In the description of each variable, you can add the unit of measurement for the data readings. For instance, energy consumption is measured in KW/s.
For additional examples of variables, please look to these video tutorials:
If you prefer, you can also watch a video tutorial to learn how device management work in your Ubidots for Business account:
Dashboards are interfaces where data is easily visualized. Depending on your license, your Ubidots account will let you create as many dashboards as needed, which you can customize with widgets. For more additional details on your dashboard's construction, check out this tutorial.
Below you can see visualize dashboards created with Ubidots — some with a single visualization, and others with multiple metrics, maps, indicators, and more.
- Single-indicator dashboard
- Energy monitoring dashboard
- Temperature monitoring dashboard
- Machine maintenance dashboard
In Ubidots, events (or alerts) are messages triggered and delivered through email, SMS message, or Telegram based on a customized design rule created by the application builder. If you wish to create alerts for your IoT application, check out this tutorial for additional support.
3 Event types:
- When sensor readings reach a specific value:
- When a device's variable is inactive during a specific amount of time:
- When a device enters or exits a specific area (geofence):
Check out this video tutorial below for a hands on view to creating alerts —and their end delivery format.