Arduino Uno - cannot make ESP8266 and DHT22 work at the same time

Hi, my project requires me to send data gathered from more sensors (so far I am only using DTH22) to a server via HTTP request. I am using an Arduino Uno board and an ESP8266-01 WiFi module.

I have posted the schematics below. The ESP8266 connection works fine, but I cannot see the data from DHT22 unless I remove the jumper that connects the Arduino Reset and GND, but then I lose the connection.

It is my first experience with microcontrollers so please be as explicit as you can:)

Esp8266 | Arduino

RX | RX
TX | TX
GND | GND
VCC | 3.3V
CH_PD | 3.3V
GPIO 0 | None
GPIO 2 | None

Arduino | Arduino

Reset | GND

L.E.

So far the code is not much, as I am trying to get the physical connections work.

I am testing the ESP8266 connection in the Serial Monitor with the “AT” command.

Code for reading the DHT22 data:

#include <dht.h>

dht DHT;

#define DHT22_PIN 2

void setup(){
  Serial.begin(9600);
}

void loop()
{
  int chk = DHT.read22(DHT22_PIN);
  Serial.print("Temperature = ");
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  Serial.println(DHT.humidity);
  delay(1000);

}

ablaau:
I cannot see the data from DHT22 unless I remove the jumper that connects the Arduino Reset and GND, but then I lose the connection.

Where are you expecting to see the data from DHT22?

Please post your full sketch.

If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help.

If the sketch is longer than the forum will allow then it’s OK to add it as an attachment. If you click the “Reply” button on this forum thread, you will see an “Attachments and other options” button. Don’t put your code in some external file service like dropbox, etc. We shouldn’t need to go to an external website just to help you.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you’re using the Arduino Web Editor then you will not have access to this useful tool. I recommend using the standard Arduino IDE instead.

When your code requires a library that’s not included with the Arduino IDE please post a link (using the chain links icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.

I added more info. I am just trying to get the physical connections work for now, as this is my biggest struggle. There is not much code at the moment.

The RX and TX pins on the Uno are used for communication with the Serial Monitor. You’re currently using the Uno just as a USB to TTL serial adapter to communicate directly between your computer and the ESP8266.

If you want to run your program on the Uno, communicate between the Uno and the ESP8266, and between the Uno and the Serial Monitor, then you can’t have the ESP8266 connected to the Uno’s RX and TX pins. You need to connect the ESP8266 to some other pins on the Uno and use the SoftwareSerial library to do serial communication on those pins with the ESP8266. But there’s a problem: The SoftwareSerial library won’t work reliably at the 115200 baud communication speed the ESP8266’s AT firmware uses by default. So while you still have it connected as you do now, send the appropriate AT command to change the baudrate to 9600.

When rewiring the connections for software serial, you need to make the connection between the ESP8266 RX-TX, TX-RX, rather than RX-RX, TX-TX as you currently are doing. This is because “RX” stands for “receive” and “TX” stands for “transmit”.

Thank you so much, I'll give it a try. :slight_smile: