LinkIt One DHT11 Webserver
by Volthaus Electronics Laboratory in Circuits > Microcontrollers
1521 Views, 11 Favorites, 0 Comments
LinkIt One DHT11 Webserver
UPDATE Nov 7, 2015 7:35 CST: Edit in sketch - Increased serial to 115200 seems more stable on refresh
Setting up a webpage you can access from anywhere to see your home temperature is a very convenient service you can provide for yourself at no additional cost such as paying webhosting or having to depend on some third-party service such as Devicehub or Thingsspeak.
A little info about this Ible. It involves a LinkIt One (LIO) dev board and a DHT11 temp/humidity sensor. The LIO reads the data from the DHT11 and acting as a webserver it creates a webpage that displays the information on any computer connected to your home network. With a little additional work you can make the webpage viewable from any computer that is connected to the internet. My first such setup was done with an Arduino Nano using a wired ENC28J60 ethernet connection module and a DHT22. You can see the page that setup is generating at http://volthauslab.ddns.net
If you're wondering why the url is the way it is instead of my home IP address I am using a free noip.com host to forward the request so I am not posting my home IP all over the interweb.
What You Need
Okay you will need:
- LinkIt One board.
- DHT11 temperature and humidity sensor
- The LDHT library
- The LinkIt One sketch
- Also a 10k resistor, bread board and jumper wires
Putting It Together
The configuration is simple. Run jumpers to the power rails on the breadboard from the 5v and GND pins on your LinkIt One to give it 5v and ground. Then connect the 5v and ground pins from the DHT11 to your breadboard and run a jumper wire from the output/signal pin on the DHT11 to the D2 input on your Linkit One. The reason for not connecting direct to the LinkIt One is because using the bread allows to place a 10k resistor between the 5v pin and the signal output jumpers. You can see in the picture of the DHT11 I added the resistor permanently to my DHT11 which would allow me to plug the three jumpers directly into my LinkIt One, but I went ahead and used the breadboard in the pictures to give a visual to show how the setup looks.
Once you're all wired up you should upload the sketch iottemp.ino to your Link It One. Make sure you've added the LDHT library to your Arduino IDE. One way of finding out the IP of your LinkIt One is to log into your router using your web browser (usually that is http://192.168.01, or http://192.168.01, ) I am using a Linksys router and the photo shows where that information is located. Once logged into the router go to the status page.then click Local Network. On that page click the Client Table and you'll see the list of devices connected to your router with the IP address of each device
If you have several devices connected to your network you can look for the MAC address as well. I am using a Linksys router and the photo shows where that information is located. Once logged into the router go to the status page.then click Local Network. On that page click the buttonDHCP Client Table and you'll see the list of devices connected to your router with the IP address of each device.That is printed on the back of the LinkIt One.Now that you know what IP your LinkIt One has you can open that address in your web browser (mine was assigned 192.168.1.114) and you will see the webpage the LinkIt one is serving. I think an IP could have been assigned via the sketch but if there were already a device connected to the router with that IP I believe that could cause a conflict. And also i would like to add sometimes I have to reset the LinkIt One because it seems to stop responding to requests so I offer no guarantees on this coding. :-)
Download the LinkIt One sketch for the project here and the LDHT library to add to the Arduino IDE is here
On the Internet
Setting it up so that the page is available for viewing on the Internet is not too difficult. There are quite a few articles on how to setup a webserver at home available on the internet
For this example the setup I'll be describing is a home wifi network with a Linksys router. What you want to do is open Port 80. You can do this in the router as well. In the Linksys that is done in the Applications & Gaming section.
NOTE: Currently my internet access is via Hughsenet satellite and there is no way to run a webserver through their network. I will finish this part when i am back where cable intenet is available so i can confirm the router settings. That will be on or about Nov. 12, 2015. Until then as i said there are quite a few articles on how to setup a webserver at home available on the internet.
thank you and i hope you enjoy this Instructable.
DC @ VEL