STM32 and DHT11 Library, Circuit Diagram, and programming using Arduino IDE

STM32 and DHT11, Description:


STM32 and DHT11 Library, Circuit Diagram, and programming using Arduino IDE-  

While working on the STM32 and DHT11 based temperature and humidity monitoring system I faced an issue that was my DHT11 sensor was giving me 255 values for both the Temperature and Humidity. While searching I found out that maximum of the guys were facing the same issue. The previous DHT library that I was using with the Arduino didn’t work with the STM32. I fixed this issue by replacing the DHT11 library, seriously I searched for hours and finally, I found the correct version of the DHT11 Library which works perfectly with the STM32 microcontroller board. The library download link is given in the programming section.

It’s just a beginners level project and the purpose of this tutorial is to help you guys how to program the STM32 microcontroller board using the Arduino IDE. So, basically, in this tutorial you are going to learn two things, the first one is how to use the DHT11 temperature and Humidity Sensor with the STM32 and the 2nd one is how to use an I2C supported Oled display module with the STM32 controller board. The type of the Oled display I am using is the SSD1306 which I have been using with the Arduino, ESP8266, and ESP32 controller boards.

Without any further delay let’s get started!!!

Amazon Links:

STM32F103C8T6 Controller Board

DHT11 Temperature and Humidity Module

SSD1306 Oled Display Module

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

DHT11 Interfacing with STM32:

STM32 and DHT11

A 10K ohm resistor is connected between the VDD and DATA pin of the DHT11 Temperature and Humidity Module. The VDD pin is connected to 3.3V pin of the STM32 Microcontroller board, the Data pin of the DHT11 Sensor is connected to PA2 Analog pin of the STM32 controller board, and the GND pin of the DHT11 sensor is connected to the GND pin of the STM32 Microcontroller board.

The SSD1306 Oled display module Power supply pins are connected with the 3.3V and GND pins of the STM32 microcontroller board. The SCL and SDA pins of the Oled display module are connected with the B6 and B7 pins of the STM32. B6 is the SCL and B7 is the SDA.

STM32 and DHT11

I connected the Oled display module and the DHT11 temperature and humidity sensor as per the circuit diagram.

In order to program the STM32 microcontroller board using the Arduino IDE, first you will need to flash the bootloader, and you will also need to install the STM32 board, and some drivers. I have a very detailed tutorial on this and I highly recommend you should read this article. Now, let’s take a look at the programming.

Download the DHT Library

DHT11 STM32 Programming using Arduino IDE:

This program I wrote for the Arduino which also works with the STM32 Microcontroller board. I made a few changes. I added the stm32 version of the SSD1306 library, and I also changed this DHT library.

Finally, I change the pin number to which the DHT11 temperature and humidity sensor is connected and rest of the programming is exactly the same. So, that’s all for now.

STM32 and DHT11

I successfully displayed the Temperature and Humidity values on the Oled display Module using the STM32F103C8T6. In my upcoming tutorial, I will send the temperature and humidity values using the SX1278 Lora Transceiver Module. You can subscribe to my website and YouTube channel if you don’t want to miss any of my upcoming tutorial.

Watch Video Tutorial:



Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button