Masdevallia with AM2302 Temperature / Humidity Sensor |
New to this step is a temperature / humidity sensor from Adafruit Industries. I went with the AM2302 since I think the DHT22 will give a reasonable amount of accuracy and I liked the larger plastic housing. I did end up soldering a scrap length of CAT5 cable to the sensor's wires to make the wires long enough to get out of the vivarium to the board.
Description | Cost |
---|---|
AM2302 (Wired DHT22) Temperature-Humidity Sensor | $15.00 |
Wiring
Components with Logical Connections |
- The AM2302 runs on 5V along with the LCD and RTC.
- The ground line is connected to common ground.
- The data line is connected to digital pin 2 on the Boarduino.
Code
Initial setup of the sensor involves creating a new DHT object and passing in the data pin and sensor type as parameters.
Each pass through the loop, read the values from the sensor. The sensor only produces readings every two seconds, so this might be better reduced to only reading every 5 seconds or some other arbitrary interval.
Full source code is available on github:
https://github.com/dmalec/Project-Masdev/tree/master/masdev_temp_humid
LCD Showing Time, Humidity, & Temperature |
Description | Cost |
---|---|
AM2302 (Wired DHT22) Temperature-Humidity Sensor | $15.00 |
Boarduino | $17.50 |
FTDI To USB Adapter | $14.75 |
16x2 LCD | $9.95 |
LCD Backpack | $10.00 |
Real Time Clock (DS1307) | $9.00 |
12V 6A Power Supply | $8.62 |
Total | $84.82 |
The next step is recording the temperature and humidity readings to an SD card and graphing the data using RRDTool.
how to change date and time
ReplyDeleteThe code sets the date and time to the date and time the sketch was compiled:
Delete// initialize the RTC
rtc.begin();
if (!rtc.isrunning()) {
// if this is the first time talking to the RTC,
// set the time to the sketch compile time
rtc.adjust(DateTime(__DATE__, __TIME__));
}
After that, there's no was to adjust date and time. I found that this worked for my project; but, there are other projects that it might not work as well for.