HTE - DHT11 Temperature/Humidity Sensor

Overview

For Fullscreen: https://www.youtube.com/watch?v=yQ9TVkTYFSE

This Tutorial will show you how to use and connect a DHT11 Temperature/Humidity Sensor with the Quantum System


What is the DHT11 Sensor?

The DHT11 Sensor has four pins. From left to right, the first pin is the vcc pin. It is used to power the sensor. The second pin is the the data pin, which will give data like temperature and humidity to the connected system. The third pin is not used in this tutorial. The last pin is the ground pin.


Assemble the Circuit

Picture

Name

Quantity

Link

Picture

Name

Quantity

Link

 

DHT11 temperature sensor

1

Included in Component Kit

Or you can purchase it here

Male to Male and Male to Female jumper wires

3

Included in Component Kit

Or you can purchase it here

Q-Client Builder Base

1

Q-Client

If you have all the parts listed above, we can go ahead and build the circuit. It should look like this:

The red wire connects to the 3.3V of the Builder Base and the vcc pin of the sensor. To connect the data output of the sensor with the Builder Base the green wire is used. The GND channel of the Builder Base is connected with the GND pin of the sensor via the black wire.


Pair the Builder Base

Now we want to pair the Builder Base with our Q-Server. In order to do so, go to the Homescreen of your Q-Server.

Next click on the lift side symbol labeled “Clients”. Switch to the “Unpaired” tab at the top middle of the screen.

You should see your unpaired Builder Base. If not, check if you have plugged in the power supply for the Builder Base. Now move to the three dots below “Actions” and click “Pair”.

Once your Client is paired, click the “Setup” button.

Now you can edit your Client. Give him a Name you want and also a location where you are going to use it. Hit “Save” when you finished.


Build the Firmware

So once the Builder Base is paired and set up, we can start building our firmware. Move to the “Firmware” tab on the left side of your Q-Server interface. Hit “+ Create New”.

You will be prompted to give your new firmware a name. We named ours “DHT11”.

Once you created the new firmware, hit the “+ Add Hardware” button on the top, next to the “Actions” button.

We are going to search for a temperature sensor and a humidity sensor. You can use the search bar or scroll down till you find it. We need two because the DHT11 Sensor gives both temperature and humidity data. After this, you can give it a name and then click on “Add Hardware”. We named ours “Temperature” and “Humidity”. Next we need to configure the firmware. Click on the temperature bar:

As the “Driver” we use DHT11, because we are using a DHT11 Sensor. For the “Pin” we set it to GP6. You can use any pin of the Builder Base, but make sure to choose the one, that is actually connected to the sensor. The “Resolution (F)” is set to 1. It means that if the temperature changes the temperature data given out will be updated every 1 Fahrenheit. You can change the “Resolution (F)” from 0 to 9. If set to 9 every 9 Fahrenheit the system will update the data it sends out.

For the humidity firmware it is basically the same. Set the “Driver” to DHT11 the “Pin” to GP6. The Difference is now the unit for the Resolution. Since humidity is specified in percent you can set it to 1%. So if the humidity changes with 1% the system will update the data. You can set a value between 0 and 5.

Next we have to upload the firmware file to our Builder Base. Click on the three dots below “Actions” and click on “Upload”:

Choose the correct Builder Base and hit “Upload”. You should see a progress bar pop up at the right side of your screen.


Build the App

While the firmware is uploading, we can build the application for our Button. Move to the “Apps” tab on the left side. Click on “Create New” and give it a name you want. We named ours again “DHT11”. Hit “Create”.

You will find yourself on the Canvas.

For this tutorial we will need a Humidity hardware object, a Temperature hardware object and two Text interface objects.

Connect the Temperature and Humidity hardware object with the Text interface objects. We named the Text interface objects like the hardware objects they are connected to.

Click “Save App” on the top right. You will return to the first screen of the “Apps” tab. Now click the play button on the bar located at the right side.

Now we have to map the hardware and interface objects we have put together before to the actual hardware of the circuit. Click on the “Humidity” tab and choose the Client, which is connected to the DHT11 sensor.

Once you done click “Save + Run”.


Run the App!

Click on the “Dashboard” icon in the top right corner.

Select the DHT11 app.

As you can see the sensor will now send data about the Temperature and Humidity.


Display data on LCD

In the second demo we want to display the data from the DHT11 sensor on a LCD.

If you don't know how to connect a LCD to a Builder Base and build the firmware have a look at our other Tutorial .

We will now look at the app we’ve build before and how we have to modify it:

To add the LCD to the previous app we will need a “String Merge” code object and a “LCD” hardware object. The “String Merge” will merge every input string and put it out as one String. You also can give Names to the different Strings A to D. We name String A “Temp:” and String D “Humidity:”. So the data string of the temperature and the data string of the humidity will be put into one string. This string will then be send to the “LCD” hardware object. It will display it on the LCD later on.

Click “Save App” on the top right. You will return to the first screen of the “Apps” tab. Now click the play button again on the bar located at the right side of the app.

Since we have already mapped the “Temperature” and “Humidity” we only need to map the “LCD” as you can see above. Choose the right Client the LCD is connected to and hit “Save + Run”.

As you can see the Temperature and Humidity will now be displayed on the LCD. Also the given Names like “Temp:” and “Humidity:” are now visible on the display.

This is how you connect and use a DHT11 sensor with the Quantum System. We also learned how to use a DHT11 sensor with a connected LCD.

Happy Making!