This project sought to explore the intersection of technology and art. Art and technology are typically thought to be incompatible, largely because art largely depends on creativity and it is thought that machines, technology and science cannot be creative. On the other hand, art is limited by the creational power of humans. Any given human can only do so many strokes of a brush, so many minuscule details, so many iterations of a pattern, whereas technology can go beyond these limits. It can thus prove interesting to explore how to balance the creativity of the human mind with the creational power of technology to create amazing pieces of art.
This project consists of the construction of a multi-parameter sensor that logs information from the environment the user is exposed to throughout the day. Information on temperature, sound, light and movement is logged and is then used to create an image. The image created is meant to be representative of the data logged. That is to say, the image is supposed to be an image of your day. There exists a growing demand for information in our society, especially information regarding our own behavior. This the reason why there are more and more products that track more and more things, heartbeat, steps taken, miles run, hours slept etc. This project is the first building block of a larger project that seeks to take advantage of all of that information that is currently being collected to create images. Humans understand everything better through visual displays, yet there really is no graph that can properly display the correlation between the miles you ran, your heartbeat and the humidity of the air in a way that adequately conveys how all those things impacted your day. Instead, an art piece can be much more powerful in conveying the subtleties of how the varying factors of the environment you were exposed to impacted your day. This project seeks to explore this option by creating a visualization of the data collected with the Daytracker that is not a conventional graph.
- Arduino Uno or similar
- Adafruit Assembled Data Logging Shield for Arduino (can be found here)
- SparkFun Spectrum Shield (can be found here)
- Stacking Headers
- TMP35 Temperature Sensor
- MMA8451 3-Axis Accelerometer
- MAX4466 Microphone
- 5MΩ resistor or equivalent others (ie. 2 10MΩ resistors in parallel)
- 1GB (at least) SD card
- 9V battery and adapter for Arduino
- Wires and soldering equipment
(credit to Adafruit and Sparkfun for part images)
Step 1: Assemble the Shields
Putting together the shields is very straightforward. Both shields come fully set up and tested with the exception of headers. The data-logging shield comes with a battery for the built in RTC that you will want to install by simply sliding it into place. Then it is just a matter of soldering the stackable headers into one shield and the standard headers into the other, and the shields are fully set up. You will then want to download and install the necessary libraries. The two libraries that you will need for the data-logging shield can be found in the Adafruit tutorial here (this tutorial is also useful if you have trouble setting up the shield or want to test it independently). The spectrum shield does not require any additional libraries, so you should be all set.
Step 2: Building the Circuit
The next step is to build and solder the circuit. The circuit is not especially complicated or extensive; it should be easily possible to fit all of the components in the prototyping areas of the boards. We recommend placing the microphone on the spectrum shield for ease of access, and it is important that the light and temperature sensors end up on the upper board (so that they are able to effectively sense the environment). Otherwise, however, layout choices are up to you.
The photodiode portion of the circuit is a fairly standard circuit for measuring light levels. A simple analog read on pin A2 will serve to find the light level out of 1024. If you find that your values are consistently high or low, experiment with different values for the resistor. We chose our resistor such that in a moderately lit room we read values of around 400.
The temperature sensor outputs a voltage that scales linearly with the temperature in celsius (with a shift so that it can be effective below 0°C). The other main circuit elements are similarly simple in how their circuitry works; most of the work is done in the sketch necessary to read the data. For the microphone, soldering the output directly to the R pin on the spectrum shield eliminates the need to use the input jack on the side (and the use of additional adapters).
It is of course possible to change the pins used by the various sensors with some restrictions. The accelerometer uses the I2C protocol, so it must either remain on the A4/A5 pins or the SDA/SCL pins. It is also important to note that the spectrum shield uses the A0 and A1 pins, so it is inadvisable to use those for any of the sensors.
Step 3: Installing the Sketch
The final step necessary to finish the tracker is to install the sketch to the Arduino. Ensure that you have the necessary libraries for the various shields installed (see step 1 for links). You will also have to install a library for the accelerometer from the Adafruit tutorial here. You can easily start with the sketch below (the code that we used) but the sketch is heavily modifiable. It is very easy to adjust which data are logged, the interval between data points, etc. depending on your needs. The comments in the sketch should make it very clear what needs to be removed from the sketch in order to ignore specific parameters. Alternately, if you are interested in adding another sensor, you can log the data from it by simply adding a title for it in line 112 and adding a logfile update of the form "logfile.print();" between the quantities that you wish your new sensor data to appear.
You should now be able to power the Arduino with the 9V battery, pop in the SD card, and use the device. Viewing the data should then be a simple matter of connecting the SD card to a computer and using a program like Excel to view the data as a CSV file. Once you are able to log data in this way, you are ready to work with the visualizer!
Step 4: Reading Your Data Into Your Software
Once you've set up code in your arduino to produce a CSV file with your information you're going to want to use that information in another type of computer software to develop your images. The way you'll do this will vary slightly depending on what software you decide to use and what language you decide to code in. The example provided to help you develop your CSVReader code is written in Java and executed on Eclipse.
You're going to want to translate your CSV readings into a two dimensional Array or ArrayList. In order to do so you're first going to set up code to import the file itself. To this create a method like that of getFile() presented in the image.
Once that's done you're going to want to pass line by line of data into your software by using the File.readLine method and creating a String variable that holds that information. The comments on the code should be enough to explain how the information is read onto the array however pay special attention to the String.split() method called within the while loop. This method works because a CSV file is composed of comma separated values! trying to separate the values any other way would be immensely difficult.
Finally make sure that the end of your cade return the double Array that now contains all of your data from the csv file for you to use.
Step 5: Code Away!
Now the rest of what you have to do is very much up to your creative process!
You can take a look at the available code here to see what we've done and feel free to take as many methods or classes as you feel necessary to develop your project. It's encouraged however that you try and develop our own code so you can produce images that are tailored to your needs. The following are a few hints you might want to keep in mind when writing your code.
1. you're probably going to want and have a class like dataOrg.java that is solely dedicated to returning valuable statistics from your data, i.e. the mean, the variance etc. This will make it easier for you to access important information from any parameter without having to write code over again and again plus it's much cleaner.
2. Do some reading on data visualization and the intersection of different parameters before beginning to write your code. It's important that you have a good understanding of exactly what is it that makes an image seem hotter for example... sure the color red. But how much of it? does Hue matter? what about brightness and saturation? which colors are more harmonious together and which ones aren't? all of these questions have answers online and you want to know them before you begin to code
3. As far as colors go, I could advise that you create color pallets on the website "http://tools.medialab.sciences-po.fr/iwanthue/" they allow you to customize pallets of multiple colors that have been assorted in a way that makes them both harmonious and distinguishable to the human eye! THis tool is extremely usefull and playing around with it gives you a good feel of how colors will impact your image.
4. Lastly, try and keep your outputs as random as possible! Life is not predictable and so neither should your code.Take advantage of the random number generator functions in different languages to produce code that has biased random processes. Biased randomness implies that each image will be different yet biased in different ways depending on the data you input.
Attached is the final product of our code.