Instructables

Plotly + Arduino Data Visualization

Featured
Picture of Plotly + Arduino Data Visualization
Plot.ly + Arduino Data Visualization

I've been a fan of Arduino for years now, and have used it for building everything from MIDI controllers to simple LED flashers. One thing that has always intrigued me has been visualizing some of the data that I read off of the Arduino Pins.

Plot.ly makes this simple. Really simple.

The purpose of this instructable is to demonstrate how to hook up an Arduino + Ethernet Shield and send data to Plot.ly's Servers and create beautiful graphs. We will be using a dual temperature+humidity sensor (DHT22), and sending the results directly to Plotly.
 
Remove these adsRemove these ads by Signing Up

Step 1: What you will need:

Picture of What you will need:
6.jpg
5.jpg
7.jpg
Hardware:

Software:
(We will explain how to install the libraries in a later step)

Enclosure:
  • Two pieces of (2 1/2" x 3 1/2" ) wood (1/4" thick)
  • Four (10-32x2in) Machine Screws
  • 12 Hex Nuts (10-32 Diameter)


Step 2: Hardware Setup

Picture of Hardware Setup
8.jpg
Step 1:
Connect your Arduino to your Ethernet shield

Step 2:
Connect the DHT sensor:
  • DHTpin1 -> 5v
  • DHTpin2 -> digitalpin2
  • DHTpin3 -> not used
  • DHTpin4 -> gnd



Step 3: Uploading the sketch to your Arduino

Picture of Uploading the sketch to your Arduino
arduino2.png

Step 1:

  1. Download the Arduino IDE if you haven't already (We're using 1.0.5, but if you're using a WIFI shield, you'll have to use 1.0.3)
  2. Install Arduino onto your system


Step 2:
Download Libraries: (If you haven't already done so!)


You'll want to drop the library folders into your Arduino application folder. Ours is in: '/user/Documents/Arduino/libraries'. You can always check your Arduino preferences to find out where yours is if you cannot find it.

Once you find your Arduino folder, it should look like this:

  • Arduino/
    • hardware/
    • libraries/
      • plotly_ethernet/
        • plotly_ethernet.cpp
        • plotly_ethernet.h
      • DHT/
        • DHT.cpp
        • DHT.h


Once you've put the libraries in the correct place, restart the Arduino IDE.

Step 3:

  1. Download the Arduino/Plotly sketch for Temperature and Humidity visualization
  2. Open the sketch and change "username" and "api_key" to your plotly credentials.
  3. Make sure to change the "Stream Tokens" as well!
  4. Upload the sketch to your Arduino!

Step 4: Building the Enclosures

Picture of Building the Enclosures
1.jpg

We were inspired by this Instructable, and wanted to create something similar for this project. Simplicity would be key, as we wanted to have an aesthetically pleasing, yet still minimal and low-cost, finished product.

This design is so simple and wonderful, we'll leave it up to you! Its just drilling 8 holes, and assembling!

Remember to be accurate with your holes, as they have to match up. Measure twice, drill once! :D



Step 5: Wrapping it all up!

Picture of Wrapping it all up!
001 blank.jpg

By now, you should be all set up and ready to go! You should have:

  • an Arduino that is programmed (not plugged into your router yet!)
  • an Arduino that is nicely bundled up into some kind of enclosure


Final Steps

  1. Plug in your Arduino to your router with the Ethernet cable
  2. Plug in your Arduino to power with the 9V Wall adapter
  3. After a few minutes, check your filewell on Plotly, and you will see your data stream in!


Happy Plotting!

Click here to check out an example using data taken from our living room in Montréal!

zuljin25 days ago

Could somebody upload the sketch modification for ENC28j60 please? I can't find it anywhere :S

Shirk273 months ago

Been having a problem with the programming side of this, getting an error that seems to be from the IDE not including the libraries correctly.

plotlyethernettemphumid:13: error: no matching function for call to 'plotly::plotly()'

Shirk27 Shirk273 months ago

Here is the console

Arduino.JPG
Nook1 Shirk273 months ago

I'm having the same problem.

As mentioned in the site the libraries should be placed like:


  • Arduino/

    • hardware/
    • libraries/

      • plotly_ethernet/

        • plotly_ethernet.cpp
        • plotly_ethernet.h
      • DHT/

        • DHT.cpp
        • DHT.h

But after downloading the libraries , I'm getting:
plotly_streaming_ethernet.cpp
plotly_streaming_ethernet.h
I think that's the problem.

focamonca Nook13 months ago

did u solved?

plotlygraphs (author)  focamonca3 months ago

Hi all! So sorry for the broken pieces. We updated the Arduino library (https://https://github.com/plotly/arduino-api) but forgot to update the instructable examples. I just updated the example code with the new library, so give a try now!

focamonca Nook13 months ago

WOW plotly great support to who has problems!

Nook1 focamonca3 months ago

Yeah, this problem was solved by me. All you have to do is update the libraries with the files plotly_ethernet.cpp and plotly_ethernet.h you will get them here:

https://gist.github.com/dwblair/9235676
https://gist.github.com/dwblair/9235706

The link given at this site are updated libraries as they are for streaming purposes so when you download you will get "plotly_streaming_ethernet.cpp" and "plotly_streaming_ethernet.h" but in given code we have used "plotly_ethernet.cpp and plotly_ethernet.h", so use the libraries from gist.github.

If you want to use the updated libraries and use streaming tokens and get the graph, use this sample sketch:

https://github.com/plotly/arduino-api/tree/master/...

use these libraries for the sketch:
https://github.com/plotly/arduino-api/tree/master/...


(before all this make sure that your network has DHCP enabled, otherwise plotly's servers won't be to communicate with the shield).

plotlygraphs (author)  Shirk273 months ago

Thanks for reporting! We updated the Arduino library (https://github.com/plotly/arduino-api) so that the graphs update in real-time (here is an example: plot.ly/~streaming-demos/6/) but forgot to point this instructable to the new code. I just updated the example code, so give it another try now! So sorry for the inconvienence.

focamonca3 months ago

PLEASE HELP US

Cattura.PNG
plotlygraphs (author)  focamonca3 months ago

hey dude! Check out the post up above, and e-mail me at alexandre@plot.ly if you're having problems with the new library. I'll update this 'ible ASAP.

Thank you for your patience

plotlygraphs (author) 3 months ago

Hey guys!

Sorry about the issues you've been having. We recently updated our Libraries to include streaming!

I'll make sure to fix this 'ible ASAP, but for now if you want to check out:

http://plot.ly/workshop/arduino-dht22/
There is a new script and library there, you can read all about it!

Let me know if you have any issues, feel free to email me:
alexandre@plot.ly

Cheers!

focamonca3 months ago

PLEASE plotly help us with problems

drmpf3 months ago

If you want to do something similar but plot and save the data on your Android phone via bluetooth or wifi check out

"Simple Remote Data Plotting using Android / Arduino / pfodApp" http://www.instructables.com/id/Simple-Remote-Data...

and "Arduino for Beginners, now with data plotting, controlled by Android" http://www.instructables.com/id/Arduino-for-Beginn...

TSJWang6 months ago

Hey nice project!

What about using Processing to sketch out data sent to the serial port? Would that decrease the delay?

Armandur TSJWang6 months ago

http://pulsesensor.com/ does this with very little delay, imperceptible from realtime plotting.

plotlygraphs (author)  Armandur4 months ago

Woah, that's awesome! We just made a "real-time" version of our plotting available, and plotted data with that hear-rate sensor. Here is the video: https://vine.co/v/Mq2LQexrbl7

TSJWang TSJWang6 months ago

I guess it is a LOT cooler to have data online.

It depends on the purpose: quick testing that does not need to be recorded [processing]

data collection to be shared and displayed [plotlygraphs]

long term data collection, portable [analogRead values stored in SD card, then excel]

plotlygraphs (author)  TSJWang6 months ago

Hey! Thanks for checking out our Instructable. Our goal for the Plotly project is to let you send data right into the browser. Then, you can edit, share, and analyze your data and graph all in one place. So, here is our humidity and temperature graph you could share and edit with others: http://plot.ly/~demos/999/.

Arduino.png
kerimil4 months ago

can't get the library to work... I follow the instructions and I can't even install it properly

amcdawes6 months ago
Great example for plot.ly. One tip for making cases like this is to hold the top and bottom together when you drill... that way you only drill four holes and they automatically align.
plotlygraphs (author)  amcdawes6 months ago

Great tip. Thanks!

eagleapex6 months ago

That's a quality enclosure. Kudos

plotlygraphs (author)  eagleapex6 months ago

thank you! super easy to make + low cost too!

procastino6 months ago

I've just put it to work, nice and clean! thanks for the instructable! :)

ICStation6 months ago

Nice project. It brought us a lot of inspirations in design products/projects.