Archives for posts tagged ‘LEDs’

LED wiring

The Arduino Mega has 54 digital I/O pins, 50 of which are each driving an LED on the Hi-Striker. Each pin can drive up to 40mA, so the only additional components needed are one 100k current-limiting resistor per LED.

For testing, a simple cascading loop runs through the (first 16) LEDs one at a time:

const int ledCount = 16;    // the number of LEDs in the bar graph
int ledPins[] = { 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 };   // an array of pin numbers to which LEDs are attached

void setup() {
  // loop over the pin array and set them all to output:
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    pinMode(ledPins[thisLed], OUTPUT);
  }
}

void loop() {
  // loop over the LED array:
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    digitalWrite(ledPins[thisLed], HIGH);  // turn on the LED
    delay(20);                             // wait
    digitalWrite(ledPins[thisLed], LOW);   // turn off the LED
  }
}

LEDs & gravity

I thought it would be a nice touch if the LEDs in the Selleck Striker behaved more like the metal ringer in an old school mechanical hi-striker. So rather than rising up the scale in a linear way, what if it looked like the LED “ringer” was being pulled down by gravity (and friction, and air resistance) like the real thing?

time_distanceSo I figured an ascending object will decelerate in the same way a falling object will accelerate, since they’re both subjected to the same force (gravity). I found some formulas for acceleration due to gravity, particularly :

d=gt2

where d = distance, g = the gravitational constant, and t = time. I would calculate the trip from top to bottom as if the ringer was falling, then use that data in reverse.

The LEDs turn on in sequence, with a delay value in between to determine how long each one stays on (and how fast the “ringer” appears to move). So in order to determine that value I need to solve for t in the equation above. So:

t=sqrtt_g

I know that on Earth the gravitational constant — or g — is 9.8 m/s² (meters per second per second). I know the distance d between each LED is 1.37″, or .035m. So the time tx to get from the very top LED to the next one is:

tx

So the first .035m step down from the top will take 59ms. In order to find tz for the second step, I need to find ty for the total distance from the top to the second step (.035m x 2 = .07m), then subtract tx for the first step:

distance

So:

equations

I need to do this for each of the 51 steps (50 LEDs plus the very top, the winner!). Actually, I’m not calculating this at all. I’ll let the Arduino do all the calculations, and save the delay value for each step in an array that it can quickly access when it needs to. Here’s how I did it in the Arduino script:

  float gravity_constant = 9.8;                         // the constant of gravity, or G
                                                        // we can adjust this to tweak the effect

  int gravity[50] = {};                                  // set up the gravity array

  for (int i = 1; i <= 51; i++) {                        // this will loop 51 times
    float distance_x = i * .035;                         // calculate the total distance from the top to the LED in question
    float distance_y = (i - 1) * .035;                   // same distance, minus one step 
    float time_x = sqrt(distance_x / gravity_constant);  // the time it takes for an object to fall distance_x meters
    float time_y = sqrt(distance_y / gravity_constant);  // the time it takes for an object to fall distance_y meters
    float time = time_x - time_y;                        // the time it takes for an object to fall to our LED from the one before it, in seconds
    int time_ms = time * 1000;                           // convert to milliseconds
    gravity[i] = time_ms;                                // add this value to the gravity array
  }

The gravity array will look something like [59, 26, 16, 14, 13, 12, 11, 10, 9, etc…….], dropping rapidly at first and then slower until it levels off at 4ms or so. If we then light the LEDs in sequence, applying these delay values to each step:

  int level = 48;             // this is the level the person hit to
                              // * entered manually for testing purposes,
                              // in the final product this will be determined by 
                              // the force of the hammer strike  

  for (int i = level; i > 0; i--) {
    digitalWrite(ledPins[level - i], HIGH);
    delay (gravity[i]);
    digitalWrite(ledPins[level - i], LOW);
  }

then we get something like this:

Note: the blinking at the beginning is the Arduino booting up, and the blinking at the end was added later to highlight the level of the hit.

finishing the Selleck Striker

Just one more day till Crushtoberfest, and the Selleck Striker is ready to go. Last night I mounted the head (nice job Sam!) and drilled its eyes for LEDs. I also mounted the fireball launchers and wired everything up.

selleck head wiring the Selleck head

Crushtoberfest promo video!

LED lighting, part 1

I’m in the process of designing some new lighting for the house, which I’ll get into in detail later. For now I’m experimenting with Luxeon Rebel LEDs to evaluate the different colors and white temperatures. I started by getting a handful of “warm white” and red, green and blue Rebels. I expected the white ones to be too “cool” in temperature, so the R G and B ones could be individually adjusted to provide some warmth to compensate. I designed a simple PC board that takes three white LEDs and one red, one green and one blue one.

transfer sheet toner applied etch-resist layer

I designed the board in Illustrator and laid out several together on a page, then printed it onto a sheet of toner transfer paper (from Pulsar). I laminated it to a copper-clad board and ran it through again with a “white TRF foil” as an etch-resist layer, as the toner alone tends to be somewhat porous.

etching etched

I then etched the boards with ferric chloride in a Tupperware dish floating in hot tap water in the bathroom sink, agitating the dish continuously.

drilled & cleaned

After about 25 minutes in the etchant I rinsed the boards, drilled the holes, divided them up and removed the toner from the remaining copper with lacquer thinner and a scotch-brite pad. I soldered the LEDs onto the board, along with a female header to connect wires to. For testing purposes I connected two C batteries together and plugged them into the header.

Luxeon Rebels are designed to dissipate heat through a large “no connection” solder pad directly under the chip. There are specific guidelines for the design of the PCB to draw this heat away from the LED which include a multitude of plated vias to increase the copper surface area. I’m unable to create plated vias in my homemade boards, so my intent is to mount the board to an aluminum plate, using an aluminum machine screw to draw the heat through the hole in the middle of the board.

assembled board test run

I learned some important lessons from this first attempt. The main problem is hand-soldering these tiny surface-mount LEDs to such a large copper field, which resulted in a sloppy, lumpy mess of solder. I also realized that I may need to experiment with other combinations of LEDs to get the color right. This first try produced a pleasant white light (and yes, red, green, and blue light does combine into white…I know the theory is fundamental but seeing it happen before your eyes is pretty exciting!) but compared to incandescents and even some of the warm CFLs in my house it still looks very cold.

A good first effort, with room for improvement…

LED lighting, part 2

tin plated My first attempt at using the tiny Luxeon Rebel LEDs taught me several things, among them how difficult it is to hand-solder them. I also realized that I would need to experiment more with the different white LEDs that are available, or potentially using red green and blue LEDs to produce the white I’m looking for (or a combination thereof). So I designed two new PCBs… a new six-LED board with individual control over each of the LEDs, and a tiny single-Luxeon Rebel breakout board so I can mix-and-match different combinations quickly and easily. To both designs I also added very tiny dots at the corners of each LED location to help position the LEDs. These designs are two-sided, with the back side consisting of a large copper field to help transfer heat to the aluminum heat sink.

I made the boards the same way as before, except that I tin-plated the finished boards with Tinnit to protect the copper from tarnishing and to improve the solderability.

For this batch of boards I decided to finally try my hand at reflow soldering, using the skillet method described by the Sparkfun guys. I bought an inexpensive skillet at Target, an infrared thermometer at Lowes, and some no-clean solder paste. The solder paste came in a syringe package but didn’t come with any needles, so I squeezed a little paste onto a paper towel and carefully dabbed it onto the PCBs with a toothpick. Using a pair of tweezers I placed each LED into position and pressed it into the paste, which held the component fairly well.

Before trying any soldering I looked up the reflow profiles for both the solder paste and the LEDs, and experimented with the skillet to see what settings would yield the target temperatures. I may one day build an Arduino temperature control for the skillet to more precisely control the profile, but I think these reflow characteristics are pretty flexible and for now it’s working just fine.

reflow skillet reflowing

I put the PCBs into the middle of the skillet (I got wildly different temperature readings from different spots on the skillet) and turned it up to “LOW”, watching the temperature with the thermometer. As the temperature leveled off at around 165°C the boards began to smoke and I turned it up to “MED”. Within a minute or so the solder liquified and flowed nicely, in some cases shifting the LED into perfect alignment with the solder pads (apparently a result of the solder’s surface tension).

soldered assembled with headers

I made breakout boards of several different LEDs: “warm white“, “ANSI 2700K white” (an even warmer white), “amber“, and red, green and blue. After the skillet reflowing I hand-soldered on a couple of header pins for the breadboard.

breadboard

This breadboard setup allows me to swap out different combinations of LEDs to evaluate the color of the light (here I have six 2700K Rebels installed). For this mock-up I used a 24VDC desktop power supply powering a BuckPuck LED driver, switched with a momentary pushbutton. I’m getting closer to the color temperature I want, but right now these are all on (full power) or all off. The next step will be PWM control over individual LEDs or groups of two or more to start precisely dialing in the settings.