Internet Datalogging With Arduino and XBee WiFi

This Tutorial is Retired!

This tutorial covers concepts or technologies that are no longer current. It's still here for you to read and enjoy, but may not be as useful as our newest tutorials.

Pages
Contributors: jimblom
Favorited Favorite 20

Resources and Going Further

Mmmm data. But once you've logged your data to the Internet, what's next? Here are some ideas.

Using the Data

Once you have the data stream running, you have a few tools to view and manipulate the data. You can download it as either a CSV or JSON, by clicking the links at the top of the page. Then you can import those files into a spreadsheet or one of many online plotting services. We're big fans of Plot.ly, which you can use to generate beautiful graphs, like this:

plot example

Plots of my office logger running for a day. Intruder alert at 1:30AM!

Add Your Own Sensors!

Unfortunately, the least flexible part of the example code is the most wide-open, fun part: customizing it with your own sensors.

To update sensor readings, we defined a function -- readSensors() -- which reads our sensors and updates a global variable to store each value. Feel free to plug your own machinations into that function, customize the variables, or even add more!

If you're adding or removing sensors, don't forget to modify the Phant fields, and add or remove Phant.add() function calls to get your data into the HTTP POST.

For example, I wanted to increase the reliability of my logger's data, so I replaced the analog light and temperature sensors with digital options -- the TSL2561 luminosity sensor and an HTU21D Humidity/Temperature sensor.

Advanced setup with digital temp and light sensors

That meant adding a pair of Arduino libraries to read from those sensors, and modifying the code a bit. If you want to check out my advanced example, click here to download the sketch. You can see how I modified the code to add a fifth data field (humidity), and incorporated more complex sensor data gathering for the digital sensors.


There are a plethora of sensors out there, what are you going to log? Weather is always a popular option; perhaps you can turn out a version of our wireless weather station data logger, which uses an Electric Imp instead of Arduino/XBee.

Or how about making the project wearable with a LilyPad XBee? That's where I'm headed next.

This tutorial is only the start, we can't wait to see what you do with data.sparkfun.com!