How to send data from ESP8266 to Qubitro using DHT11

How to send data from ESP8266 to Qubitro using DHT11

Full step by step Tutorial Video:

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, there is a different platform that 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 will have to set up your computer to communicate with NodeMCU or ESP8266 before you can follow along with this tutorial.

The Qubitro Platform

Qubitro is the fastest way to build IoT applications with predictable pricing, developer-friendly features, and scalability. Quattro makes it easy to quickly monitor your devices, 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

Step 1:

The very first step is to ensure that your PC has been configured to communicate with ESP 8266. 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.

Step 2:

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.

No alt text provided for this image


Setting up Qubitro

Step 3:

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 Qubitro homepage, here you can read more on Qubitro services, the documentation and API supports. 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.

No alt text provided for this image


Step 4:

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.

No alt text provided for this image


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. Step 5: To create a new project, click on New Project, and you will be directed to fill in the project name and project description. Give your project a name and a better description that matches your project requirements. After filling in the two, click on Create Project.

No alt text provided for this image


Step 6:

After successfully creating a project, you will need to choose a connectivity method between your actual device and the Qubitro platform. Various options are available to choose from MQTT, HTTP, The things stack, Golioth, actility, etc. Since we are using ESP8266 in this tutorial, the best option for us is the MQTT therefore select MQTT and click on Continue.

No alt text provided for this image


Step 7:

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. Give your Device a name and also set the description, 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.

No alt text provided for this image


After clicking continue, we will be presented with the necessary credentials we need to connect our device to Qubitro. We will be copying this later into our code later, for now, click on Continue, I’ll do this later.

No alt text provided for this image


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.


No alt text provided for this image
No alt text provided for this image


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 will like to point out that, unlike some other IoT platforms where you can create your dashboard widgets alongside your project, for Qubitro, you have to first send data to Qubitro before you can create the widgets this is to enable Qubitro automatically assign telemetries to the widgets.

Writing the code

No alt text provided for this image


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

No alt text provided for this image


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.

No alt text provided for this image


After filling in all necessary details and editing the code according to your need, compile and upload the code on the ESP8266. After done uploading, open the serial monitor to see the device's behavior.

No alt text provided for this image


Setting up our Dashboard

Step 8:

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.

No alt text provided for this image


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.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

With this, we are done setting up Qubitro to receive data from ESP8266.

Full step by step Tutorial Video:

Neval Dalgic

Community-led Minded Manager & Creator Community Lead @ Budizzz

2 年

Thank you for this detailed step by step tutorial Samuel Adesola! A must read guide on Qubitro.

回复

要查看或添加评论,请登录

Samuel Adesola的更多文章

社区洞察

其他会员也浏览了