Hello everyone,
I am racking my brain to figure out why my DHT11 sensor is only returning 0's for Temperature and Humidity on my Arduino Mega 2560. I am using the DHT11 sensor with 3 pins that already has the pullup resistor soldered onto it, plus I have tested that the DHT11 is working with the same board on the same pins using a test sketch (included in the attachments). OK now I will try to give you a full idea of what I am doing, hopefully without being too exhausting.
I am making a Filament dryer for my 3D printing projects. The basic idea is that I will control (via relays) a heating element and a fan to heat and circulate air inside of the drying chamber. The Temperature and current humidity in the chamber will be monitored by the DHT11. I am timing the drying cycle using a DS3231SN RTC outputting a 1HZ pulse attached to an interrupt that will increment the timer which is displayed on the Velleman VMA203 LCD and Button Shield that I am using as the display. Once every 5 seconds the arduino will read and sample the Temperature and Humidity then display those values along with the timer. Both the RTC and the DHT11 are powered from the 5v rail on the Arduino Mega, as is the LCD.
The LCD Shield uses digital pins 4-9 for communication and digital pin 10 for the backlight also used A0 for the 6 on board buttons.
The RTC is attached to the SDA (20) and SCL(21) pins for I2c and digital pin 19 for the 1HZ interrupt.
The DHT11 is attached the A10 for communications.
I am using Arduino IDE 1.8.13
I know the main sketch is probably a huge mess and possibly hard to follow because it is made up mostly of repurposed examples modified to fit what I need. But I can't seem to find what would be causing the DHT11 to only return 0's. I even put a couple lines into the function to read the DHT11 that allow it to ignore interrupts while it is reading the sensor, since the datasheet says it takes a while to read, thinking that maybe it was getting interrupted. That was not the case or if it is the 2 snippets of code I found to temporarily diable interrupts then re-enable them is wrong.
Thank you in advance for any help given, and please be patient I am new and trying to be as thorough as possible with the information provided here.
DHTtester.ino (2.48 KB)
LCD_SHIELD_MENU_WIP.ino (23.1 KB)