Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

How to wire Rugged Metal Pushbutton 6V RGB? (PRODUCT ID: 342
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How to wire Rugged Metal Pushbutton 6V RGB? (PRODUCT ID: 342

by cverd on Tue Feb 05, 2019 7:34 pm

Hi, I am using a 3.3V Particle Electron microcontroller (similar to Arduino) and want to use it to drive the LED of the Rugged Metal Pushbutton 6V RGB. I have looked at the datasheet and item description and I am still a bit confused about how to drive it.

So I assume I connect the R G and B pins directly to 3 GPIO pins and the C+ to my 3.3V bus? If so, what do the + and - above the R and G pins on the datasheet indicate? Also, do I have to do anything with my circuit to pull the RGB to ground, or is that simply what a PWM pulse naturally does?

Thank you very much!

cverd
 
Posts: 4
Joined: Tue Nov 27, 2018 7:07 pm

Re: How to wire Rugged Metal Pushbutton 6V RGB? (PRODUCT ID:

by adafruit_support_mike on Wed Feb 06, 2019 2:11 am

cverd wrote:So I assume I connect the R G and B pins directly to 3 GPIO pins and the C+ to my 3.3V bus?

Kind of. You might also want to add resistors between the R/G/B pins and your microcontroller.

Connecting the anodes directly to the microcontroller pins will put the LEDs in parallel (they all get current from the same built-in resistor), and different LED colors have difrerent forward voltages. Blue LEDs need about 3V to light up, green ones need about 2.1V, and red ones need about 1.7V.

If the LEDs are connected directly to the microcontroller pins, turning on the red one will pull the voltage across all three to 1.7V, which is too low for the green and blue ones to light up. If either are already lit, turning on the red LED will shut them off.

If you only want to do single colors, that might be okay. If you want to mix colors with PWM, you'll need to add resistors to at least the green and blue LEDs so they don't choke off the blue one.

cverd wrote:If so, what do the + and - above the R and G pins on the datasheet indicate?

The anode is on the side with the +. The pins on the - side are only cathodes.

cverd wrote:Also, do I have to do anything with my circuit to pull the RGB to ground, or is that simply what a PWM pulse naturally does?

PWM values are usually measured in terms of the time the voltage stays high, but the LEDs will light when the voltage is low. Assuming you have 255 PWM values, analogWrite(0) will turn the LEDs on full blast, and analogWrite(255) will shut them off.

adafruit_support_mike
 
Posts: 61206
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to wire Rugged Metal Pushbutton 6V RGB? (PRODUCT ID:

by cverd on Thu Feb 07, 2019 2:45 pm

@adafruit_support_mike Thank you for the detailed response. Can you please tell me how I determine the resistor values? Wouldnt I need to know what the value of the internal resistance is?

Thanks!

cverd
 
Posts: 4
Joined: Tue Nov 27, 2018 7:07 pm

Re: How to wire Rugged Metal Pushbutton 6V RGB? (PRODUCT ID:

by adafruit_support_mike on Fri Feb 08, 2019 2:31 am

With the switch rated for a 6V, that probably means the current through the red LED will be about at its maximum limit (around 30mA) when the supply is 6V.

A red LED's operating voltage is about 1.7V, so the voltage across the resistor would be around 4.3V. Ohm's Law says V=IR, or R=V/I. 4.3V divided by 30mA is 143-1/3 Ohms, and the nearest standard value to that is 150 Ohms.

So the built-in resistor is probably around 150 Ohms.

For the blue LED to light while the red and green ones are also lit, the voltage at the positive end of all three LEDs needs to be higher than about 3V. Assuming you use a 5V power supply the voltage across the internal resistor would be around 2V when the blue LED is lit, and that voltage across a 150-Ohm resistor will give you 2V/150R=13.3mA.

That means you have a total of 13.3mA to play with when all three LEDs are lit. Splitting it equally, that would give each LED about 4.5mA.

We use about 3mA for indicator LEDs on our microcontroller boards, so 4.5mA is enough to make the LEDs reasonably bright. We probably don't want to lower that value though, so for simplicity, let's just calculate resistors for the red and green LEDs:

The blue LED operates at about 3V and the red LED operates at about 1.7V. The difference between them is 1.3V, so we want a resistor that hits 1.3V when 4.5mA of current flows through it. 1.3V/4.5mA=289 Ohms. The nearest standard value is 270 Ohms.

The green LED operates at about 2.1V, which is about 0.9V lower than the blue LED. We want a resistor which produces 0.9V when 4.5mA flows through it, or 0.9V/4.5mA=200 Ohms. The nearest standard value would be 220 Ohms.

adafruit_support_mike
 
Posts: 61206
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.