Experimenting with Capillary tubes

LED diffusion has in my minimal experience usually meant sanding: sanding acrylic surfaces in layers and sanding the LEDs too. This time I wanted to experiment with an object I’ve had in my possession for a few years for reasons unknown: a canister of capillary tubes. My goal was to put the LEDs at the bottom of the container to see what would happen with the light and how it would diffuse both sideways through the tubes and also up along them. Between the LEDs and the bottoms of the tubes I put some stuffing to help with the diffusion process, and carefully cut a plastic cup to fit inside for the tubes to stand on. 


I also had ambitions to make the code translate normal strings of text into different colored patterns, brightnesses, and fade lengths, but my shortcomings with C ended up forcing me to settle for the simpler interaction (increasing brightness with key presses). Still, it’s an interesting looking object both with the tubes bunched and unbunched, and does a great job of diffusing light.



Arduino Uno

Arduino Mini


Capillary Tubes; container

3 LEDs, (R, G, B)

3 Resistors (220 ohm)

Soldering iron, solder



* Serial RGB LED
* —————
* Serial commands control the brightness of R,G,B LEDs 
* Command structure is “<colorCode><colorVal>”, where “colorCode” is
* one of “r”,”g”,or “b” and “colorVal” is a number 0 to 255.
* E.g. “r0” turns the red LED off. 
* “g127” turns the green LED to half brightness
* “b64” turns the blue LED to 1/4 brightness
* Created 18 October 2006
* copyleft 2006 Tod E. Kurt <tod@todbot.com
* http://todbot.com/
* Special thanks to Neera, whose post I looked at in order to troubleshoot my own 🙂

char serInString[100]; // array that will hold the different bytes of the string. 100=100characters;
// -> you must state how long the array will be else it won’t work properly
char colorCode;
int colorVal;

int redPin = 9; // Red LED, connected to digital pin 9
int greenPin = 10; // Green LED, connected to digital pin 10
int bluePin = 11; // Blue LED, connected to digital pin 11

int brightNess = 0;

int i = 0; // Loop counter 
int wait = 20; // 50ms (.05 second) delay; shorten for faster fades
int DEBUG = 0; // DEBUG counter; if set to 1, will write values back via serial

void setup() {
pinMode(redPin, OUTPUT); // sets the pins as output
pinMode(greenPin, OUTPUT); 
pinMode(bluePin, OUTPUT);
analogWrite(redPin, 255); // set them all to v bright
analogWrite(greenPin, 255); 
analogWrite(bluePin, 255); 
Serial.println(“enter color command”); 

void loop () 
// clear the string
memset(serInString, 0, 100);
//read the serial port and create a string out of what you read
brightNess = strlen(serInString);

colorCode = serInString[0];
if( colorCode == ‘r’ || colorCode == ‘g’ || colorCode == ‘b’) {
colorVal = int(brightNess * 10 * 2.55);
Serial.print(“setting color “);
Serial.print(” to “);
serInString[0] = 0; // indicates we’ve used this string
if(colorCode == ‘r’) 
analogWrite(redPin, colorVal);
else if(colorCode == ‘g’)
analogWrite(greenPin, colorVal);
else if(colorCode == ‘b’)
analogWrite(bluePin, colorVal);


delay(wait); // Pause for ‘wait’ milliseconds before resuming the loop 

//read a string from the serial and store it in an array
//you must supply the array variable
void readSerialString (char *strArray) {
int j = 0;
if(!Serial.available()) {
while (Serial.available()) {
strArray[j] = Serial.read();