0

DHT22 & LCD Arduino Thermostat
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

DHT22 & LCD Arduino Thermostat

by Erik_G on Tue Sep 27, 2016 10:15 pm

Hello, I'm trying to create a thermostat with an Arduino UNO and a DHT22 sensor. I have it all hooked up to a breadboard, I've tested both the LCD and the DHT22, now I am having trouble displaying the sensor readings on an LCD.

my code is as follows
Code: Select all | TOGGLE FULL SIZE
#include <LiquidCrystal.h>
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() {
  dht.begin();
  lcd.begin(16, 2);
 }
void loop() {
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  lcd.setCursor(0, 0);
  lcd.print("Humidity :");
  lcd.setCursor(13, 0);
    lcd.print(h);
  lcd.setCursor(19, 0);
  lcd.print("%");
  lcd.setCursor(0, 2);
  lcd.print("Temperature :");
  lcd.setCursor(13, 2);
  lcd.print(t);
  lcd.setCursor(19, 2);
  lcd.print("C");
}


I'd love some help on this one as I'm rather new to electronics and microcontrollers, and I want to expand this simple thermostat into bigger and better things. Thanks :)

Erik_G
 
Posts: 2
Joined: Sat Sep 24, 2016 8:50 pm

Re: DHT22 & LCD Arduino Thermostat

by franklin97355 on Tue Sep 27, 2016 11:00 pm

So, what happens when you run the code? Have you run any of the example code yet.?

franklin97355
 
Posts: 18221
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: DHT22 & LCD Arduino Thermostat

by Erik_G on Wed Sep 28, 2016 6:58 pm

Well, I have now hooked up the DHT22 sensor and ran the test example and it is failing to read the sensor, also I am having issues with the LCD printing hello world now... Yesterday, I had hello world on the LCD at least, now I am having issues with both. The code verifies, and uploads, but obviously the sensor isn't being picked up by the UNO, and therefore the LCD wouldn't have anything to print, so I guess it's back to trying to get the DHT22 to work.

Erik_G
 
Posts: 2
Joined: Sat Sep 24, 2016 8:50 pm

Re: DHT22 & LCD Arduino Thermostat

by franklin97355 on Wed Sep 28, 2016 7:17 pm

Could you post large (less than 1meg), clear, detailed pictures of both sides of your board showing any soldering you have done and the connections to it?

franklin97355
 
Posts: 18221
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Please be positive and constructive with your questions and comments.