Go Down

Topic: RGB LED Common A or C? (Read 1 time) previous topic - next topic

Xeyow

Apr 01, 2015, 04:30 pm Last Edit: Apr 01, 2015, 04:33 pm by Xeyow
Hello guys. I bought some RGB leds like this one:


And i don`t know if they are common anode or cathode.

I have some 560ohms resistors. I wired them to the arduino and uploaded this sketch rgb led but it doesn`t work. I connected the longest pin from the led even to the +5 and nothing happened. So i connected it to the GND.

The code says that i will see 5-6 colors. But my leds are all blinking BLUE. The other colors do not work. I think, after wiring the longest pin to GND and blue came up, these leds are COMMON CATHODE. The sketch from adafruit is made for common cathode, like mines. But why the other colos do not work?

This is my setup:

let`s say the pins (like in picture) have a number from left to right: 1(R) 2(G) 3(GND) 4(B)

1 is wired to PIN 9 via a 560ohms resistor //blue
2 is wired to PIN 10 via a 560ohms resistor //green
3 is wired to GND
4 is wired to PIN 11 via a 560ohms resistor //red

Wiring it like this only the color BLUE shows up every 1 second.

What`s wrong?

Xeyow

setColor(0, 255, 0) should show me GREEN, but my led is turning RED.

setColor(255, 0, 0) should show me BLUE, but my led is OFF

setColor(0, 0, 225) should show me BLUE, but my led is OFF. If i leave only the BLUE pin it works. but if i put them all 3, it doesn`t work anymore.

What is wrong?

Xeyow

i think i found what leds are these: adafruit neopixels


The pins are not B G GND or 5+ and R. In fact they are: DATA IN | +5 | GND | DATA OUT (flat side on the right)

How to i control them?

Grumpy_Mike

#3
Apr 01, 2015, 05:02 pm Last Edit: Apr 01, 2015, 05:03 pm by Grumpy_Mike
Quote
How to i control them?
If they are truly neopixels then use the library
https://learn.adafruit.com/adafruit-neopixel-uberguide

Note the red and green are swapped over in the data. So to light the green component write code as if it were the red component.

Xeyow

From what i read: GND goes to GND and +5 to +5 (wooow) and DATA IN to pin 6... But there`s nothing about the data out pin...

Xeyow

I figured it out. Data out is for the next leds data in. And now i found out the which paramater is what color. TY

Grumpy_Mike

Quote
But there`s nothing about the data out pin...
It goes to the data in pin of the next LED. If there is not a next LED then don't wire it anywhere.

You sure this is what you have got? They are designed to be implemented in a long chain of many LEDs.

DrAzzy

I'm confused - you say it's a neopixel, but you also say you got it to turn on blue while trying to control it like a normal RGB led.

That won't happen if it's a neopixel (also, if it's a neopixel, and you accidentally connected power backwards, it may well be ruined - the WS2811 is notorious for dying instantly if hooked up backwards) - unless you sent it the right code, it wouldn't do anything.


ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Grumpy_Mike

#8
Apr 01, 2015, 10:30 pm Last Edit: Apr 01, 2015, 10:30 pm by Grumpy_Mike
Quote
you say it's a neopixel, but you also say you got it to turn on blue
I have found that blue is the default turn on colour before any data is sent with the large neopixel LEDs.

Paul__B

I have found that blue is the default turn on colour before any data is sent with the large neopixel LEDs.
I suspect that can be fixed with a 22k pull-up resistor (or pull-down; whatever the idle state is supposed to be).

It is interpreting random noise on a floating input, as a command.

Grumpy_Mike

Quote
It is interpreting random noise on a floating input, as a command.
No.
The timing requirement are quite strict and if it were random then they all ( 16 of them ) would not be on in exactly the same colour.

Go Up