Coff-E Table

Coff-E

The school year is just around the corner so I wanted to make something cool for my suite. So here is the build of my interactive coffee table I call COFF-E (Pixar don’t hate me, I love Wall-E, that’s why I’m borrowing from your design).

First I actually assembled the table. Most of the wood came from a scenery from a show I worked on in high school. I save some of the nicer pieces of wood from the dumpster. The smaller pieces I found in my garage.

IMG_2541IMG_2546

After cutting the pieces down to a size that worked, I screwed it all together. I am no perfectionist, so I didn’t care if everything fit together just right. It just needed to work enough. I found some spare screws and voila, we have a table.

IMG_2548IMG_2562

I added a few coatings of a base color and then splatter painted it. It gave it a really cool look and not a lot of work. For the splatter paint I used some plastic forks so I could really fling the paint at the table (and apparently my hands). All of the paint I found around the house, so I still haven’t bought anything for this project.

IMG_2596IMG_2602IMG_2608IMG_2614IMG_2617

Now onto the part I find especially interesting, the electronics. Warning: the following get’s a bit technical. Inside the table there are 40 LEDs. It’s set up in an 8 x 5 matrix. All of the cathodes are connected in each column, and each anode is connected in each row. My arduino doesn’t have 40 output pins, so using this method I can greatly reduce the required pins. The idea is the arduino only lights up one row at a time. In that row it lights up every column it’s programmed to, turns them off and goes to the next row. This process happens for every row. This process happens so fast that because of persistence of vision, it looks like all 40 of the LEDs are lit up at once.

IMG_2569

So far we need at least 12 pins in order to light up these LEDs (the arduino uno only has 13 digital outputs). To free up more pins, I used a shift register on the columns (so now 3 digital pins can control 8 LED columns. 3 column control and 5 row control now leads me to only need 8 pins. I could add another shift register for the rows, but to keep parts and programming easy I decided I reduced the number of pins enough.

IMG_2577IMG_2578

I plugged it into the Arduino and within minutes, I have all of the LEDs light up. There was a couple mistakes. Two solder blobs combined and so column 2 and 3 were working together. A little desoldering fixed that all up. Secondly, I originally used resistors on all of the columns of LEDs (which I originally did to protect the LEDs). This reduced the brightness greatly, and the LEDs don’t get overpowered by the Arduino without them, so I ended up bypassing them. (This step may have caused the slight dimming in third to last column, which became more and more dim as the table lived on).

Glowing dots is all cool, but I wanted them to look more like square pixels. To accomplish this I used some foam board I picked up from Dollar Tree and made a grid.

IMG_2560IMG_2561

IMG_2586

To further diffuse the LEDs, I added a little dot of hot glue to the top of every LED, and then cut apart grocery bags and put a layer of that plastic across them.

IMG_2588

Without plastic bag diffusion

With plastic bag diffusion

With plastic bag diffusion

This method was okay, but since I was using the foam board as a diffuser for the top, I lost a considerable amount of light. I acquired some textured plastic from some scrap at a hardware store for free: score! The result is just what I was looking for.

IMG_4908

I added the controls to the table on a hinging spot I added to the table. The controls are two potentiometers, a select button, and a reset button. I decided to leave the wires exposed because I thought it gave the table a cool look.

IMG_4907IMG_4906

I wrote the code for the table from scratch. The basic idea behind the code is you send a two dimensional boolean array to the make() method and tell it how long to display it. Right now it has 6 modes. In the first mode it cycles through all of the LEDs (really good for trouble-shooting).

komedi_1396928389550_816

In the second mode it randomly lights up different LEDs.

randomlighttest

Third is a predefined animation.

animation

Fourth is super low resolution two player pong.

pong

Fifth is etch-a-sketch mode.

etch-a-sketch

Sixth is a spin the bottle mode. You can adjust the speed and press the button to stop at any time.

spin

Lastly: here we have a short making of video

 

Improvements for next coffee table:

  • Definitely more LEDs. 16×8 Matrix for a total of 128 LEDs (thats 320% more LEDs)
  • Attempt to get more uniform illumination from LEDs
  • More games. Research into low graphic games. Possibly create new game
  • Secret compartment(s)

 

Advertisements

Digit Displays Using Shift Registers

As part of a larger project, I needed some 7-segmented digit displays.

IMG_3936

I had some cheap ones lying around, and I forgot where I bought them. Thankfully, I found the data sheet here. Since running 16 lines from an Arduino would be quite wasteful, I designed them to be controlled by two shift registers. Here is the information I used to wire it all up. Shift register wiring can be found here.

IMG_3933IMG_3934IMG_3935

Note that since I was soldering to the back, I flipped the pinout of the digit displays. One shift register controls each digit, and the first shift register passes information to the second.

For code I used the shiftOut function. That turns on the LED’s with a binary number, so it comes down to seeing which binary number creates what displayed number. I made a table to figure it out. So now all you have to do is send a number between 0 and 99 to the displayDigit function.

IMG_3937

ledcounter

Pixel Strand Light Show

With all the snow we got last night I had plenty of time to write some code in peace. I just received my RGB LED strand with the WS2811 drivers built right in and I just had to play with them.

IMG_3839IMG_3860[1]

I gotta say, these LEDs with the drivers built in them are way cool. The circuitry and programming is way easier. And it’s very economic. I got this strand of 60 LEDs for $20 including shipping.

IMG_3846

Circuity is dead simple. All the strand needs is 5V, Gnd, and Data. Since the strand isn’t too long, I just used the 5v from my arduino. If I had a longer strand or more strands I would have used a separate power source. IMG_3842

After I had some fun playing with the NeoPixel Library from adafruit making rainbows and such, I needed to take it to the next step: music controlled.

The circuit required for music control isn’t as simple, but it’s still not a heck of a lot when it comes to component count or cost.

  • 33 pF cap
  • 100 nF cap (2)
  • 10 nF cap
  • 200 K resistor
  • MSGEQ7 Chip

IMG_3843IMG_3844IMG_3845

From there it’s all programming. I made a few different modes, and I currently have it so it cycles through all the modes. The code is here, free to download.

I won’t go into the specifics of the program , but the basics of the code is reading in the values of the MSGEQ7 chip in the readAudio() method and then using that data to create fancy blinking lights on the strand.

Videos of it in action are at the bottom. I apologize for the horrendous quality: I used that particular speaker since it didn’t need any amplification or additional circuitry, and who would have guessed phone camera’s aren’t particularly good at capturing blinking LEDs.  Guess you’ll have to build one yourself to see how it looks!

Christmas Puzzle Box

As a running gag within my family, I make my sister’s Christmas presents rather difficult to open. Usually this just consists of taping the entirety of the box in packing tape. Last year, my sister PJ did me one better, and wrapped twenty $1 bills, all in separate boxes. This year I thought I would get her back, with a box that has to be solved before it will open. And since I had a gy-521 chip lying around, hey why not?

IMG_3633 IMG_3631

The box is an old cigar box, loaded up with an Arduino, a servo, LEGOs, a few LEDs, and a gyroscope.

CODE:

In order for the box to open, it must be rotated in a specific pattern

int puzzle[5][3] = {{0, 0, 90, },{90, 0, 0 }, {-90, 0, 0 }, {-180, 0, 0 }, {-180, 90, 0 }};

which is predefined by an array at the top of the program [complete program at bottom of post].

The build is very rough, as it is made for a one time use, and I didn’t really want to nail anything down or permanently alter anything.

First I focused on the code. I looked up the gy-521 and found some very helpful code here. It gave me a great starting point, as I would have no idea how to get data from the chip.

IMG_3610

I created a method that takes the angular velocity and makes approximations of how the chip has been turned.

From there I created a puzzle. The puzzle has 5 “frames” or stages. The puzzle allows you up to 30 degrees of error on any particular frame, and tells you on which axis the box must be rotated.  Once you are within the frame, it tells you by blinking a green led, and then loads the next frame. Once all frames are complete, it turns on the green light indefinitely, and tells the servo to move to 90 degrees.

There is a challenge, as you only have a certain amount of time to pass any frame. If the time is exceeded, the green light blinks repeatedly, and you have to turn the box off and on again and start the whole puzzle over.

HARDWARE:

The hardware is all rather simple, and since I didn’t want to make anything permanent, I just stuck a mini breadboard in the box. Here is the pin layout

GY-521

  • SDA to A4
  • SCL to A5
  • VCC to 5v
  • Gnd to Gnd

Servo:

  • data to D9
  • pos to 5v
  • Gnd to Gnd

LEDs

  • Green to D13
  • Blue to D4
  • White to D5
  • Red to D6

IMG_3630

9V

  • Red to VCC
  • GND to switch to GND

The only tricky part from there is making the angular motion of the servo control a lock. I used some LEGOs and a cup hook to get the job done fast and relatively easy. Wrap some wire to the servo and LEGO actuator arm and looky here we got a lock!

giftbox

IMG_3629

That’s about it. Here is the code!

Adding Bumper Sensors

Today I decided to ditch the old bumper sensors since they were built into the original motherboard of the robot, and added new ones in their place.

Design is simple, a push button where the old sensor used to be. I filed down a protoboard to fit in the location, soldered a push button onto the board and attached leads to it. I carefully hot glued the boards in the location (lots of hot glue in hopes they might actually stay.

IMG_2051[1] IMG_2053[1] IMG_2054[1] IMG_2055[1] IMG_2056[1]

To test if the sensors were working I wrote up a quick sketch to check. It just serial rights left or right depending on which button is pushed.

IMG_2058[1]

Code below:

int rightSensor = 2;
int leftSensor = 3;

void setup() {
Serial.begin(9600);
pinMode(rightSensor, INPUT);
pinMode(leftSensor, INPUT);
}

void loop() {
if(digitalRead(rightSensor)){
Serial.println(“right”);
}
if(digitalRead(leftSensor)){
Serial.println(“left”);
}

delay(1);
}