IoT being an integral part of cloud computing, several cloud vendors make the Internet of Things (IoT) part of the services they render. Also, with the emergence of IoT, the different platform makes IoT implementation available even to individuals. In this tutorial, I will be taking you through the steps in sending data from ESP8266, an IoT development platform, to the Qubitro IoT platform. To ensure all necessary things are in place, you must set up your computer to communicate with NodeMCU or ESP8266 before you can follow this tutorial.
The Qubitro Platform
Qubitro is the fastest way to build IoT applications with predictable pricing, developer-friendly features, and scalability. Qubitro makes it easy to monitor your devices quickly and manage storage, all-around integrations, and management. To read more on the services offered by Qubitro, head over to www.qubitro.com
The Hardware setup
The very first step is to ensure that your PC has been configured to communicate with ESP8266. If you haven’t done this already, now is the time. Once you have configured your PC, come right back to continue following this tutorial.
Connect the NodeMCU and the DHT 11 to the breadboard; depending on your model of DHT 11, it can be a 3-pin ready-made model or a 4-pin model. In this tutorial, I am using a 4-pin model. If you are using a 3-pin model, connect the VCC to 3V of the NodeMCU, GND of the DHT 11 to GND on the NodeMCU, and connect the data pin to Pin 4 of the NodeMCU. If it is the 4-pin model you are using, connect Pin 1 of the DHT11 to 3V of the NodeMCU, connect the 10K resistor between pin 1 and pin 2 of the DHT 11, leave pin 3 of the DHT 11 sensor unconnected, and connect pin 4 of the DHT 11 to GND on the NodeMCU. Connect the NodeMCU via a USB cable to your computer, and you are good to go.
Setting up Qubitro
After setting up the hardware, we need to configure and set up Qubitro to receive data from our device. To access the Qubitro portal, head over to www.qubitro.com; there, you will be presented with the Qubitro homepage. Here, you can read more on Qubitro services, the documentation, and API support. Qubitro supports different connectivity protocols; we shall be looking at them later. A heads up, we will be using the MQTT protocol for this tutorial.
To be able to access the Qubitro development dashboard, we need to login into the Qubitro portal; on the Qubitro homepage, click on Go to the portal at the top right-hand corner. If you do not have an account, you will be prompted to create one, and if you are a returning user, just sign in to your account.
After signing in, you will be presented with the Qubitro main interface, where we can see all projects created. The left-hand panel contains all controls regarding our projects, Creating a new project, Monitoring, documentation, usage, billing, etc. What we want to do is to create a new project and new devices inside this project that will link to our actual hardware.
To create a new project, click on New Project, and you will be directed to fill in the project name and description. Give your project a name and a better description that matches your project requirements. After filling in the two, click on “Create Project”.
After successfully creating a project, you must choose a connectivity method between your device and the Qubitro platform. Various options are available to choose from MQTT, HTTP, The Things Stack, Golioth, Actility, etc. However, since we are using ESP8266 in this tutorial, the best option is the MQTT; therefore, select MQTT and click on “Continue”.
Immediately, we will be asked to set up our devices. Devices are different from projects in that each device will be mapped to one actual IoT device; therefore, our projects can contain more than one device depending on the number of actual IoT devices we are considering. First, give your device a name and also set the description, the device brand can be anything depending on your brand name, and the device model can be your IoT device model name. After filling in the details, click on “Continue”.
After clicking continue, we will be presented with the necessary credentials we need to connect our device to Qubitro. We will be copying this into our code later; for now, click on “Continue, I’ll do this later”.
With this, we are done setting up our project and assigning a device to it. Under project settings, we can find settings on project ID, project name, and also the option to delete the project. To access our device data, analytics and rules, click on “Devices”.
Under the device settings, we can see our device credentials, Device ID, and Device Token. You can copy this since we will be using these in writing our code. I would like to point out that, unlike some other IoT platforms where you can create your dashboard widgets alongside your project, for Qubitro, you have first to send data to Qubitro before you can create the widgets; this is to enable Qubitro automatically assign telemetries to the widgets.
Writing the code
A snapshot of the code is shown in the image above. To successfully compile the code, we need to grab the Qubitromqttclient library from the Arduino IDE library manager. Head over to tools > manage libraries and download the QubitromqttClient library.
Type in your network SSID and Password, paste the DeviceID, and Device Token copied from Qubitro device settings to the Arduino code, the link to the code: Go through the code, and you will be able to edit the data being sent to Qubitro, for this tutorial, I am sending DHT 11 data which are temperature and humidity.
After filling in all necessary details and editing the code according to your need, compile and upload the code on the ESP8266. After uploading, open the serial monitor to see the device’s behavior.
Setting up our Dashboard
After successfully sending data to Qubitro, we can now set up our dashboard, go back to Qubitro and we will set up our widgets. If we go to the data tab on our device, we will see that data has been received from our IoT device.
To set up our dashboard, navigate to Monitoring and click on New Dashboard, give your dashboard a name, this should be according to your device for easy identification. Click on Add Widget and fill out the necessary information according to your project, create all the needed widgets for all your telemetries. Select your widget type according to your data and you are done creating your widget.
With this, we are done setting up Qubitro to receive data from ESP8266.
Full step-by-step Tutorial Video: https://youtu.be/85RM0oG-Y1E