domenica 24 marzo 2013

How to remotely measure a temperature using Arduino and WiFi

First you need an Arduino Mega 2560 board and a Weburban WiFi board (this board uses standard connectors over SPI to an Arduino compatible Microchip 802.11b/g/n MRF24WB0MA).
Connect them as showed in
In this example I use ArduinoIDE version 1.0.3.
Follow the instructions about the setting of the WiShield library (you can load it from This library is modified to properly work with Arduino Mega 2560 board AND ArduinoIDE version 1.0.3.

Now you need a DS18S20 digital thermometer ( and a 4.7 kΩ resistor. Now connect them to the Arduino board as shown in the picture:

Now you need to download two applications and a library from
1) test_wifi_temperature, a simple sketch for measure temperature remotely
2) test_arduino_temp_wifi, a simple php application to use with test_wifi_temperature sketch
3) OneWire, more informations at

Place the OneWire folder into your Arduino Library. Here are the default library folder locations:
On  Mac:: In (home directory)/Documents/Arduino/libraries
On  Windows:: My Documents -> Arduino -> libraries
On  Linux:: (home directory)/sketchbook/libraries

Put the folder test_arduino_temp_wifi in the documents folder of your  Apache server (for example, in my Fedora Linux it is /var/www/html/). Put the test_wifi_temperature folder in the sketchbook of your Arduino IDE.

In the test_wifi_temperature.ino file modify the wireless parameters (ip address, subnet mask, gateway, SSID, security type,  WPA/WPA2 passphrase or WEP keys) according to your wireless network parameters.

Compile the sketch and load to the Arduino.

Now go in the folder test_arduino_temp_wifi and, in the test.php and test_controller.php files, modify the ip address (in the example it is according to the ip address in the test_wifi_temperature.ino.

Open a browser and go to the URL http://localhost/test_arduino_temp_wifi/test.php.

You'll see a webpage with a form and one button. The button is to send a request to Arduino which will reply with a xml file containing the temperature value. The php page will display this value. You can see a screenshot below: