Introduction: Arduino Attic Environmental Monitor

I have been considering adding additional insulation to the attic and needed a way to track the temperatures. Since I have been teaching myself basic electronics and Arduino programming, this seemed like a good opportunity to test my skills with a practical project. I wanted a remote temperature and humidity logger that would run unattended in the attic for several days at a time on battery power.

I did this as a learning project, using (mainly) parts on-hand; it works great, but don't expect a beautiful finished product, I went for functional not beautiful....I'll try my hand at 3D printing down the road.

Step 1: Parts

Here are the parts I used for this project:

  • Arduino Uno
  • 9V battery connector
  • 9V battery
  • DHT22 digital temperature & humidity sensor
  • SD card breakout board
  • Unused SD card
  • Breadboard
  • Breadboard jumper wires

Step 2: Connecting It All

This part of the instructions may vary depending on which exact parts/models you use, but here was my configuration:

I connected the Arduino 5V and Ground pins to the breadboard + and - strips, respectively.

I plugged in the DHT22 into the breadboard, connecting the VCC pin to the breadboard + and the GRD pin to the breadboard - pins; and connecting the DTA pin to the Arduino D2 socket.

I connected the SD card reader to the Arduino as follows (per the spec sheet):

  • CS to Arduino D10
  • DI to Arduino D11
  • DO to Arduino D12
  • CLK oto Arduino D13
  • G to breadboard -
  • + to breadboard +

Step 3: Arduino Sketch

I then wrote a basic Arduino sketch to check the temperature and humidity and record the results.

The logic was as follows:

  1. If the temperature changes by more than 1 degree since it was last logged, log the new values
  2. If the humidity changes by more than 1% since it was last logged, log the new values
  3. Record the current values every 5 minutes; this is configurable through the MIN_LOG_PERIOD value

The log filename is created dynamically with sequential numbers, so it will not overwrite previous results if you restart the Arduino.

I wrote a function logIt(...) to handle the actual logging of the data to the SD card (and the Serial Monitor depending on the USE_SERIAL_MONITOR value); this makes it easy to modify to add/remove parameters if I want to add additional sensors.

Step 4: Run It & Record Values

I set the unit in a small, open cardboard box and placed in the attic and let it run for over 24 hours. Sample output can be seen in the attached image.

Since I saved the file as a CSV, I was able to quickly open in Microsoft Excel and generate a chart.

Step 5: Future Enhancements

While logging the values with a sequential "event ID" is helpful, and actual date & time would be better; I have ordered an inexpensive real time clock (RTC) and will be incorporating that into the next version.