Instructables

Mini Arduino environment monitor ** UPDATE - Added RTC ***

FeaturedContest WinnerContest Winner
This is an Example of how you can use the Arduino to monitor various environmental parameters And display them on a LCD screen. 

Note: I Added a Real Time Clock!! To see the steps, added parts  and Sketch I added new steps..
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts List

Arduino uno R3 or compatible                                           30.00 
Sainsmart "1.8" TFT Color LCD Display                          18.50 
DHT11 Digital Temperature and Humidity Sensor        6.44 
Mini Breadboard                                                                    5.00 
Jumper Wire

Step 2: Connect display to Arduino

Picture of Connect display to Arduino
I used the mini breadboard to connect the display to the Arduino.
Use jumper wires to connect from the Arduino pins to the breadboard in the following order:
Arduino:  5v         TFT DISPLAY   VCC
                 gnd                                 GND            
Digital     4                                      SCL                  
                 5                                     SDA
                 6                                     CS
                 7                                     DC
                 8                                     RES

Edgar10 months ago
This can help security personnel monitor a lot of additional useful stuff, at a glance, you could make a commercial version of this. Voted and went to my Blog:
http://faz-voce-mesmo.blogspot.pt/2013/06/robots-brava.html
johnag (author)  Edgar10 months ago
Obrigado Edgar
anikin1976 johnag2 months ago

Hello.

The project remarkable, tell as to replace DHT11 sensor with the DS18S20 sensor, what it is necessary to change?

Edgar johnag10 months ago
Sempre às ordens.
Edgar johnag10 months ago
:)
anikin19762 months ago

Hello.

The project remarkable, tell as to replace DHT11 sensor with the DS18S20 sensor what it is necessary to change?

MoonDocker3 months ago

I don't know if anyone else noticed but you need to change the graphicstest code example from adafruit to work with this display. Make sure you have the below at the beginning of the code. The code comes preset with the code for the shield. I spent a few minutes trying to get my display to work and finally looked closely at the code.

// For the breakout, you can use any (4 or) 5 pins

#define sclk 4

#define mosi 5

#define cs 6

#define dc 7

#define rst 8 // you can also connect this to the Arduino reset

barracuda434 months ago
Hello,
I want to use a larger display 3.2 for this project, what would I use here?

Thanks nice project
barracuda436 months ago
Hello Well, maybe a stupid question but
How can I set the date and time I have some tried but no result.

Thanks Bill
johnag (author)  barracuda436 months ago
Use the sample sketch that came with the rtc library there is an option to set the rtc to your compute time

johnag (author)  johnag5 months ago
Code to set the clock:

if (! RTC.isrunning()) {

// following line sets the RTC to the date & time the sketch is compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
}
johnag (author)  johnag5 months ago
Here's an sketch to run just the RTC, copy and paste to the Arduino IDE. it sets the clock if it's not set.
// Sketch Build 1.04 compiled on Arduino 1.0.3.
// This sketch was modified to run the loop faster.. refresh rate is about 1.5 seconds.
// copy the sketch below and paste it into the Arduino IDE verify, and run the program.
// this sketch was created using code from the adafruit and RTC -libraries
#define sclk 4
#define mosi 5
#define cs 6
#define dc 7
#define rst 8

#include // Core graphics library
#include // Hardware-specific library
#include
#include // library needed for RTC
#include "RTClib.h" //RTC Library

RTC_DS1307 RTC;

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);

void setup(void) {

Wire.begin();
RTC.begin();

tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab

tft.fillScreen(ST7735_BLACK); // Clear screen

if (! RTC.isrunning()) {
tft.println("RTC was NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
delay(3000);
tft.fillScreen(ST7735_BLACK); // Clear screen

}
}

void loop() {
tft.setCursor(10,0);
tft.setTextColor(ST7735_WHITE);
tft.setTextSize(1);
tft.println("INSTRUCTABLES.COM");
tft.setTextColor(ST7735_YELLOW,ST7735_BLACK);//set text color & size for DATE coming from TinyRTC
tft.setTextSize(2);
tft.setCursor(5,30);
DateTime now = RTC.now();
tft.print(now.year(), DEC);
tft.print('/');
tft.print(now.month(), DEC);
tft.print('/');
tft.print(now.day(), DEC);
tft.println(' ');
tft.setCursor(15,70);
tft.setTextColor(ST7735_GREEN,ST7735_BLACK); //set color for TIME
tft.setTextSize(2);//set text size for TIME coming from TinyRTC
tft.print(now.hour(), DEC);
tft.print(':');
if(now.minute() < 10) {
tft.print('0');
tft.print(now.minute(), DEC);
}
else {
tft.print(now.minute(), DEC);
}
tft.print(':');
if(now.second() < 10) {
tft.print('0');
tft.print(now.second(), DEC);
}
else {
tft.print(now.second(), DEC);
}
tft.println(" ");

}

ptosaure7 months ago
Hi, I have a problem with the library, in my sketch it's written :

In file included from sketch_sep21a.ino:12:
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:9: error: stray '\302' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:9: error: stray '\267' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:9: error: stray '\302' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:9: error: stray '\267' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: stray '#' in program
In file included from sketch_sep21a.ino:13:
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:9: error: stray '\302' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:9: error: stray '\267' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:9: error: stray '\302' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:9: error: stray '\267' in program
In file included from sketch_sep21a.ino:13:
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:315:46: error: exponent has no digits
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:316:62: error: exponent has no digits
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_ST7735/Adafruit_ST7735.h:599: error: stray '#' in program
In file included from sketch_sep21a.ino:12:
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:4: error: expected unqualified-id before '<' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:403: error: expected constructor, destructor, or type conversion before 'const'
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected unqualified-id before '=' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected unqualified-id before '<' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected constructor, destructor, or type conversion before '.' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected unqualified-id before '<' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected unqualified-id before '<' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected constructor, destructor, or type conversion before '.' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected unqualified-id before '<' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected unqualified-id before '<' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected constructor, destructor, or type conversion before '.' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected unqualified-id before '<' token
C:\Users\Bichon\Desktop\arduino-1.0.3\libraries\Adafruit_GFX/Adafruit_GFX.h:552: error: expected unqualified-id before '<' token


I have try other version and other library but they don't work... coul'd you help me please
Thank you
syahirjapar7 months ago
can you guide me sir?
jmh430818 months ago
The DHT sensor and display are working fine. When I try to compile this sketch on either the 1.01 or 1.05 IDE environment I get

sketch_aug18a:17: error: expected constructor, destructor, or type conversion before numeric constant
sketch_aug18a.cpp: In function 'void setup()':
sketch_aug18a:23: error: request for member 'attach' in '11', which is of non-class type 'int'
sketch_aug18a.cpp: In function 'void loop()':
sketch_aug18a:78: error: request for member 'temperature' in '11', which is of non-class type 'int'
sketch_aug18a:82: error: request for member 'humidity' in '11', which is of non-class type 'int'
sketch_aug18a:86: error: request for member 'fahrenheit' in '11', which is of non-class type 'int'
sketch_aug18a:91: error: request for member 'kelvin' in '11', which is of non-class type 'int'
sketch_aug18a:96: error: request for member 'dewPoint' in '11', which is of non-class type 'int'
sketch_aug18a:100: error: request for member 'dewPointFast' in '11', which is of non-class type 'int
Ideas?
johnag (author)  jmh430818 months ago
Check the dht Library.seems like it's Not installed properly
kurtee8 months ago
Very nice instructable!
Don't forget to add the leading "0" for Minutes and Seconds when < 10 on the RTC.
; )
ariemaayan8 months ago
if you are looking to connect RPI + boards or any other combination I found a cheep solution: its called a BOARD_GANIZER check it out especially if you have a bunch of wires,
youtube.com/watch?v=7rqlSpln6U­­­0 found it on newark element14 website and Digikey
http://www.digikey.com/product-search/en?mpart=BG-32618&vendor=377
fishnveg9 months ago
Hi, I have a outdoor fishpond, and like to know any temperature sensor that can be used to monitor the water temp of my fishpond?
johnag (author)  fishnveg8 months ago
https://www.sparkfun.com/products/11050
That.s a link to a senor that may work for you.
lgabbert8 months ago
I finished my monitor this week. It works fine. I changed the color of the seconds from blue to green
johnag (author)  lgabbert8 months ago
Cool.. if you can, share a picture..glad someone else enjoyed building it as much as I enjoyed sharing it.
bremus9 months ago
So how can I datalog all the info for tracking?
johnag (author)  bremus9 months ago
You could probably log the data into a Micro SD card using the built in card slot on the display. I haven't tried that .. yet. Otherwise, you can log to your PC if you keep the USB cable plugged and use the serial.print ( ) command in addition to , or instead of the tft.print commands.. i.e replace all tft with serial and it will display on the arduino serial monitor -check the examples that come with the DHT libraries.
skamsie9 months ago
hello,

i have a question. What is the "2" for in " tft.print((float)DHT11.humidity,2);" ?

Thanks
ghauptman10 months ago
This is the one I ended up buying. I'm hoping I am able to incorporate it into your current project. I should have all the parts in the mail shortly.

http://www.amazon.com/dp/B009A525QS/ref=pe_309540_26725410_item
ghauptman10 months ago
John great instructables! I just ordered the parts online. Hopefully I can put it together correctly. Anyway you could also show how to add a barometer to it? I also wanted that to get measured and displayed.
johnag (author)  ghauptman10 months ago
If you want to have barometric pressure you will need a better sensor: check this one out http://www.adafruit.com/products/391 .They have all kinds of sensors, so browse around, it really depends how much you're willing to invest.
You won't have any problems putting this together . It really is an easy project, but if you need help just let me know.
thomasaw10 months ago
For an alternative DHT library, see here: https://github.com/adafruit/DHT-sensor-library
digipup110 months ago
Thanks!
digipup110 months ago
Can this work with mac?
johnag (author)  digipup110 months ago
Yes, you need to download the the arduino IDE for MAC from the link below
http://www.arduino.cc/en/Guide/MacOSX
lmperkins10 months ago
Nice job. I got my version up and running the first try! A minor suggestion: you might want to explicitly mention in step four that the DHT11 data pin gets connected to digital pin 2. Thanks for the Instructable. Now I'm going to see if I can get my clock chip to display where you've got the elapsed time displayed.
johnag (author)  lmperkins10 months ago
Easy to do project with with allot of satisfaction when you see it working!!! I don't have a RTC module but I was thinking about doing just what you mentioned. If you do , let me check it out. Thanks for your comment.
bradleyjn10 months ago
This project is awesome. It should be made into a shield with a small prototyping area. That would be so convenient.
Adafruit already makes a shield for the display, you'd just have to add the DHT11.
johnag (author)  bradleyjn10 months ago
Thanks for your comment. I'll look into making a shield for it. This is my first instructable so I'll be working on improving it.
fastenspy10 months ago
Here I come to you to tell you that the problem is solved with 1.0.5. In the library "arduino robot" there were files for the GFX at Adafruit. Both returned library conflict.
johnag (author)  fastenspy10 months ago
Glad you solved the problem. I haven't upgraded because I'm in the middle of programming the sensors, and upgrades always cause problems. Now I know what to do!
Thanks
fastenspy10 months ago
Hello,

I find the problem! I have an Arduino version 1.0.5 and you have the version 1.0.3. I returned back and it works. But I do not know why it is not compatible with the latest?

Since 1.0.5 they add or modify library which is a problem for your code:

(sources: http://arduino.cc/en/Main/ReleaseNotes)

[libraries]

* Upgrades to WiFi library
* Fixed a bunch of examples
* Added Arduino Robot libraries
* Added TFT display library
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!