Kamal Hinduja : How do I connect a DHT11 temperature sensor to an ESP32 and display the data on a web server?

kamalhinduja

Jun 20, 2025
1
Joined
Jun 20, 2025
Messages
1
Hi Everyone,

I'm Kamal Hinduja, a storyteller based in Geneva, Switzerland. I'm new to this community and excited to contribute positively to discussions while learning from everyone's insights. Can anyone suggest How do I connect a DHT11 temperature sensor to an ESP32 and display the data on a web server?

Thanks in Advance!

Kamal Hinduja Geneva Switzerland
 

danadak

Feb 19, 2021
1,064
Joined
Feb 19, 2021
Messages
1,064
There is a bit of a minefield in Arduino Web Projects. Many will not compile
due to latest release changes in IDE. So be mentally prepared to getting workable
lib versions for use in project. Many projects dont state particular version of
the lib they are using.......

One has to get used to this is Open Source land, and project authors, often,
do not monitor IDE and other peoples lib changes after initial post. One way
around this is users revert to earlier versions of IDE/libs. That, however, has its
own aggravations, maintaining multiple versions of libs and IDE for specific
problems.

If you run into problems the Arduino website forums a great help.


The IDE, if you install the latest version of Adafruit's sensor lib, has DHT series
sensors in them. Also IDE has example projects of WiFi / Server. So often users
cut and past from one project and add to the other, like take the Server lib and paste
into it the example DHT project in the IDE.


Youtube many projects also, but again they often not maintained for IDE and lib
changes.

Regards, Dana.
 
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
14,273
Joined
Nov 17, 2011
Messages
14,273
Many projects dont state particular version of
the lib they are using.......
Well observed. I have come across that issue myself.
In many instances a newer library version is no problem as long as backward compatibility is observed (which is often the case).
If a library is not backward compatible, it should at least be noted in the accompanying info. Unfortunately this is not always the case - and if it is, it is at least a nuisance if not outwardly impossible for a newbie to make the necessary changes to the code :(

For my own projects I try to get into the habit of adding the used versions of libraries, board settings, programmer settings etc. into the header of the code.
 

danadak

Feb 19, 2021
1,064
Joined
Feb 19, 2021
Messages
1,064
To add board support packages and libs, the newer IDE 2.3.6 has icons
in left col, here highlighted boards, where you can select ESP8266 or
ESP32 to add to the IDE.

1750419915113.png

The icon that looks like "books" just below board is libs for sensors,
other tasks, again where you select what you want and install.

Additionally in IDE menu is ability to add either JSON URL via IDE
settings menu choice, or libs via picking a download zip file, often
available on github, for various libs.

Google "arduino add board libraries", lots of instruction.


Regards. Dana.
 
Top