Arduino, Temp, Humidity, WiFi, MySQL and Highcharts





Introduction: Arduino, Temp, Humidity, WiFi, MySQL and Highcharts

This is my first Instructable and while it works as is, it is a prototype/proof of concept only.

This solution is one of a number that are required to monitor an indoor pool installation to allow an engineer to offer suggestions as to how we can save on our energy usage. The overall project is being undertaken by a Year 11 Design and Technology class.

Please note the solution is a remix of other builds and ideas.

Specifically, Tim Kang ( and Marco Schwartz (

If you just want to fiddle with the database and highcharts, go straight to Step 3.

If you just want to build the sensor, Steps 1 and 2


What I used:

1 Arduino UNO

(1 CC3000 WiFi breakout ( and 1 Arduino prototype board


1 CC3000 WiFi shield with ufl connector for ext antenna (

1 antenna - I used

1 adapter - I used

1 SHT15 Temp, Humidity sensor - I used

1 case - I used

rainbow cable, solder and iron, hotglue gun, stacker and break away pins

Wireless compatible computer

Arduino software

MAMP software (WAMP or LAMP depending on your OS of choice)

a text editor - TextWrangler is an excellent choice for the mac

Browser of your choice.

Step 1: Building the Sensor

Mount the Arduino UNO in the case.

Solder the CC3000 WiFi breakout onto the prototype board (note that I had to shorten the break away pins as the whole unit needs to be able to fit into the case)

Mount the sensor into or onto the case (I used hot glue and have mounted the sensor so that it is less likely to become too wet in the indoor pool environment - time will tell if this is the best orientation but it will be easy to remount if required. The SHT15 has a heater element so I guess if the humidity readings are affected by condensation, I should be able to dry the sensor out.)

Mount the antenna (I used an internal tooth lock washer on the underside of the antenna mount to stop the user from turning the fitting when screwing the antenna onto the mount - this is not in the photo)

If you used the adafruit case, break off the covers, clean them up with a utility knife and pop them into position - I hot glued them for greater security.

Step 2: Download the Sketch

download the sketch:

Open in the Arduino IDE, fill in your own information for the wifi and web server.

Upload the sketch to your arduino, open the serial browser, set it to 115200 baud and watch your solution generate the temp and humidity.

Step 3: Download and Install MAMP

download and install MAMP:

WARNING - MAMP 3, non PRO version, ships with the ability to switch between PHP 5.1.6 and 5.5.10 only.

Neither of these work with highcharts. I selected 5.1.6 via the preferences pane then renamed the 5.3.28 folder to 5.1.6 - this is a kludge and I need to find a better solution.

Locate the htdocs folder in Applications, MAMP.

download and copy the sht15_cc3000_mysql folder into the htdocs folder.

Step 4: Create Your MySQL Database

Open a terminal window and copy this text at the prompt:

/Applications/MAMP/Library/bin/mysql -uroot -p <

Now, drag the energy_project.sql file (see the photo above) located in the sht15_cc3000_mysql folder in htdocs over the terminal window - this will paste the path (location) of the energy_project.sql file into the terminal window after the <

Now press return and type root at the password prompt.

Press return and you have created your database.

Step 5: Create the Energy_user for Your Database

In a terminal window, copy this text at the prompt:

/Applications/MAMP/Library/bin/mysql energy_project -uroot -p

Now press return and type root at the password prompt.

copy this text at the prompt and replace the your_password with a password of your choice:

GRANT all ON energy_project.* TO energy_user@localhost IDENTIFIED BY 'your_password';

Press return and you have created a database user called energy_user

type exit at the prompt.

Step 6: Edit the Sensor.php File

edit the sensor.php file in the sht15_cc3000_mysql folder in htdocs.

This is the file that is called by your wifi sensor and it places the temp and humidity data into the database.

You have to set the following line so that the password you have specified for the energy_user is the same:

$result = mysql_connect("localhost", "energy_user", "your_password");

Step 7: Edit the Data.php File

edit the data.php file in the sht15_cc3000_mysql folder in htdocs.

This is the file organises the data in the database into a format that highcharts can understand.

You have to set the following line so that the password you have specified for the energy_user is the same:

$con = mysql_connect("localhost","energy_user", "your_password");

Step 8: Check Out Your Handywork!

If you have created the database correctly and adjusted your_password, you should now be able to test data.php

Make sure that MAMP has been launched

In the browser of your choice on the machine running MAMP, paste in the following URL:


You should see my test data.

Now point your browser to:

Point your browser to the following URL:


Please remember this is a work in progress - it was strung together to allow my year 11 class to meet their next milestone.



    • Epilog Challenge 9

      Epilog Challenge 9
    • Paper Contest 2018

      Paper Contest 2018
    • Science of Cooking

      Science of Cooking

    We have a be nice policy.
    Please be positive and constructive.




    I got following message in arduino serial interface

    mysql_native_password ˇñ 08s01got packets out of order

    what's the reason for this? can u help me anyone?

    for the operating system Windows 7 using XAMPP whether there are distinguished in its programming? please help ..

    Disable your firewall

    I haven't tried my setup on windows using xampp but am sure that each step should be very similar.

    ok, thanks...

    before I use Wido-Open Source Node Arduino Compatible IOT, in the existing microcontroller CC3000 WiFi shield and I've tried to fit your program code but still can not.
    I think the same as you patently above but the program code does not match ..

    Thanx Bro it's helped me

    Hey Tim. Thank you very much for providing this tutorial. I'm using something like this for my thesis project. I have one issue though when I compile the code for the Arduino, no header file directory. Would you know anything further on the matter?

    Arduino: 1.5.8 (Mac OS X), Board: "Arduino Uno"

    SHT15_CC3000_MySQL.ino:14:19: fatal error: SHT1x.h: No such file or directory
    compilation terminated.
    Error compiling.

    Thanks ,it worked with me for 5 minutes on windows OS :)