Recently, a need arose to take humidity readings of a crawlspace, over an extended period of time. An Arduino clone called the Bare Bones Board (BBB) is used in this project, mainly for its ability to be mounted to a breadboard.
Using a commercial-off-the-shelf sensor and microSD card, the logger takes temperature and humidity readings at a predefined time interval and writes the readings to a text file on the card. An Octave/MATLAB script is shown that plots the results.
All source code can be found on GitHub.
- Modern Device BBB
- FTDI Cable (TTL-232R-3V3)
- Jumper Wires
- DC Power Supply
- 1 * 10k Resistor
- MicroSD Card
- DHT22 Sensor
- MicroSD Breakout Board
I had the BBB already assembled, and knew it’d make for a tidy finished product. If you don’t have the time/care to solder one together, any Arduino will do. This will also prevent the purchase of an FTDI cable if you don’t already have one.
The DHT22 kit currently comes with a single 10k resistor; feel free to skip buying the whole pack if you get the kit.
While an Octave/MATLAB script is included to display the data, you can use Excel or any other tool you’re comfortable with to visualize the results.
The current time delay value in the code is set to one second, this can be changed for your specific application.
Be mindful of the power shunt on the BBB. When attached to the computer with the FTDI cable it must be set to ‘USB’, when attached to the DC power supply, it must be set to ‘EXT’.
- Install all software for the Arduino IDE and FTDI cable. Make sure you can program ‘Blink’.
- Format the microSD card.
- Make the circuit as shown below.
- Carefully insert the totally assembled BBB to the breadboard such that it looks like below. It helps to align the GND/+5V pins to the respective cables.
- Attach the BBB to the computer using the FTDI cable. Make sure the BBB’s power shunt is set to ‘USB’.
- Using the Arduino IDE, program the source code to the board.
- Unplug the FTDI cable, set the power shunt to ‘EXT’, and insert the microSD card. After placing the logger wherever you want to take readings, plug in the DC power supply. The green LED on the BBB should turn on, and the red LED on the microSD board will blink during writes.
- When you’ve collected the required data, insert the microSD card into a reader on your computer, and open ‘LOG_FILE.TXT’. If all went as planned, there should be three columns: milliseconds since boot, temperature (F) and humidity (%).
- Copy and past the log file such that it is in the same directory as the Octave/MATLAB script, plot_results.m, run the script.
- If all went well, you should get a plot like the following: