Arduino Leonardo WEB Server to Display Temperature and Humidity

In a previous post titled Arduino Leonardo and SPI Communications, I documented how to connect the Arduino Leonardo to the ENC28J60 Ethernet module. This post takes things a bit further and adds a DHT22 Sensor. The Arduino Leonardo is used as a WEB Server to Display Temperature and Humidity information from the DHT22 sensor.

The UIPEternet library is used to create a WEB server at IP Address 192.168.2.77 (which needs changed to whatever address would be appropriate for your LAN). The DHT library is used to communicate with the DHT22 sensor.

Here is the wiring graphic:

Leonardo  Enc28j60 DHT22You can get the Fritzing.org code to create that image here. When you visit the WEB page in a browser, here is what the page looks like:

 

DHT22 WEB Sample InformationHere is the DHT22_ENC28J60_WEB.ino source code to make it all happen:

7 comments

Skip to comment form

    • Matthew Young on August 11, 2019 at 4:46 pm
    • Reply

    Can you use an sd to record the raw data as well as do a live display?
    I’ve been trying to get both going but not successful with my current coding.

      • Matthew Meyer Young on August 11, 2019 at 5:09 pm
      • Reply

      Also, can a Ethernet shield using the w5500 series be used?

        • earl on August 12, 2019 at 4:39 am
          Author
        • Reply

        Hi Matthew,

        For your reference https://github.com/UIPEthernet/UIPEthernet/issues/19

        To use the w5500 you will need a different library. The UIPEthernet is for the ENC28j60.

        Earl

          • Matthew Young on August 13, 2019 at 3:13 pm
          • Reply

          Thanks for the info. Also I did purchase the same hardware as what is posted for your circuit today but when trying to compile it states
          “dht.h: No such file or directory” Even though I have downloaded/installed multiple libraries of this.
          Can you link the DHT library you used for this. I have tried finding it but there are so many versions.

            • Matthew Young on August 13, 2019 at 3:16 pm

            I did finally find one I think is close but I get the following error.
            exit status 1
            ‘dht’ does not name a type

            • earl on August 14, 2019 at 7:27 am
              Author

            Hi Matthew,

            The link (https://playground.arduino.cc/Main/DHTLib/) is actualy in my post where it references the DHT library. If you take a look at that link, it has the code for the DHT ‘library’ which you need to cut and paste. It tells you how in the Notes section.

            Earl

      • earl on August 12, 2019 at 4:36 am
        Author
      • Reply

      Hi Matthew, I’ve not done anything with an SD card on an arduino but others have with great success. There is lots on info around on it.

      Earl

Leave a Reply

Your email address will not be published.