Save more than 10%

Buy an AirQ 305 wireless control board in bundle with an AirQ ShielD and you'll save more than 10%
View product

Save more than 10%

Save up to 10%

Buy an AirQ 310 wireless control board, with 6 relays and battery backup circuit, and you'll get a free Arduino AirQ ShielD
View product

Save up to 10%

Building a wireless thermostat using Arduino/3

In the second part of this tutorial we added to our wireless thermostat the ability to interact with the user through an LCD display and switches. We can simply increase/decrease temperature using two practical switches and we can see the ambient temperature on the LCD display. We also used an AirQ 100 wireless temperature sensor to separate the Arduino from where we want to detect temperature: this allows us maximum flexibility since AirQ 100 sensor can be placed wherever we want.

We are not satisfied, however: in the Internet of Things (IoT) era there is more to do. We want to control our thermostat by the Internet. And the good news it that it’s a trivial task tanks to Arduino Ethernet shield. Let’s go :-)

Bill of material

For this part of the tutorial we need the following material:

The hardware setup

The hardware setup is almost the same of the second part of this tutorial. There are only a couple of differences:

  • We obviously need the Ethernet shield and we can put it between Arduino and AirQ ShielD (we always suggest to put AirQ ShielD on the top to avoid reduction of operative distance between the shield and other AirQ Networks devices).
  • Since AirQ ShielD uses pin 10 and 11 and these pins are also used by Ethernet shield, we need to rearrange them. So, using a couple of patches, and leaving those pins non inserted in the ethernet shield pin headers, we can rearrange pin 10 and 11 on pin 8 and 9 respectively, as shown in the following photo.



With these two fixes we are ready to add web functionalities to our thermostat :-)

The code

The code isn’t too much different from the one in the previous part. We only need to add the web part. And to do this we use the excellent framework TinyWebServer by Ovidiu Predescu.

In the first part of the sketch we do all the required stuff to setup the web server. We create two page handlers: index_handler() and incdec_handler().  The first handler is responsible to generate the home page of the thermostat, as shown in the following screen capture:

Schermata 2013-04-01 alle 16.19.26

The incdec_handler() handles the call to /inc and /dec urls: these links allow to increment and decrement desired ambient temperature. The remaining part of the code is nothing more than the same code of the part two of this tutorial.


Different lines are highlighted and it’s really simple to see that those lines are only related to the web part. If you are not familiar to TinyWebServer we suggest to take a look to the SimpleWebServer example.

The following video shows the thermostat in action 😀


What’s next?

Our thermostat is still really minimal. There are many improvements that can be added to make it more robust and complete. For example, it could be really useful to add a way to put it in manual mode. This could simply done using a couple of switches connected to the inputs of the AirQ 305 I/O board. Another important feature is the ability to program it on time basis. To do this, a RTC should be used. Moreover, the web interface is still too bare and it could be improved with other functionalities. But now it’s up to you 😀 This tutorial gives all the needed info to setup a wireless and web oriented thermostat using Arduino, for a total cost of less than 130€ (take a look to wireless/web oriented thermostat around and you’ll discover that they are much more expensive). Moreover, this thermostat can be adapted to our needs, and it could be expanded to interface other temperature sensors and control boards. So, your imagination starts now! Enjoy 😉

Be Sociable, Share!

Posted on by admin in Arduino, Tutorials 7 Comments

7 Responses to Building a wireless thermostat using Arduino/3

  1. Luca

    Can I use another version of Arduino (Mega eg.)? Thanks

  2. ray ban sunglasses blue frame

    Right here is the right site for anybody who hopes to understand this
    topic. You know a whole lot its almost hard to argue with you (not that I actually
    would want to…HaHa). You definitely put a fresh spin on a subject that’s
    been written about for ages. Excellent stuff, just great!

  3. รับทำโปรเจค

    Hello there! I could have sworn I’ve visited this web site before but after looking at a
    few of the articles I realized it’s new to me. Anyways, I’m definitely happy I found it and
    I’ll be bookmarking it and checking back frequently!

  4. ชุดเดรส

    It’s very effortless to find out any matter on web
    as compared to textbooks, as I found this piece of writing
    at this website.

  5. Jada

    Ahaa, іts pleasant conversation aboսt thuis article here at this webpage,
    I have read all that, soo at this tme mme also commenting here.

  6. dvd

    Yoou actually make it appear so easy with your presentation however I find this topic
    to be actually one thing wyich I believe I would never understand.
    It sort of feels tooo complex aand very vast for me.
    I am having a look forward on your next submit, I will
    attempt to get the hang of it!

  7. faster and better protected

    Hi there! Quick question that’s completely off topic. Do you know
    how to make your site mobile friendly? My weblog looks
    weird when browsing from my iphone. I’m trying to find
    a theme or plugin that might be able to fix this issue.
    If you have any suggestions, please share.
    With thanks!


Reply to ชุดเดรส