Introduction: TFT Environment Monitor Using BMP180 & DHT11
Edit 3rd Jan 2015 : Made some minor adjustments & fixes to the guide. Remember you must use my libraries that I provide otherwise this guide will not work.
This project is inspired by
It uses an atmega328p-pu as the brains and the DHT11 and BMP180 sensors as well as a 2.2 inch TFT.
It measures/calculates and displays the :
- Temperature in Centigrade
- Temperature in Fahrenheit
- Pressure in Pascals
- Pressure in Inches of Mercury
- Humidity in Percent
- The Altitude in Meters.
- Dew Point in Centigrade
Step 1: Bill of Parts
These are the prices I paid for these individual parts, including postage and packaging
£1.76 - 1 x Solderless Breadboard
£0.99 - 1x DHT11 Temperature and Humidity Sensor
£1.38 - 1x BMP180 Temperature and Pressure Sensor
£3.86 - 1x 2.2" Serial 240x320 SPI TFT LCD Module Display ILI9340C
£1.32 - 1x USB 2.0 to UART TTL 6PIN Connector Module Serial Converter CP2012
These are estimates of the value of the individual parts, I had all of these in my supplies already though.
£1.20 - 1 x Atmega328P-PU
£0.05 - 1 x 16Mhz Crystal
£0.02 - 1 x 0.1 uF cap
£0.10 - Small length of 22 awg wire
£0.01 - 1 x 1k Resistor
£0.01 - 1x 10k Resistor
Total cost: £10.70
Almost all parts came from ebay. The resistors and capacitors were from a tayda order though.
As with any project parts can be substituted. The capacitor and resistor values don't need to be exact. It works as it is but hasn't been tested with other values.
Step 2: Wire It Up
The connections are as follows from a standard arduino:
To the Screen
SCK - Arduino Pin 13
SDO(MISO) - Arduino Pin 12
SDI(MOSI) - Arduino Pin 11
CS - Arduino Pin 10
D/C - Arduino Pin 9
RESET - Arduino Pin 8
LCD - 3.3V
VCC - 3.3V
GND - GND
To the BMP180:
VIN - 3.3V
GND - GND
SCL - Anolouge 5
SDA - Anolouge 4
To the DHT11
VCC - 3.3v
Data - Digital 2 and add a pullup resistor
NC - Nothing
GND - GND
Step 3: The Code
My code is largely a mishmash of the example codes for the two sensors and the screen. Conveniently none of these required the same pins so I didn't have to sort out any problems there. I did rename some variables etc.
The only significant change was that I slightly edited the libraries for the display. I made it so when I told the display to write text it first drew a black rectangle over the area that it was meant to be drawing the text on. So each line would be erased and then written before we move on to the next line. In the origional you would erase the whole screen then write the whole screen. The result is that when we refresh the screen you see a tiny flicker rather than the whole screen flash white which gets annoying. My library will not be compatible with other peoples sketches but it works a lot better for this project.
I have uploaded all the libraries i use into one zip file along with the actual sketch. If you want to use the original library, you need to rename Adafruit_GFX_Original.zip to Adafruit_GFX.zip.
Step 4: Finished!
Voila, you are done! You may copy/modify/redistribute my work as you please but remember there may be strings attached to the things I have used.
Let me know what you think in the comments. Also let me know if there are any mistakes in the comments.
Happy environment monitoring!
We have a be nice policy.
Please be positive and constructive.