I'm trying to repurpose an RGB LED (pictured) and use an Arduino board I've just gotten to reprogram the lights. I'm very new to electronics engineering and I don't really know how to get started. How would I connect it to the Arduino? What kind of wire(s) would be best for soldering this to as well as connecting to the Arduino? Can this be programmed like any other LED?
Images: https://i.sstatic.net/u14Bd.jpg https://i.sstatic.net/2inQB.jpg
-
1that is not an RGB LED ... it is three separate LEDs ... Vdd would probably connect to positive voltage ... one of the other pins would connect to a resistor, which would connect to ground ... circuits are plentiful on the webjsotola– jsotola2020年12月06日 21:14:36 +00:00Commented Dec 6, 2020 at 21:14
2 Answers 2
Connect each of the 3 "L" wires to 3 separate digital IO pins of an arduino e.g. D8, D9, D10 via a resistor say 470 ohms but the value is not too critical. Connect VDD to the arduino +5v.
Use the arduino IDE write a sketch that configures pins 8 9 and 10 as outputs and then see what happens when you send these pins HIGH or LOW. Theres lots more you can do. Good luck.
-
1Ah that makes sense! I thought the VDD was for ground. Thanks so much!Tony S– Tony S2020年12月07日 00:49:51 +00:00Commented Dec 7, 2020 at 0:49
Given that the pin is labeled VDD, it's likely that the LEDs are common anode. (You'd hook the VDD pin to a positive voltage, and then connect the other pins to ground in order to light them.)
You really need to know the specs of the LEDs in order to calculate the size of the current limiting resistors.
Say your LEDs have a 1.2v forward voltage and can take 20 mA of current (.02 amps)
You'd use the formula R = (supply_voltage - LED_voltage)/current
so R = (5-1.2)/.020 = 190 Ω. Use the next higher value. (220 Ω for 20% resistors, the cheapest/most common kind you're likely to have access to.)
Try hooking each of the LEDs through a 220 Ω resistor to ground and seeing what you get. (Note that different colors of LEDs can have different forward voltages, so the forward voltage you use in the above calculation might be different for each LED.) If it barely lights, move down to the next-lower resistor value and try again. (150 Ω for 20% resistors.) If it's crazy-bright, or gets warm to the touch, use the next higher resistor value.
You'd then control the LEDs using PWM pins on your Arduino, and vary the duty cycle on 3 different output pins to vary the apparent brightness of the different colored LEDs. Note that since these LEDS appear to be common anode (Common power connection, and you switch the grounds to turn them on and off) the PWM values will be reversed. Setting a PWM pin to 0 will make that LED burn the brightest, and setting it to 255 will turn it off. That's because at 0, the pin is at 5V 0% of the time and connected to ground (which lights it) 100% of the time.