Go Down

Topic: Blinking SMD LEDs with a common anode. (Read 994 times) previous topic - next topic

Aaantonis

Oct 26, 2017, 01:48 am Last Edit: Oct 26, 2017, 01:59 am by Aaantonis
Dear all,

I m transplanting new server hardware into an old apple server case. I would like to repurpose a small pcb that has a number of blue smd leds in order to liven up the project aesthetically. These LEDs use a common anode, if I am saying that correctly. Meaning that if I apply 3.3v to a certain point in this pcb, then I just touch a ground to any led cathode, and it will light up.

I would like to create a small light show with those, nothing fancy. Some permanently on and some blinking.

If I were to solder a wire to each led cathode I would like to control, is there any way I could create the blink effect through the digital pins? I mean, I do understand that if I pull the pin low, the led will light up, but how do I turn it off?

Thank you very much. 

Aaantonis

This is the PCB, for illustration purposes. These leds through light pipes show up on the front of the server case.

PaulRB


PaulRB

Quote
if I apply 3.3v to a certain point in this pcb, then I just touch a ground to any led cathode, and it will light up
You should always use a series resistor. You risk damaging the LEDs if you don't.

You may be able to switch the LEDs of by making the Arduino pin high or changing it to an input. If you use high, remember that most Arduino are 5V, so choose an appropriate series resistor.

The PCB shown is complex and unknown. It's possible that if you connect 5V or 3.3V to the common anodes, current will follow to other parts of the PCB and overload the Arduino output.

Aaantonis

Thank you very much Paul for your reply. I applied 3.3v to a pin on that connector on the top right of that pcb where I suppose it goes through a resistor before it reaches the LED's anode.
But, you are absolutely right that I have absolutely no clue of how current travels through that PCB and how much load I m putting on the arduino pin. I guess I ll just take my chances.
For now I ll try both your recommendations with the "change to input" being the one that seems to be the simplest for setting up. I have rea though that using pinmode in the loop section is not recommended.

Thanks again.

PaulRB

#5
Oct 26, 2017, 08:39 pm Last Edit: Oct 26, 2017, 08:44 pm by PaulRB
Quote
using pinmode in the loop section is not recommended.
Nonsense. It's absolutely fine. You probably saw some newby getting told off for it because they had no clue what or why they were doing it. You have a good reason. You don't want to accidentally source current to an unknown circuit.

Aaantonis

#6
Oct 29, 2017, 02:36 pm Last Edit: Oct 29, 2017, 02:46 pm by Aaantonis
Thank you Paul for your suggestion. It does work.

I am attaching a small video and the little sketch just in case a noob like me bumps into this thread in the future.


Video

Code: [Select]

int ledPin = 13;

void setup() {
 
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, LOW);   // turn the LED on by pulling it to ground
  delay(1000);                       // wait for a second
  pinMode(ledPin, INPUT);    // Switch the pin's mode to Input, so it basically does nothing and the led turns off
  delay(1000);                       //wait for a second
  pinMode(ledPin, OUTPUT);  //  Switch back the pin's mode to output in order to pull it to ground and keep the loop running
  
}

Go Up