As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Friday, June 12, 2020

SPA Project: Humidity/Temperature Detector




As I was exploring different components of Arduino, I thought it would be interesting if I could build something that would help me get a sense of the weather. I wanted to use the DHT11 sensor to detect the humidity and temperature of the day so I can figure out what to wear. 

Problem Space: Find a better sense of what to wear depending on the humidity and temperature of the day! 

Following a tutorial from https://how2electronics.com/interfacing-dht11-humdity-temperature-sensor-with-arduino/. I was able to get my LCD to turn on but had a difficult time figuring out how to get any digital display to show up. Many error messages were popping up. 

Unfortunately, I could not figure out how to get my LCD display the text that I want... but this is what I have so far and wish to see if anyone else could figure out what I did wrong here.


My code:
#include <dht.h> //downloaded from online
#include <LiquidCrystal.h>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

LiquidCrystal lcd(7, 6, 5, 4, 3, );
#define dht_dpin 8
dht DHT;
byte degree[8] =
{
0b00011,
0b00011,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
void setup()
{
lcd.begin(16, 2);
lcd.createChar(1, degree);
lcd.clear();
//lcd.print(” Humidity “);
lcd.setCursor(0,1);
//lcd.print(” Measurement “);
delay(2000);
lcd.clear();
}
void loop()
{
DHT.read11(dht_dpin);
lcd.setCursor(0,0);
//lcd.print(“Humidity:”);
lcd.print(DHT.humidity); // printing Humidity on LCD
//lcd.print(” %”);
lcd.setCursor(0,1);
//lcd.print(“Temp:”);
lcd.print(DHT.temperature); // Printing temperature on LCD
lcd.write(1);
//lcd.print(“C”);
delay(500);
}
}
 Error messages: 
Arduino: 1.8.12 (Mac OS X), Board: "Arduino Uno"

humidity_sensor:6:1: error: expected unqualified-id before numeric constant
 2
 ^
/Users/annabel/Documents/Arduino/humidity_sensor/humidity_sensor.ino: In function 'void setup()':
humidity_sensor:63:1: error: 'lcd' was not declared in this scope
 lcd.begin(16, 2);
 ^~~
/Users/annabel/Documents/Arduino/humidity_sensor/humidity_sensor.ino: In function 'void loop()':
humidity_sensor:75:1: error: 'lcd' was not declared in this scope
 lcd.setCursor(0,0);
 ^~~
/Users/annabel/Documents/Arduino/humidity_sensor/humidity_sensor.ino: At global scope:
humidity_sensor:86:1: error: expected declaration before '}' token
 }
 ^
exit status 1
expected unqualified-id before numeric constant

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

No comments:

Post a Comment