loading

Arduino Temp/Humidity with LCD and Web Interface

Picture of Arduino Temp/Humidity with LCD and Web Interface
I recently helped a client move their office which included setting up a new computer room.
I wanted them to be able to check the temperature and humidity of the room both by checking an LCD display in the room and also via a web page. I put together an Arduino with a DHT11 sensor, 16x2 LCD display and ENC28J60 Ethernet module. I did the project in stages first getting the DHT11 portion working using the DHT11 library and examples from Adafruit, then adding an LCD display and finally adding Ethernet using the EtherCard library and modifying their example code . This makes troubleshooting a lot easier and I could build/learn the code as I went along. I have taken code from the various examples provided with the necessary libraries.

This instructable will go through the steps to prototype this.

Note: the DHT11 sensor isn't very accurate - about plus and minus 2 degrees Celsius and 5% accuracy for humidity. I'll probably be changing to a DHT22 which is plus and minus .5 degrees Celsius and between 2% and 5% for humidity. The good news is it's an easy change in the code.
 
Remove these adsRemove these ads by Signing Up

Step 1:

Picture of
What you will need:

  • An Arduino
  • DHT11 or DHT22 sensor from Adafruit or various ebay vendors
  • 10K resistor for the DHT11 pullup
  • 16x2 LCD display HD44780
  • 10k trimpot for LCD contrast
  • 100 Ohm resistor for the LCD backlight
  • ENC26J60 Ethernet module or shield
  • Prototype shield if you use a regular Arduino and ENC28J60 Ethernet shield
  • hookup wire, breadboard etc for prototyping

Step 2: Wiring up the DHT11

Picture of Wiring up the DHT11
IMG_2212.JPG
IMG_2213.JPG
The DHT11 and DHT12 have 4 pins. Looking at it with the side with square cutouts in it the pins are from left to right:
  • +5v
  • Signal
  • not used
  • GND
It also requires a 10k pullup resistor between +5V and Signal
For this project the Signal lead goes to Digital Pin 2 on the Arduino

The images show the DHT11 soldered into a prototype shield with the signal lead going to the Arduino digital Pin2

1-40 of 50Next »
I am using same library and connection here temp. and humidity is displaying on LCD and the connection of Ethernet module is showing on LCD but temp and humidity not showing on web page and the Ethernet test is also not working Is there any change in setting of IP in computer
SteveRoy (author)  nishant arora10 days ago

Are you using a enc28j60 or a W5100 (WizNet) ethernet adapter?

If your network isn't on a 192.168.1.x subnet made sure to change the IP address in the sketch to match your subnet and make sure it's a free IP address

snoop9112 months ago

Have the ethernet drivers for the wiznet w5100 or the enc28j60 been pulled into the main arduino core yet? I couldn't find it in the github repo but perhaps I'm not looking in the right place. (Kinda confusing with hardware 'sam' vs 'avr')

For example, is there hardware that works out of the (ide) box for this:

http://playground.arduino.cc/Code/WebServer

SteveRoy (author)  snoop91110 days ago

The W5100 is in the Arduino core and is the:

#include <Ethernet.h>

The ENC28J60 needs the library added to your library folder

AnthonyT62 months ago

How do we change the temperature to read Fahrenheit instead of Celcius?

SteveRoy (author)  AnthonyT62 months ago

To convert from C to F the equation is:

C x 9/5 +32 = F

or C x 1.8 +32 = F

so after the line:

int t = dht.readTemperature();

you could try something like..

t = (t * 9)/5 +32;

or

t = (t * 1.8) + 32;

you may need to change:

int t = dht.readTemperature(); to

float t = dht.readTemperature();

so it can read and display the temp in decimal places.

MortenR2 months ago

This is the only tutorial I have found to be compatible with my setup. Now if I can only change the code to display the temperature on the web page in Fahrenheit as well. That's what I'm working on now. Thanks SteveRoy.

POC.jpg

Hi, further down in an earlier comment is a note on converting the temperature reading to Fahrenheit. To display both you could create another variable for Fahrenheit, convert C to F and add the extra info in the homePage part of the sketch.

akajester made it!4 months ago

This saved me so much time! I was working on the individual parts, but having a hard time putting it all together, until I came across this! Thank you so much! The next step is to upload the data to thingspeak!

20150306_214146.jpg

Why send your data to Thingspeak?

SteveRoy (author)  akajester3 months ago

Nice, I must try uploading to thingspeak too!

saputroyulianto made it!3 months ago

[want to ask]

hi i from Indonesia, i still success until step 6 :)
buat i have problem with the ethernet shiled, i use ethernet shield from DFRobot

http://www.dfrobot.com/index.php?route=product/pro...

the library is different with the ENC28J60, anyone can help me?

3in1.jpg
SteveRoy (author)  saputroyulianto3 months ago

Have a look at this project - it's not mine, but similar and uses a W5100 chip

https://arduino-info.wikispaces.com/ethernet-temp-humidity

mnajjar made it!4 months ago

Thank " instructables.com "

until Step 6 :) amazing *_&
i dont try step 7

11042101_859227714143972_1323458292_n.jpg
SteveRoy (author)  mnajjar3 months ago

Nice!

Gran Abuelo7 months ago

How hard would it be to modify the code to upload the data to thingspeak or a similar service?

SteveRoy (author)  Gran Abuelo6 months ago

Foe me? hard. For a programmer, probably fairly easy.

Start here:

http://community.thingspeak.com/tutorials/arduino/using-an-arduino-ethernet-shield-to-update-a-thingspeak-channel/

hi.... I connected the enc28j60 module to arduino and to pc ethernet card directly using a patch cable. but, the indicator lights on the module or ethernet cable are not glowing. although the red light on module is working . can you help me out???
SteveRoy (author)  nitishdash20106 months ago

You may need a cross over cable if you go directly from a PC to the enc module

psycho.maggot8 months ago

sorry to much asking, what if using lcd shield like in this site: http://www.famosastudio.com/lcd-shield

did it will make more simple?.. and how the wiring, its completly different cuz its shield. and yours was just lcd and trimpot.

SteveRoy (author)  psycho.maggot8 months ago

No, not with my sample code - It uses digital pin 10 which is used by the Ethernet module in my example. You would have to change the code and pins that the Ethernet uses. What's wrong with the way I have it in my build? If it's too many wires to solder then get an LCD with the i2c "backpack" and change the code.

thanks man, yeah you right, too many wire to be soldered. thats why i ask. ok.

psycho.maggot8 months ago

aye bro. what if we don't using the trimpot, did need a change on the wiring diagram or not?

SteveRoy (author)  psycho.maggot8 months ago

no, you could use a resistor for the contrast or use pwm off an Arduino port, but you will need something for the contrast. More recently I have been using i2c/SPI "backpacks" for LCD displays - easier in some ways as they only need 4 wires to connect to the Arduino, come with back-light via an on-jumper and have the contrast trimpot built-in. The down side being there are multiple library's for them and finding the right one can be a chore. They tend to use analog ports off the Arduino as well, so it frees up digital ports for other things.

thank you. its better and easier to changing the contrast with trimpot rather using another way that you've explain.

rbayonet made it!10 months ago

Thanks for this great instructables, it took me some time but worth it. I will want to add a barometric sensor in the future.

arduino temp umid.jpg
SteveRoy (author)  rbayonet8 months ago

Hi rbayonet, good to hear you got it working. If you add a barometric sensor let us know the steps - maybe do an instructable on it.

SebastianD210 months ago

Dear Instructables!! Excellent!!!. I made it!!! The steps are very explicit. I'll try to put together all in board Pro Mini. Consumption will support the usb port? external power supply?. Thank you very much. Sebastián.

SteveRoy (author)  SebastianD28 months ago

thanks for the feedback and glad to hear you got everything working.

pjha49 months ago

enc28j60 works directly with Atmega32 microcontroller without using the arduino module ?

SteveRoy (author)  pjha49 months ago

Yes, take a look at what Tux Graphics are doing

http://tuxgraphics.org/electronics/

lineuve1 year ago

Congratulations for our work.

I think I am coming to conclusion. Do you think its because I am using Arduino Ethernet shield Wiznet 811MJ module and it doesn't work . will it make any difference if I don't use "

ENC28J60"

because rbb server example complies and upload onto Wiznet 811 MJ. but when I try to use Web server example from Arduino Example it works fine?

Please Help

Thank you

Would you be able to make changes to the Final_sketch.ino as I m using Wiznet 811MJ module but not

ENC28J60?

SteveRoy (author)  ankitshyani1 year ago

Have a look at this project - Note it's not my project, but should help you with the sketch you need. It uses the WizNet module rather than the ENC28J60 I used in my Instructable

https://arduino-info.wikispaces.com/ethernet-temp-humidity

I am using exact same library as its provided over this Page. I have managed upload the Final sketch onto Uno connected to ethernet Sheild interface with LCD . it displays Temperature and humidity correctly onto LCD . But when I try to type in web the IP address which I am using onto network google chrome comes out with this error "

Oops! Google Chrome could not connect to 129.12.50.145

Try reloading: 129.­12.­50.­145"

Is it any possible reason its not working . is it because I am using arduino Ethernet sheild!

SteveRoy (author)  ankitshyani1 year ago

Did you test the Ethernet Shield as per Step 8?

SteveRoy (author)  ankitshyani1 year ago

Are the PC and Arduino on the same subnet? i.e. what is the IP address of your PC?

ColCar1 year ago

Hello Everyone !

I am also new to all of this and its been a lot to absorb, this instructable was very helpful and I wouldn't make any progress without this kind of information and I Thank You for posting it.. I followed the steps and got everything working until the Ethernet part. Im using the Arduino Ethernet shield and I am not sure what part of the webserver example sketch to cut and paste into the FinalSketch provided here.. All help would be extremely appreciated.

1-40 of 50Next »