Plotly + Arduino Data Visualization
by plotlygraphs in Circuits > Arduino
116671 Views, 676 Favorites, 0 Comments
Plotly + 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.
What You Will Need:
- Arduino (We're using the UNOr3)
- Ethernet Shield
- DHT22 Temperature + Humidity Sensor
- Hookup wires
- Angled pin headers (unless you use female-male hookup wires, then you won't need these)
- 9v Wall Adapter
- Ethernet Cable
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)
Hardware Setup
Connect your Arduino to your Ethernet shield
Step 2:
Connect the DHT sensor:
- DHTpin1 -> 5v
- DHTpin2 -> digitalpin2
- DHTpin3 -> not used
- DHTpin4 -> gnd
Uploading the Sketch to Your Arduino
Step 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)
- 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
- plotly_ethernet/
Once you've put the libraries in the correct place, restart the Arduino IDE.
Step 3:
- Download the Arduino/Plotly sketch for Temperature and Humidity visualization
- Open the sketch and change "username" and "api_key" to your plotly credentials.
- Make sure to change the "Stream Tokens" as well!
- Upload the sketch to your Arduino!
Downloads
Building the Enclosures
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
Wrapping It All Up!
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
- Plug in your Arduino to your router with the Ethernet cable
- Plug in your Arduino to power with the 9V Wall adapter
- 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!