prevent RGB led from lighting up on boot up

Status
Not open for further replies.

virtualdave

Well-known member
Hi all,
Need some circuitry advice. I'm using a PicoBuck LED driver to drive a 3W RGB led. PWM output via pins 21,22,& 23 on a T3.2. LED is powered by external 12V source with shared ground with the teensy (separate source for powering the teensy and other elements on the PCB). PWM control works as expected. The problem is on boot up of the teensy. For a second or so all three LEDs are powered up full until the teensy finishes its boot up sequence, at which time all PWM pins are set to LOW/0 (and LEDs turn off).

The question: am I missing something in my circuitry or sketch to prevent this light flash at startup? My physical connection is:

pin21 >> control pin #1 on PicoBuck >> red led
pin22 >> control pin #2 on PicoBuck >> green led
pin23 >> control pin #3 on PicoBuck >> blue led

Here's a sample sketch that is similar to what I am doing in my main sketch that reproduces the problem for me:

Code:
// +++++++++++++++++++++ LED variables +++++++++++++++++++++ //
const byte RED_PIN = 21;
const byte GRN_PIN = 22;
const byte BLU_PIN = 23;

int res = 10; // PWM Bit Resolution 0 >> 1023
int FREQ = 500; // PWM Base Frequency 500Hz good for picobuck driver


void setup() {

  // set pin modes & PWM variables
  pinMode(RED_PIN, OUTPUT);
  pinMode(GRN_PIN, OUTPUT);
  pinMode(BLU_PIN, OUTPUT);
  digitalWrite(RED_PIN, 0);
  digitalWrite(GRN_PIN, 0);
  digitalWrite(BLU_PIN, 0);

  analogWriteResolution(res);
  analogWriteFrequency(RED_PIN, FREQ);
  analogWriteFrequency(GRN_PIN, FREQ);
  analogWriteFrequency(BLU_PIN, FREQ);

  analogWrite(RED_PIN, 1023);
  delay(2000);
  analogWrite(RED_PIN, 0);

  analogWrite(GRN_PIN, 1023);
  delay(2000);
  analogWrite(GRN_PIN, 0); 

  analogWrite(BLU_PIN, 1023);
  delay(2000);
  analogWrite(BLU_PIN, 0);
}

void loop() {
  // things & such
}

Thanks in advance for any advice. Hoping this might be solvable via software since circuit boards are already printed, but open to any suggestions.

Thanks,
David
 
Interesting, try this see what happens.
Code:
// +++++++++++++++++++++ LED variables +++++++++++++++++++++ //
const byte RED_PIN = 21;
const byte GRN_PIN = 22;
const byte BLU_PIN = 23;

int res = 10; // PWM Bit Resolution 0 >> 1023
int FREQ = 500; // PWM Base Frequency 500Hz good for picobuck driver


void setup() {

  // set pin modes & PWM variables
  pinMode(RED_PIN, OUTPUT);
  pinMode(GRN_PIN, OUTPUT);
  pinMode(BLU_PIN, OUTPUT);

  analogWriteResolution(res);
  analogWriteFrequency(RED_PIN, FREQ);
  analogWriteFrequency(GRN_PIN, FREQ);
  analogWriteFrequency(BLU_PIN, FREQ);

  analogWrite(RED_PIN, 0);
  analogWrite(GRN_PIN, 0); 
  analogWrite(BLU_PIN, 0);
}

void loop() {
  // things & such
}
 
Try adding a pull-down resistor between the respective PWM pins, down to GND. 1k or so should be fine.
 
Hi all,
… The problem is on boot up of the teensy. For a second or so all three LEDs are powered up full until the teensy finishes its boot up sequence...

Something odd as the Teensy enters setup approx. 300 or 400 ms after getting powered, depending on the version of TeensyDuino, and is ready to control its I/O. It will be right at 300 ms in versions 1.42 and newer.

No doubt there may be helpful tips on the best way to control that and get the Teensy setup properly - but if it is persisting much beyond 300 or 400 ms there may be something in the outside elements as part of the issue.

Taking the I/O right to the desired analog state and not setting as OUTPUT first seems the right direction as the two are mutually exclusive, and the influence of an external resistor when the Teensy is not providing the needed control signal seems important.

The undriven high impedance state of the pins in that time before setup() might allow outside circuits to behave oddly - proper actions and order in setup() should have that resolved in a ms or so. But that total time is less than half or a third of a second not a 'second or so'.
 
Yup, looks like the CTRL pin on the AL8805 chips on that PicoBuck board default to on, if not driven.

The datasheet says the CTRL pin's input impedance is 50K. So Cosford's suggestion for 1K resistor is pretty good. Much higher than 1K risks not getting the CTRL pin below 0.4V. If you do try higher, to test turn off Auto mode in Teensy Loader and press the button on Teensy. That will leave Teensy in bootloader mode, where it's not running your program. Then you can easily measure the actual voltage at the control input, which Teensy isn't driving the pin. It needs to be 0.4V or less to make sure the LEDs don't turn on by default.
 
Thank you all for help with this. I was afraid it was a mechanical/electrical fix, but it sounds like my issue is addressable, which is great. I'll add some resistors later today and report back.
 
Perfect! Pulldown with a 1k resistor on each channel did the trick. My PCB isn't as clean, but it's functional!
Thank you all again for your guidance.
 
Status
Not open for further replies.
Back
Top