Why isn't my ATmega328P sending DHT11 sensor data to the ESP-01 module via MQTT?
I am working on a temperature and humidity monitoring system using an ESP-01 module (ESP8266) and an 8-bit AVR microcontroller (ATmega328P). I am using the DHT11 sensor to read temperature and humidity values. The ESP-01 is used to send the sensor data to an IoT platform via Wi-Fi using the MQTT protocol. The system is running on the Arduino OS.
I have been able to configure the software to communicate with a sensor and transmit data, also set up pins for serial communication, initialized the sensor to read temperature and humidity, and implemented error checking for readings, then built a message with sensor data and tried to send it to the ESP-01 module. But then still encountered this error:
The ATmega328P is not successfully sending the read data to the ESP-01 module. If successful, the ATmega328P should be able to read and send the sensor data to the ESP-01 module.
This is my code snippet:
@Middleware & OS
Solution:Jump to solution
The ATmega328P and ESP-01 need to communicate at the same baud rate. Change ESPserial.begin(115200); to ESPserial.begin(9600);.
2 Replies