I was looking for many various ways of storing Arduino data in a server and presenting in client. There are many ways of doing this and one interesting way is Temboo + Google BigQuery.  It’s much easier to implement since what you have to do is just follow the steps and it will generate everything including the code for you. For some weird reason this never worked for me and I found that troubleshooting is hell of a thing because you are too much relying on generated code.

Later I found this miracle post in devacron.com  mentioning much more easier way with 100% hand written and easy to understand code.

FireBase offers very powerful back-end for apps and offers a cloud based data storage platform which is ideal solution for playground for Arduino. Most fascinating fact with Firebase is that these guys offers 1GB storage, 100 parallel connections and 10GB transfer for there free forever plan which is more than enough to power up even your most complex ‘connected’ home with Arduino.

Only problem with Firebase is that they accept only HTTPS connections which is too much for my UNO to bare. But the article in devacron uses a nice hack by having a PHP middleman to retrieve data from Arduino and send that to Firebase. Even though they didn’t mention any credit in their post, I later found that the hack was done here.

sketch
Simple illustration of the setup (Arduino + PHP + Firebase + canvasJS)

I’ll start the setup from the Firebase side.

First, create a login in Firebase and create a new app.Now go to the app URL and Press the Secrets tab on left bottom. Note down the app URL (Eg: https://myawesomearduino.firebaseio.com) and the secret, we will need it for the next step.

Next,  setup hosting for your site. I used free  000webhost.com and so far it served for my purpose. Anyway choosing the hosting is up to you and make sure the host you choose allows uploading php scripts.

After setting up the hosting, upload following firebaseLib.php and firebaseTest.php

firebaseLib.php

firebaseTest.php

In order to test the setup, manually invoke the data feed (Eg: http://myawesomearduio.netau.net/measure_temparature/firebaseTest.php?arduino_data=32.6) and verify the data saved in Firebase.

Next step is to setup Arduino to sense room temperature. I’ve used ds18b20 temperature sensor. This nice article on hacktronics provide all you know to setup  ds18b20 sensor.

I have used CC3000 WiFi shield in this example and please read my post on how to connect CC3000 to Arduino Uno.

Given below is the sketch I’ve designed using many other examples.

send_temperature_to_php.ino


6ecdeeb06135a2b7a83db317c7b1c11d155141d9cb57b1c5945c3ee3b85dbc72
Setup: Arduino + CC3000 WiFi shield, DS18B20 sensor + Bread board

Upload the sketch to your Arduino and it will start sending temperature readings to the Firebase!

As the last part, I’ve used CanvasJS plot to visualize the data in runtime.

index.html

Have a look at my example!
 http://dsignhome.netau.net/measure_temparature/
site
Temperature readings for one day. It’s unbelievably HOT!!!!!

Special thanks to everyone who shared their experience which made my attempt a success.

Thanks for reading and please share your thoughts. I’d love to know if there’s better way of doing this