Save data of temperature and humidity on MySQL with Arduino Uno and Wifly

Picture of Save data of temperature and humidity on MySQL with Arduino Uno and Wifly
Hello guys, i make this instructable for the people that  liked the electronics and the botanic, with this you have the data about  the temperatura and the humidity of your orchard and register this in a data base MySQL.

For this proyect you need some knowledge of programing in PHP and MySQL, we will make three archive .php, but this I'll explain in the following steps.
Remove these adsRemove these ads by Signing Up

Step 1: You need this

Picture of You need this
For this project, you need:

Arduino UNO or similar board  ($29.95)

WiFly Shield ($89.95)

Grove - Moisture sensor ($4.99)

Six Jumper Wires ($4.50)

DS18B20 Temperature Sensor with metal tip ($10.59)

If only  need, One protoboar ($9.58)


you need a server WEB, with PHP and database MySQL. I used the NAS of QNAP TS-110, is perfect for this project.

Step 3: Connecting all in Arduino

Picture of Connecting all in Arduino
Now, we will connect the two sensors on the Arduino shield Wifly:

-For the temperature sensor, the pin order is: GND-VCC in 5v power - SIG in digital pin 3.

-For the Moisture sensor, the pin order is: GND - 3.3V VCC in power - SIG in the analog pin 0.

Step 4: Preparing the database Mysql

In the query of NySQL you need put this code:

CREATE TABLE `your_database`.`tempmoi` (
`temp1` VARCHAR( 255 ) NOT NULL ,
`moi1` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `id` )
darrigan17 days ago

Hi! Why did you write


and not



Thank you.

bkools1 year ago
(removed by author or community request)

How did u solve the problem?

Turbovix1 year ago
Dear, to perform the build I get the following message:

In file included from C:\Arduino\arduino-1.0.1\libraries\WiFly/WiFly.h:4,
from wifly_twosensors.cpp:13:
C:\Arduino\arduino-1.0.1\libraries\WiFly/SpiUart.h:62: error: conflicting return type specified for 'virtual void SpiUartDevice::write(byte)'
C:\Arduino\arduino-1.0.1\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
In file included from C:\Arduino\arduino-1.0.1\libraries\WiFly/WiFly.h:8,
from wifly_twosensors.cpp:13:
C:\Arduino\arduino-1.0.1\libraries\WiFly/Client.h:21: error: conflicting return type specified for 'virtual void Client::write(byte)'
C:\Arduino\arduino-1.0.1\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
C:\Arduino\arduino-1.0.1\libraries\WiFly/Client.h:23: error: conflicting return type specified for 'virtual void Client::write(const uint8_t*, size_t)'
C:\Arduino\arduino-1.0.1\hardware\arduino\cores\arduino/Print.h:50: error: overriding 'virtual size_t Print::write(const uint8_t*, size_t)'

Hi, do u solve the problem? i also facing it ><

MAG082 months ago

Great work. I tried it on xampp and it works. Thanks for your help :)

why did you put: client.print( "GET /agregar.php?"); it is just that I haven't seen any agregar.php file on the example. It is equal to add.php?


Splight1 year ago
Well i found this page looking tutorial on how to MYSQL + PHP, and i found this project!! It looks amazing! Congrats!
Knowing what you know now, would you again purchase the Grove Moisture Sensor or would you build your own?
camilo.n1012 (author)  Jason Bedard1 year ago
I buy the Grove Moisture Sensor in, in Chile. i recommend buy this sensor, because is designed for use in gardens.

This is the link :
where is this file you called by GET
client.print( "GET /agregar.php?");
none of those file has this name,

and where did you located php files?

thank you
Good to know. Thanks.
Awesome. I am wondering what kinds of modifications would be needed to save to an sd card instead of the wifi. The wifly is out of my price range for right now but I have all of the other parts. Thank you.
zmashiah1 year ago
Very nice.
See this: for similar thing, only I am saving to flat file on the PC and communicating to PC over XBee rather than Wifi.
nevenne1 year ago
where l can find a sensors
camilo.n1012 (author)  nevenne1 year ago
Hi, you can find the sensors in, they have shiping world. This are the links:


Helder4u1 year ago
I was just looking for an example of how to start a MySQL Database and Connect to a website ^^

Will study Your application :D
msatorius1 year ago
How long does this project run on a single 9v?
camilo.n1012 (author)  msatorius1 year ago
Hi, the project will last a one day and half (i tested with my duracell 9v), but I recommend using a battery of the modem of the ethernet, which has allrrededor of 8 to 11.4 V, you will last much because have it a higher amperage. Good luck

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!