Fading lightboxes, High power LEDs

Hey there folks! I’m taking on a project wherein I want to help a local artist create some light boxes.
The basic premise is that someone would walk up to the first in a set of three or two boxes and press a button, or interact in some way, and it would trigger an orderly fade in, and fade out of those boxes.

Button → Box 1 fade in → box 1 fade out → box 2 fade in → … → reset to all off & Wait for button press

I think the coding I can hack together… or maybe even write something clean, but the wiring and hardware I could use some extra help with right off the bat.

I’ve mocked something up in Fritzing (attached) with what I think I should be doing, but I’m unsure. Imagine the LEDs as 12 Volt LED strips (installed prettily in a box behind a diffuser), the transistors I hope to learn what might be able to handle the power I need, and the battery will actually be some form of 12 V PSU.

Does any of this make sense? Or is there another direction I should be looking?

Lightbox Mockup.fzz (8.11 KB)

I think you are basically on the right track.

You need 1 power transistor per strip of LEDS (i.e per light box). You will need a powerful enough 12V PSU to supply the number of strips (you only need 1 PSU for all the LEDS)

Search e.g. on eBay and you can find plenty of LED PSU's You can also find FET modules (Field Effect Transistor) that are designed to carry up to 5A (as long as you bolt the FET to a heat sink, as it will get warm or even hot).

Then just wire 3 of the PWM capable outputs to the FET;s and off you'll be away.

Coding should be pretty simple, just wait for the button press then write code to vary the leds as required.

Thanks Roger! I think I’m on the right track so far and everything I can search seems to indicate that Ive got this right, but I still seem to be having difficulty. Maybe this would be better placed in a support forum rather than a feasibility forum, but I always feel odd about posting on the same subject in multiple forums.

The LED strip functions just fine when plugged directly to power, but I’ve either misunderstood transistors and have the wrong parts or have misfired this in some way that I cannot see. Is there any advice to be had?

The Transistor is a TIP31C (http://www.fairchildsemi.com/ds/TI/TIP31A.pdf)

The Code is as follows:

// Triggering fading light boxes with a button

const int button = 2;
const int boxOne = 3;
//const int boxTwo = 5;
//const int boxThree = 6;

int buttonState;
int lastButtonState = LOW;

long lastDebounceTime = 0;
long debounceDelay = 50;

void setup()  {
  pinMode(boxOne, OUTPUT);
//  pinMode(boxTwo, OUTPUT);
//  pinMode(boxThree, OUTPUT);
  pinMode(button, INPUT);
} 

void loop()  {
  int reading = digitalRead(button);
  if (reading != lastButtonState) { 
    lastDebounceTime = millis();
  }
  if ((millis() - lastDebounceTime) > debounceDelay) {
    if (reading != buttonState) {
      buttonState = reading;
      if (buttonState == HIGH) {
        for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=2) {
          analogWrite(boxOne, fadeValue); 
          delay(30);                            
        } 
        for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=2) {
          analogWrite(boxOne, fadeValue); 
          delay(30);
        }
//        delay(150); 
//        for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=2) {
//          analogWrite(boxTwo, fadeValue); 
//          delay(30);                            
//        } 
//        for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=2) {
//          analogWrite(boxTwo, fadeValue); 
//          delay(30);
//        }  
//        delay(150);
//        for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=2) {
//          analogWrite(boxThree, fadeValue); 
//          delay(30);                            
//        } 
//        for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=2) {
//          analogWrite(boxThree, fadeValue); 
//          delay(30);
//        }  
//        delay(150); 
      }
    }
  }
  lastButtonState = LOW;
  lastButtonState = reading;
}

Hi, its hard to tell from your pic what is connected where. Are the Arduino and led strip on different power supplies? If so, have you connected the grounds?

Also that resistor on the base of the transistor. Is that 33K? Try something more like 1K to 5K.

Paul

Thanks Paul, the resistor is a 2.2k (Red, Red, Red, Gold)

I always find frizzing diagrams easier to gauge… no lighting weirdness, so here’s the circuit in that format. The LED represents the light box, and the battery, the 12V Power Adapter

nelsonmilum: the resistor is a 2.2k (Red,Red,Red, Gold)

Ah, sorry, it looks like orange orange orange in the pic. So the pulldown/up resistor on the switch is 1K?

The black wire connecting the 5V ground to the 12V ground on the far right of the breadboard on your diagram is what I can't see in your pic.

What happens if you disconnect the Arduino digital output and connect the 2K2 direct to 5V?

With the 2K2 connected to 5V I continue to get no life from the lights.

** Edit

Also, the resistor on the switch is 10K Pulldown.

I've tried the circuit with a different FET, just in case the one I had was a dud, with still no change. I've looked through my spare parts bin and the only other transistors I have are the MOSFETs that came with the Arduino Starter Kit (IRF 520) (7-10A) and a bunch of transistors that handle 150mA to 600mA collector current So I don't think I have much room for experimentation. The MOSFETs don't work either though.

I also moved the button to Pin 8 and the Lights to pin 9 with no change

And you have definitely connected the grounds. So the transistor is not switching on. Disconnect the leds and connect your meter in place of them on voltage (20V) range. What’s the reading with the 2K2 at 0V and 5V? Do you have another transistor?

Just read your edit.

To be precise, the tip31a is a bipolar junction transistor (bjt) not a field effect transistor (fet). You use them slightly differently, but either of them should work at least partially in your circuit, I would have thought.

Be careful to check the data sheets when trying other transistors. They don't all have their bases, collectors and emitters (in the case of bjt) or gates, sources and drains (in case of fets) in the same order.

I double checked the data sheets and made sure that I have the pins in the right order when connecting. Still no change. Ive tried with the TIP31C, a TIP41 that I had in the back of a drawer, and the IRF520 MOSFET (all of which state to handle 5+ Amps) Sadly no change despite double checking the pins. I was really hoping it was going to be that simple, since this is my first project without a step-by-step guide accompanying it!

Anyways, out of curiosity I tested with my multimeter with each of the Transistors to see if there are similar or different readings.

with the 2K2 at LOW the read is 0, and the same at HIGH. Sometimes it would spike a pit between .02 and .07 but I'm not sure it that's an artifact or something actually happening. It seems strange to me that all of my Transistors would do the same thing, so I installed a different resistor (2K) No change.

I'm also pretty sure that the Arduino is working okay physically, because I can hook up a simple PWM LED & Button to the same pins without issue.

Well, I found the issue. It turns out that the ground and power rails on my breadboard have a gap in them that I didn’t notice. I guess that teaches me to look for simple answers before I start leaping to more complicated ones. I should have looked closer than I did after the suggestion from PaulRB to make sure I was grounded.

Ah, one of the classic breadboard errors. You are not the first and won't be the last to make that one!