TFT Environment Monitor Using BMP180 & DHT11

10,087

68

11

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

https://www.instructables.com/id/Mini-Arduino-envir...

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!

Share

    Recommendations

    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest
    • 1 Hour Challenge

      1 Hour Challenge
    • Classroom Science Contest

      Classroom Science Contest

    11 Discussions

    0
    None
    alainn

    3 years ago on Introduction

    Hi Tomsk

    I got the same error message than Maxime so I do what you said about Adafruit GFX library

    now I have a new error message: in fonction void loop

    environment :197:error: freeMemory wasn't declared in the scope

    what can I do ?

    thanks

    Al

    1 reply
    0
    None
    tomk11alainn

    Reply 3 years ago on Introduction

    I no longer have the hardware with me to troubleshoot so I can't set it up again to see if I have a mistake in the guide. Hope you can work it out on your own!

    0
    None
    alainn

    3 years ago on Introduction

    I got the same error message than Maxime so I DID what you said about Adafruit GFX library

    0
    None
    MaximeM

    4 years ago on Introduction

    Hello,

    I have any problem :

    This report would have more information with
    "Show verbose output during compilation"
    enabled in File > Preferences.
    Arduino: 1.0.6 (Windows Vista), Board: "Arduino Uno"
    Environment.ino: In function 'long unsigned int Text()':
    Environment:252: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:254: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:256: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:262: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:263: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:264: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:265: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:266: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:268: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:275: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:276: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:277: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:278: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:279: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:280: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:281: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:282: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:283: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:290: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:291: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:292: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:293: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:294: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:295: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:296: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:297: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:298: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:299: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:300: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:307: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:308: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:309: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:310: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:311: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:312: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:313: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:314: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:315: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:316: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:317: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:318: error: 'class Adafruit_ILI9340' has no member named 'nextLine'
    Environment:319: error: 'class Adafruit_ILI9340' has no member named 'nextLine'

    5 replies
    0
    None
    tomk11MaximeM

    Reply 4 years ago on Introduction

    It looks a lot like there is a problem with the Adafruit_ILI9340 library from that. Are you sure you have installed it right? Will the example sketch run fine?

    0
    None
    MaximeMtomk11

    Reply 4 years ago on Introduction

    Hello,

    Thank you for your help.
    I downloaded a new Adafruit_ILI9340 on GitHub, the examples work, but I still have the same errors.
    The "Adafruit_ILI9340" folder librarie is in the "libraries" folder.

    I tried to put "Adafruit_ILI9340.h" and "Adafruit_ILI9340.cpp" in the same folder as "Environment.ino" by putting #include "Adafruit_ILI9340.h" it does not work better.

    Regards,

    Maxime

    0
    None
    tomk11MaximeM

    Reply 4 years ago on Introduction

    Hi, I have updated my zip file. Please redownload it and replace your Adafruit_GFX.zip with the new one in the folder. Unfortunately i can't test it because I dont have my arduino with me at the moment but I think it should work.

    Tom

    0
    None
    MaximeMtomk11

    Reply 4 years ago on Introduction

    I downloaded a new Adafruit_GFX:

    https://github.com/adafruit/Adafruit-GFX-Library

    It does not work better, I have the same error message.

    0
    None
    MaximeM

    4 years ago on Step 4

    Hello,

    I tried your sketch but I get errors,
    DHT11 and with the display.
    why it does not work for me.

    Regards,

    Maxime

    1 reply
    0
    None
    tomk11MaximeM

    Reply 4 years ago on Introduction

    Hello, thanks for your comment. If you post the error message here & anything else you think is relevent I might be able to help.