Monday, May 10, 2010

Presentation Code

One Arduino is in the background remote. It generates the base color/animation for the wall. The 'A' buttons allow you to pick a background program.
Some of the current ones are:
-Solid color: the sliders determine the color;
-Rainbow: one of the knob determines the speed and direction.
-Fade: loops through the leds fading each one

The 'B' buttons set the interaction program.
Currently you can choose:
-Light only: the wall only lights up where people are,
-Glow white: the white LEDs glow where people are
-Shift Hue: shifts the hue of the LEDs where people are

The remote sends the 'B' value to the receiver box along with the value of the first knob.

The other 2 arduino's are in the receiver box along with an ATX power supply, a breadboard with 2 tlc5940's and a cat5 patch panel to make for easy connections to the led drivers, servos and proximity sensors.

This is the code that we ran on the arduinos during our presentation.

There are three parts:
1) The arduino that generates the background color/animation.
2) The arduino that reads the distance sensors
3) The arduino that receives serial data from the other 2 arduinos and generates a modifier based on the sensors and applies it to the background color and servos.

Download the code

Note: I did not include the TLC5940 Library, you will need to download it from the Arduino Playground.

Some areas that need improvement:
-Hue shifting code needs to be optimized or moved to another arduino. Currently the receiver can't process the code fast enough to work at 30fps.

-The proximity sensors output a digital pwm signal that the arduino reads with a pulseIn function, but it only reads one at a time, a process that can take up to 60mills each. we could get more data if we write our own pulseIn command, probably tied to a timer so it can poll multiple sensors at once.

-The knobs on the background box don't do much at the moment, the color programs should use them to modify speed, intensity, randomness etc.

-The fading code was adapted from the tlc5940 library. There needs to be line in the code to clear all fades when you leave a program that set a bunch of fades.

Future Plans....
-Create a website where people can change the walls colors with their smart phone
-Make it visualize music

No comments:

Post a Comment