In this tutorial I am going to show you guys how to make an Arduino or NodeMCU based Weather Station using DHT11 or DHT22 temperature and humidity sensor and display it using an OLED Display.
I am going to use the board I created in this tutorial in my next project where I will be sending Temperature and Humidity readings to my Raspberry Pi based home server where I will be storing it in a MySQL database, so stay tuned.
This tutorial demonstrates how to build a weather station using an Arduino or NodeMCU, utilizing DHT11 or DHT22 sensors for temperature and humidity measurement and an OLED display for data visualization. The guide covers sensor mechanics, display integration, and the fabrication of a custom PCB via PCBWay to house the components.
In this tutorial, I'm going to show you guys how to make an Arduino or NodeMCU based weather station
using DHT11 or DHT22 temperature and humidity sensor and display it using an OLED display.
This video is sponsored by PCBWay. PCBWay specializes in manufacturing of very high
quality, low volume, colored PCBs at a very budgetary price. In addition to standard PCBs,
you can order advanced PCBs, aluminum PCBs, rigid flex PCBs. They also provide PCB assembly and
other related services which can meet your need at the greatest extent. The DHT11 and DHT22 are
both low cost, very basic and slow temperature and humidity sensor which can be used for basic
data logging. Despite being slower, they are very stable and consumes low power and provides
relatively high measurement accuracy. The single bus digital signal is output through a built-in
ADC which is easy to read using any microcontroller. The single bus interface saves the IO resource of
any microcontroller board. The operating voltage is between 3V to 5V and the sampling period for
DHT11 is 1Hz or 1 reading every second and for DHT22 it is 0.5Hz or 1 reading every 2 seconds.
Hence you cannot query them more than once every second or two. The DHT sensors are made of two
parts, a captive humidity sensor and a NTC temperature sensor. The NTC temperature sensor
is actually a variable resistor whose resistance decreases with the increase in temperature.
For measuring humidity, two electrodes with a moisture holding substrate between them is used.
When the humidity changes, the conductivity of the substrate changes or in other words,
the resistance between these two electrodes changes. This change in resistance is measured
and processed and is sent to the microcontroller. A very basic chip inside the sensor does the
analog to digital conversion and spits out the digital signal which is read using a microcontroller.
Here is a comparison chart of the two sensors. Looking at this, it is very clear that the DHT22
outshines DHT11 in every aspect. However, if accuracy is your concern and you are ready to
pay a bit higher price, go for DHT22. Otherwise, DHT11 should be good for you.
OLED or Organic Light Emitting Diode is a light emitting diode in which the emissive
electroluminescent layer is a film of organic compound that emits light in response to
electric current. OLEDs are used to create digital displays such as television screens,
computer monitors, portable systems such as mobile phones, handheld gaming consoles and PDAs.
An OLED display works without a backlight because it emits visible light. There are many
types of OLED display available in the market based on their size, color, brand, protocol,
SPI or I2C, passive matrix or active matrix control scheme. To know more about OLED display
and to know how to connect multiple OLED display using TCA9548 multiplexer, check out my tutorial
number 7, OLED display using Arduino and NodeMCU. The link is in the description below.
Let's have a closer look at this display. At the back of this display, there are heaps of
SMD capacitors and resistors soldered on board. But since it's an I2C device, we only care about
these two pins, SCL and SDA. The display connects to Arduino using only four wires,
two for power and two for data, making the wiring very simple. The data connection is I2C
and the interface is also called two-wire interface. The onboard pins can be in different
order, so always triple check before hooking it up to your project. Operating voltage is between 3V
to 5V, but it's best to use the guidance from the manufacturer's data sheet. In picture, these
displays look very big, but practically speaking, they are tiny. They are made up of 128 by 32 or
64 individual OLED pixels and do not require a backlight. Just have a look at this and see how
small it is. Even though it's very small, they are very useful in electronic projects. This is
how an OLED display is connected to either Arduino or NodeMCU. The setup using Arduino or NodeMCU is
very simple. We just need to connect the OLED to the I2C pins and the temperature and humidity
sensor to any one of the digital pins. In this setup, I have connected the OLED to A5 and A4
and the sensor to D8. Now let's look at the code. Let's start by including the DHT and the OLED
libraries. In the setup section, we initialize the display and then in the loop section, we loop
through every two seconds and read the sensor and display the result on the OLED display.
Here is a quick demo using Arduino. Same as the previous setup, the OLED display connects to the
and the sensor connects to the D3 pin. The code is also same where we start by including the DHT
and OLED libraries. Then in the setup section, we initialize the display and then in the loop
section, we loop through every two seconds and read the sensor and display the result on the
OLED display. So this is how the actual setup looks like. So this is how my board looks like
There are three breakout boards in this 100cm by 100cm assembly. Each board can be used with
either Arduino or NodeMCU and DHT11 or DHT22 sensor or sensor module. Once I had my design
ready, I just had to upload the Gerber file to the PCBWay's website and then select the type,
color, and any other customization that I want and then just send it for fabrication.
For my project, I chose the black color. PCBWay ships from China to most of the countries of the
within 3 to 7 business days. Talking about the quality, it's absolutely mind-blowing.
The board can be used with either NodeMCU or Arduino Nano. Temperature and humidity readings
can be collected using either DHT11 or DHT22 module or by using one of these sensors with
a 10k resistor. The bottom section of the board is for the OLED display. The attached Gerber is
bit different from what you see on screen. I made a bit of modification in the final version
and moved the sensor a bit far from the microcontrollers. Since I care a lot about
my sensors and microcontrollers, I'm not soldering them directly to the board. Instead,
I'm soldering female pin headers to the board which will house all the sensors and microcontrollers.
Just for the sake of this video, I'm soldering female pin headers on both sides for Arduino
and NodeMCU. However, in your setup, you will need either Arduino or NodeMCU.
Let's first test this board using Arduino. Now let's test this using a NodeMCU board.
Looks perfect. I'm going to use this board in my next project where I'll be sending temperature
and humidity readings to my Raspberry Pi based home server where I'll be storing them in my
SQL database. So, stay tuned. Thanks again for watching this video. I hope it helps you.
If you want to support me, you can subscribe to my channel and watch my other videos.
Thanks. See you again in my next video. Bye now.