This instructable will show you how to make a 3D Map of Twitter data for the state of Colorado, but you'll be able to recreate it for any area that you wish.
This map is made out of multiple laser-cut layers of basswood and uses LEDs and an Arduino board to display what kind of Twitter activity is coming out of various cities in Colorado. We can display if Tweets from a given city are happy, sad, depressed or angry. We even have a Bieber mode!
We made this for the Things That Think class Spring 2011 at CU Boulder. We're Paul Heider , Buck Heroux and Ian Smith .
Step 1: Stuff You Need
1 USB Cable
5 2x1 ft sheets of basswood (may need more, depending on the area you want to make)
Twitter Dev Account
Adobe Illustrator - or any other vector editing suite, although the steps for this instructable are written for Illustrator
Adobe Photoshop - same deal as with Illustrator
Topographical image of a state/region - I found mine with by searching 'Colorado Topographical Map' in Google Images
10 RGB common-cathode LEDs
10 4 pin connectors - to plug in your LEDS
Step 2: Getting the Map Ready for Cutting
So the goal of this step is to produce a vector file that you'll give to the laser cutter in order to cut out the layers of your Topographical map.
You want to start with a high-resolution image that also has topographical information in it.
I chose my starting image (the first image for this step) because:
It has 9 layers, which is a good number of layers to have for this project.
It has distinct colors for every elevation, which makes it easy to turn the image into a vector file.
It's a map of Colorado. I live in Colorado. Colorado is an awesome place to live.
I found my topographical image by searching 'colorado topographical map' on Google Images and then I chose what I thought was the best result. Here is a zipped directory of all the image/vector files from this step . I wish I knew a better way to find topo maps for this project, but Google Images turned out to be the best way I have found so far.
1. Open up your map file in Photoshop
2. Crop your image to the area that you want to make your topographical map out of.
3. Erase/clean up any stray marks or lines on your image.
4. Using the magic wand tool (with 'contiguous' turned off), select one color elevation from the map
5. Cut and paste the selection onto its own layer.
6. Repeat steps 4 and 5 until each elevation has its own layer.
7. Fill in all holes in each layer so that every layer is made from solid shapes.
8. Save the map as a psd and then open it in Illustrator.
9. Select a layer, and convert it to a vector with Object > Live Trace > Tracing Options...
10. In the menu that pops up, set mode to 'Color' and also check 'Ignore White', then hit Trace.
11. Select the resulting object and finish it off with Object > Live Paint > Make
12. Repeat 9 through 11 for every layer.
13. Duplicate every layer.
14. Select the contents of half of the layers (so that you have a copy of each layer with no duplicates selected)
15. Change the fill color of the layers to blank, and the outline color to RGB red (which can be found in the RBG color swatch set)
16. Repeat steps 14 and 15 for the remaining layers, except change their outline color to RGB cyan. The red layers you have will be where the laser cutter will cut out your next layer, and the cyan layers tell the laser cutter where to etch out the outline of your next layer.
17. Make a layer with ~8mm diameter circles placed where you want your cities to be.
18. Now you should have a map that looks a lot like the one in the last picture for this step!
Step 3: Cutting Out and Constructing the Map
2. Select the bottom red layer of the map and cut it out using the recommended settings for your laser cutter. Don't remove this layer until after the next step.
3. Select the teal layer on top of your bottom layer and etch it out on the bottom layer. This outline will help you align your next layer.
4. Select the layer with the holes for your cities and cut it out. The first image for this step shows what your first layer should look like at this point.
5. Remove the layer from the laser cutter and punch out the cut out pieces if necessary.
6. Repeat steps 2 through 5 for each layer, gluing each successive layer to the layer below it. Make sure to use clamps to hold the layers together until the glue between them dries.
7. Label the holes for the cities on the back of the map using a pencil so that when you're wiring up your LEDs, you know which hole belongs to which city.
Step 4: Arduino Code
2. In the declaration section, set up global constant variables such as start and end bits for recieved signals and color declarations.
3. In the initialization section do following: set up contact by sending a start signal over the serial lines and set all the GPIO pins to be used to be in Digital Out mode so that they can drive the LEDS.
4. In the loop create two states: waiting for input and writing to the LEDS.
5. On the wait step, use delay(100) to make the Arduino board pause for 100 miliseconds
6. In the write phase, make the Arduino do the following:
a) Get the start flag, end flag, city(integer corresponding to a base pin) and color from the serial line and assert that the flags are correctly set.
b) Write a color to a specific city by first turning that city off and then using the color to turn on a combination of pins which correlate to an RGB color scheme from the base pin.
Our code for this step can be found at https://github.com/ianisborn/TTT/tree/master/sandbox
Step 5: Twitter Code
2. Get set up to pull data from twitter. We used the Python Twitter Library to simplify the Twitter connection process. In order to connect to Twitter and obtain data you need to register a Twitter application at http://dev.twitter.com/. This will give you ‘consumer’ and ‘access’ ‘keys’ and ‘tokens’ you need to successfully connect.
3. The next step is to collect the latitudes and longitudes of the cities that you want to collect data for. In our case we collected the locations for 10 Colorado metropolitan areas.
4. Decide what kind of information you want to display. In our case we decided that we would display the relative happiness for each location. To accomplish this we compiled a list of ‘happy’ an ‘unhappy’ words. We then perform two Twitter searches, using the api, for each location every 60 seconds. One for the happy and one for the unhappy words.
5. Its up to you to determine how this information will correlate to different colors for the LEDs on the map. In our case, there were a lot more happy results than unhappy results. So only a few unhappy results were required to make a location ‘unhappy.
All of our code for this project can be found at: https://github.com/ianisborn/TTT/tree/master/sandbox
Step 6: Wiring the LEDs to the Arduino Board
2. Wire the LEDs to ground. The Arduino drives too much current (~40 mA) for an LED to handle, so making a simple ground circuit is nice. This is done by wiring a ~200 Ohm resistor to a ground pin on the Arduino. One the other lead of the resistor solder 10 wires of decent length for the grounds to each city.
3. Wire the LEDs to the Arduino board. This is where things get hairy. I found it useful to keep a list of the cities and their corresponding pins close by. I went down the GPIO pins wiring a red wire, then a green wire, then a blue wire sequentially. Once an RGB sequence is finished it is handy to use masking tape to keep that set of wires together and label its corresponding city. Once that was down for each city (30 pins in total), solder each set of RGB wires to a 4 pin connector and solder on a ground wire to complete the connector. Keep the connectors wired in the same scheme as the RGB LEDs. The ones we used went Red Ground Blue Green. Tape the connector near the corresponding city and label the tape for use in the next step.
4. Hook up the LEDs. Feed the leads of the LEDs through the holes on the map. The bulb should sit on the top layer of the map. Plug the LEDs into the 4 pin connectors making sure that the leads of the LED match what you wired for the connector.
5. Test that steez. It’s useful to test a few at a time so that you can pin point problems. The key is being organized and keeping your wits about you. Eventually you should have them all tested and you have just made yourself the awesomest tangible big data visualization in town!