Ryan Kenney

Brain dump.

Filtering by Category: TiltLightBoxBlog

TiltLightBox First Ruggedized Prototype

I received the professionally printed PCBs this week, and they look great.

Unfortunately, I'll have to do new ones for our new plan to use 5V addressable LEDs, but the good news is that I can put together a couple of boxes to verify general durability. So far I assembled one. It uses zip ties to hold everything in place and a bit of padding between the PCB and the box sidewall. Because everything is so light, it feels really solid.

We still some de-bouncing logic to prevent flickering, and I'm realizing that tilt/no-tilt are the only reliable states because the tilt sensors at perpendicular angles provide random values. That's why the colors in the video are a little random.

After a bit of stress testing, I ran into two issues, both which I was expecting. First, the plastic gets stress marks if you hit 'em hard enough. This probably won't be an issue just falling on the playa, but it will show up if the boxes get punched/kicked a lot. Either way it's just a minor blemish.

Second, the RF adaptor card fell out its socket. I figured that might happen. I'll probably put a dab of super blue on each, and possibly on the Arduinos as well.

Scoreboard Concept

I tossed out a basic concept for a scoreboard/platform in case someone else in the camp wanted to pick it up and run with it. I admit it's not much to look at in this iteration, but I'll worry about this more as we closer to the date.

TiltLightBox Batteries

Tested 12V Battery

Max Elliot's helping out on the project by looking for a battery solution to eliminate the tangle of wires coming out the back. The first thing he tested was a little 12V black box, with a built-in charging unit. These run about $25 each. He reports that one ran for 6 hours with our 1-meter/12V LED solution attached (running about 0.45A total).

Adjusting LEDs to 5V

Then he was planning on trying out a 3x18650 solution, which might be a bit cheaper (external/shared charging components), and run a little longer, but he realized something: if we go with a 5V LED strip, we can work with a lot of affordable/easy-to-use battery solutions designed for recharging phones. It turns out that addressable LEDs run at 5V.

My first reaction was, "reaaaally, I have the rest of the hardware all figured out", but I had to admit, it makes for a better product. So, my next step is to drive addressable LEDs from the Arduino. There will be a kink or two to work out, as both the LEDs and the RF adaptor use the SPI interface on the Arduino.

TiltLightBox Color Logic

This weekend I took a first stab at writing the color cycling patterns for the boxes, and it dawned on me, it would really be nice to demo the logic/color/audio features in a web page. So I started playing with Emscripten to compile my Aruino (C/C++) logic into JavaScript. It took a bit of fussing, but I've got a basic framework going. It still needs tilt-senor feedback, and bit of tweaking to better emulate multiple threads (multiple Arduino boards).

I'm dumping everything to a TiltLightBox github project. I plan to clean up the repo contents and add markdown pages as I get closer to completion.

TiltLightBox Last Minute Testing Before Ordering PCBs

This is just a quick update on my progress. Once again, I'm not including a ton of details on how I solved each problem. Later on I'll post complete guide to the build out.

Switched to 3.3V Arduinos

I tried out my new 3.3V Arduino Mini Pro. Everything worked except that the lights were really dim. My MOSFETs aren't sized properly... shame. I already bought 90 of those suckers.

RF Communication

Using a 3.3V Arduino Mini Pro and an Arduino Uno, I was able to get two talking over the NRF24L01 adaptors. Here's a quick demo of with tile sensor state be transmitted to remote LEDs:

Verified Pull-up Resistors

I confirmed the ability to use the embedded pull-up resistors instead my own external resistors. That'll simplifies the PCBs a tad.

Verified Color Transitions

I verified one last thing that I hadn't checked checked yet--that I'm able to drive a full spectrum of color changes through my the PMW/MOSFET controller. It works great.

Orderd PCBs

Finally, I ordered my first batch of professionally printed PCBs! (from pcb-pool.com) Pretty cool.

First Custom PCB for 5050 LEDs and Tilt Sensors

New Tilt Switches

First off, I've got some new tilt sensors (switches):

(Mouser Part # 612-TM1000Q)

These babies are awesome. Cheap, mercury free, reliable, and each one detects any tilt beyond 45 degrees in either direction along one axis. So with two, I can detect tilt in all four directions, and even know which direction we're tipping.

Custom PCB

Next, I etched my first PCB! I used the laser printer + ironing method for transfer. It took me a couple of tries to figure out how to get a good transfer. (The secret: Take a good 10 minutes ironing with a lot pressure, making sure to press the edge of it the iron all over the board to catch any surface curvature.) If I was going to do this a few times, I'd go out and buy the $30 laminating machine from Harbor Freight and skip the ironing, but my long term plan is to order a batch professionally printed PCBs.

I verified the PCB by wiring it up with my 5V Arduino Mini Pro:

Mounting System

Next, I put together the first draft of my plan for packaging the light boxes up. The plan is to mount the PCB inside of a standard outlet box, right next to an AC outlet. Then I'll run a DC plug back inside of the box, to the PCB. (There were actually going to be two DC plugs, until I realized that the Arduino Mini Pro has a voltage regulator, and can run directly from 12VDC.. duh.) I didn't bother cutting my first PCB down to fit inside the box, but I will for the final version.

Next, I tried out my plan for mounting the LEDs: a PVC stick running through the diagonal of the box. Why the PVC? It suspends the LED in the middle of the box (better diffusing the light) while casting very little internal shadows. In the end, it's looking pretty good.

(Upside-down video courtesy of Vimeo... too lazy to fix...)

Up Next?

I've got a few things to fix in my PCB layout...

  • Fix hole sizes--most were too small. That should be a relatively minor fix, but I've gotta figure out how to copy/edit library components properly.
  • Add a 12VDC connection directly to the Arduino
  • Consider eliminating the four pull-down resistors on the tilt switches. It turns out that the Arduino has pull-up resistors built in! Dunno why this wasn't pointed out in all of the button tutorials floating around.

Then on to the fun stuff. I need to try out the 2.4Ghz RF adaptors. It turns out, contrary to the specs on Amazon, you can't run these off of 5VDC, so I'm pretty sure I burned out the pair I had. Now that I have a couple of new adaptors, and couple of new 3.3V Arduino Pro Minis, I should be good to go.



First Arduino Shield with LED 5050 and Tilt Sensors

Simple Wiring Diagram

First, here's the basic wiring diagram I posted before. It reads from three tilt switches, and controls a standard 5050 LED strip.

My First Shield

In an effort to box this up, I did manage to get everything crammed on to one Arduino Uno shield. It's still a bit messy, and a royal PITA to solder, and needs a better connector to the LED strip, but it work.

Custom PCB

Since the soldering job was such a pain, and I'll have to do this reliably at least 20 times, I started looking at custom PCB printing. Step one, learn the Eagle tool for designing boards. Here's the result (photo cells holding the place of tilt switches).

Arduino Pro Mini

Now that I finally got a new Arduino Pro Mini (cheaper/smaller), I verified that it works just as well as Arduino Uno R3.


Lights and Tilt Sensors

Simple, A/C Solution

I realized that the Godzilla Bowling (formerly Godzilla Town / Hovercraft Bowling) concept would be more interesting if the boxes responded to being knocked over, so I started imagining ways of switching between two bulbs (or an alternative AC circuit that blinks). Here's one that I came up with. It uses a PVC end cap, zinc-coated bolts, and a steel ball.

It works pretty well, but each one is a ton of work to build, and getting the sizing just right is tricky. You have to be very careful to ensure that it remains lit when upright while simultaneously avoiding shorts. I've got some other ideas for tilt sensors, but so far nothing has quite been the trifecta of cheap/easy/reliable.

Moving to Digital

I really like the AC LED bulbs from Philips that Home Depot has. They're really bright, $7 a piece, and basically indestructible. Plus, the world of AC is a lot simpler for someone that's only done basic house wiring in the past 15 years. It seemed like running with AC would be cheaper than buying a ton of LED 5050 strips, power supplies, etc, but after some investigating, that doesn't seem so true. So I bit the bullet and got the basic blinking circuit working with a 555 IC.

In truth, I was first looking at this to simply control my blinking AC circuit, but then I got ambitious. What if I jumped over to an Arduino to control each box? Well here are some cool, possible advantages:

  • More interesting blinking/color patterns
  • Pre-built tilt sensors (now that we're using lower voltage DC)
  • The possibility of reporting back state changes. Maybe they could keep score? Have a bonus box?

So I got two things working. First, I got my 5.5V Arduino Duo to control a 12V LED strip, using two power supplies. This is important because the cheaper Arduinos that I'll need are not going to be able to handle the 12V needed by the LED strips. Second, I some basic tilt switches working as input to the Arduino.

These particular switches are barrel shaped, and each box would need three of them to detect a tip in any of four directions. They are also a pain to work with--easy to overheat when soldering, difficult to properly align at appropriate angles. My current hopes are pinned on this digital four-way sensor.

Here is my Arduino wiring diagram and sketch. The resistors are 10k and the "NPN" devices are N-Channel MOSFETs. (Somehow, "NPN" seems like the wrong label for 'em, but that's what the diagramming tool (fritzing) rendered.)

// Tilt Sensor LEDs

const int ledPin =  13;

const int axisPinX = 2;
const int axisPinY = 3;

const int ledPinRed = 9;
const int ledPinGreen = 10;
const int ledPinBlue = 11;

void setup() {

  Serial.begin(9600);

  pinMode(ledPin, OUTPUT);

  pinMode(axisPinX, INPUT);
  pinMode(axisPinY, INPUT);

  pinMode(ledPinRed, OUTPUT);
  pinMode(ledPinGreen, OUTPUT);
  pinMode(ledPinBlue, OUTPUT);
}

int axisX = 0;
int axisY = 0;

void loop(){
  // read the state of the pushbutton value:
  axisX = digitalRead(axisPinX);
  axisY = digitalRead(axisPinY);

  if (axisX == HIGH) {
    if (axisY == HIGH) {
      setColor(255, 0, 0);
      digitalWrite(ledPin, HIGH);
    } else {
      setColor(0, 255, 0);
      digitalWrite(ledPin, LOW);
    }
  } 
  else {
    if (axisY == HIGH) {
      setColor(0, 0, 255);
      digitalWrite(ledPin, LOW);
    } else {
      setColor(255, 255, 0);
      digitalWrite(ledPin, HIGH);
    }
  }
  delay(100);
}

void setColor(int r, int g, int b) {
    Serial.print("(");
    Serial.print(axisX);
    Serial.print(",");
    Serial.print(axisY);
    Serial.print(") ");
    Serial.print(r);
    Serial.print(":");
    Serial.print(g);
    Serial.print(":");
    Serial.println(b);
    analogWrite(ledPinRed, r);
    analogWrite(ledPinGreen, g);
    analogWrite(ledPinBlue, b);
}

Quick update: I just received/tried the four-way sensor. If I'd been paying a bit more attention, I would have noticed that this can't detect "no tilt". To do that I'd need two units mounted at near 90-degree angles (getting expensive).

Powering Blocks

As I was trying to figure out how to illuminate stackable wood blocks, I came up with this gravity-based mechanism for transmission of power between wood blocks. It worked well for transmission between two blocks and a light bulb, but I haven't figured out how reliable it would be if stacked several times. It could suffer from unreliable connections (causing flickering) or a ton of resistance (dim lights).

Since this was transmitting 120V AC, I tried to make things somewhat safe by recessing the contacts and having the top block drop into the recesses. That being said, we'd still have 120V AC exposed to small hands. :/

It's possible that this approach would work with a 12V DC connection. Maybe I'll come back to it. I'm mostly sceptical of the reliability of the connection once these contacts get coated in playa dust.