In this tutorial, we will learn how to read temperature and humidity of some specified surrounding using your Surilli WiFi and DHT11 Temperature and Humidity Sensor Module. These temperature and humidity values will be stored in excel using a tool named "Tera Term."
Required Hardware- Surilli WiFi.
- DHT11 temperature & humidity sensor (3 pins)
- Connecting wires
- Arduino IDE software
- Tera Term Tool: This software will be used to read the values from DHT11 Sensor and then store these values in Excel
The DHT11 humidity and temperature sensor makes it really easy to add humidity and temperature data to your DIY electronics projects. It’s perfect for remote weather stations, home environmental control systems, and farm or garden monitoring systems.
Working PrincipleThe DHT11 detects water vapor by measuring the electrical resistance between two electrodes. The humidity sensing component is a moisture holding substrate with electrodes applied to the surface. When water vapor is absorbed by the substrate, ions are released by the substrate which increases the conductivity between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity. Higher relative humidity decreases the resistance between the electrodes, while lower relative humidity increases the resistance between the electrodes.
The DHT11 measures temperature with a surface mounted NTC temperature sensor (thermistor) built into the unit.
The DHT11 uses just one signal wire to transmit data to the Arduino. Power comes from separate 5V and ground wires. A 10K Ohm pull-up resistor is needed between the signal line and 5V line to make sure the signal level stays high.
There are two different versions of the DHT11 you might come across. One type has four pins, and the other type has three pins and is mounted to a small PCB. The PCB mounted version is nice because it includes a surface mounted 10K Ohm pull up resistor for the signal line. In this tutorial, we will use 3 Pins DHT11.
- Humidity Range: 20-90% RH
- Humidity Accuracy: ±5% RH
- Temperature Range: 0-50 °C
- Temperature Accuracy: ±2% °C
- Operating Voltage: 3V to 5.5V
- S : Signal Pin.
- Middle : Voltage Pin (VCC).
- - : Ground Pin (GND).
Tera Term is one of the more popular Windows terminal programs. It's been around for years, it's open source, and it's simple to use. For Windows users, it's one of the best options out there.
You can download any version of Tera Term from the link given below:
https://osdn.net/projects/ttssh2/releases/
I am using version v 4.103 for this project.
Making a ConnectionYou should initially be presented with a "Tera Term: New connection" pop-up within the program. Here, you can select which serial port you'd like to open up. Select the "Serial" radio button. Then select your port from the drop-down menu. (If this window doesn't open when you start Tera Term, you can get here by going to: File > New connection).
That'll open up the port. Tera Term defaults to setting the baud rate at 9600 bps (8-N-1). If you need to adjust the serial settings, go up to Setup > Serial Port. You'll see a window pop up with a lot of familiar looking serial port settings. Adjust what you need to and hit "OK".
The title of your Tera Term window should change to something like "COM##:9600baud" -- now that's a good sign.
That's about all there is to it. The blank window with the blinking cursor is where data is both sent (by typing it in) and received.
Tera Term Tips and TricksLocal Echo
It can be weird to type stuff in the window and not see it show up in the terminal. It's undoubtedly still flowing through the serial terminal to your device, but it can be difficult to type when you don't have any visual feedback for exactly what you're typing. You can turn on local echo by going to the Setup menu and selecting Terminal.
Check the Local echo box if you'd like to turn the feature on.
There are other settings to be made in this window as well. You can adjust the size of the terminal (the values are in terms of characters per row/column), or adjust how new-lines are displayed (either a carriage return, line feed, or both).
Clear Buffer and Clear Screen
If you want to clear your terminal screen you can use either the "Clear buffer" or "Clear screen" commands. Both are located under the Edit menu.
Clear screen will do just that, blank out the terminal screen, but any data received will still be preserved in the buffer. Scroll up in the window to have another look at it. Clear buffer deletes the entire buffer of received data -- no more data to scroll up to.
Shortcut KeysMenus are a pain! If you want to get really fast with Tera Term, remember some of these shortcuts:
- ALT+N: Connects to a new serial port.
- ALT+I: Disconnects from the current port.
- ALT+V: Pastes text from clipboard to the serial port (not CTRL+V).
- ALT+C: Copy selected text into clipboard (not CTRL+C).
- CTRL+TAB: Switch between two Tera Term windows.
Connectionsbetween Surilli WiFi and DHT11 Sensor:
Surilli WiFi --> DHT11 Sensor- USB Pin (5V) (Surilli WiFi) --> Middle Pin (VCC) (DHT11)
- PIN 12 (Surilli WiFi) --> S Pin (DHT11)
- GND Pin (Surilli WiFi) --> - Pin (DHT11)
Make sure you have selected the right port, board and processor for the Surilli as shown in the picture below and it is programmable (compile and upload “Blink” from File>Examples>Digital>Blink onto your Surilli to check if everything is working fine).
The CircuitryThe circuitry is quite simple. Its mostly the programming. Follow the figure below to set up your hardware.
- Download the library for DHT from the link given below:
https://github.com/surilli-io/DHT11-Library
- Unzip it and paste in into This PC > Documents > Arduino > libraries.
- Now you have completed setting up your hardware and Arduino IDE. Copy and paste the Arduino sketch given below into your Arduino IDE and hit upload.
- After the Arduino Code has been uploaded, open your "Tera Term" software, then click on "Serial". Against Serial, select the Port No by referring to your Arduino IDE Software and then click the "OK" button. After clicking on the OK button, the different values of humidity and temperature will start to appear on the black screen of your software.
- After that, click the "File" Tab on the upper part of the black screen of the software and select "Log". This will prompt you to save the values of both humidity and temperature in a ".csv" format which is the extension for the Excel. Save the file with any name you want along with ".csv" and in the "Option" tab just below, check the "Time Stack" option. After that click "OK" and then you will have your values in the Excel File.
#include <dht.h>
#define dht_apin 12
dht DHT;
void setup()
{
Serial.begin(9600);
Serial.println("Date & Time, Humidity %, Temperature *C");
delay(1000);
}
void loop()
{
DHT.read11(dht_apin);
Serial.print("Current humidity = ");
Serial.print(DHT.humidity);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(DHT.temperature);
Serial.println("C ");
delay(1000);
}
Results:In my case, the values of both temperature and humidity in Excel were recorded as follows:
Note: You can make the necessary changes / modifications in the Arduino Code according to your requirements and see how it reacts to different values and logic.
That’s all for now. If you have any queries, visit surilli.io or contact our support.
Comments
Please log in or sign up to comment.