Addressable RGB LED's

I am trying to use individual Addressable RGB LED's for a class project.

I have used Adafruit neopixels with great success but am struggling to get the individual Addressable RGB LED's to work. They are glowing very brightly in white.

I have used individual RGB LED's with no problem as well.

I have looked on various sites for example code with no success.

Any support or pointers gladly received.

but am struggling to get the individual Addressable RGB LED's to work.

Read the rules please on posting questions.

Supply a link to the part you are using, a schematic of how you have wired it up and post the code you are trying to make work.

Lets try and give the required detail:

I am using the following Addressable RGB Leds

The code is as follows and is taken from an example online I have left the name of the originator with thanks and hope this is acceptable - I have edited it to remove a tone generator part as I don't want that:

// Addressable RGB LED Demo Sketch
// Dain Unicorn August 25, 2014
// If this code is of use to you, please make use of it, and let me know what your doing with it.
// This code is original to me, with references from the Arduino Example for generating Tones.
// A Special Thank you to the folks at Adafruit for their fine NeoPixel library that makes this sketch possible.
// And show some love to the folks at SparkFun where I got these 8mm Addressable RGB LEDs.

#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip = Adafruit_NeoPixel(5, 6, NEO_RGB + NEO_KHZ800);

// The three parameters passed here are: Number of LEDs, Arduino Pin, Config information.
// For more help on the Config details, see the Example sketch provided with the Adafruit NeoPixel library.

void setup() {
// When power is first applied to the LEDs they will show a color based on the voltage being sent to them. For the 5VDC
// power from an Arduino Uno, it is a moderate blue color. This is a normal function of the WS2812 chip when it doesn't have
// data to use.

strip.begin();
strip.show();

// We initalize the NeoPixel Library here, by starting it and then sending the first strip.show() command.
// Next we will tell all of the LEDs to switch off before continuing.

pcr(); // PixelColorsReset function, it turns all of the LEDs completely off.
// This custom function can be found at the bottom of this Sketch.

// We play the melody once during setup with all 5 LEDs lighting up in the color for the tone being played.

strip.setPixelColor(0, 0, 0, 0);
strip.setPixelColor(1, 220, 20, 60);
strip.setPixelColor(2, 220, 20, 60);
strip.setPixelColor(3, 220, 20, 60);
strip.setPixelColor(4, 220, 20, 60);
strip.show();

pcr();
// We don't need a delay at the end here, as the next iteration of the loop delays at the start.

}

void loop() {

// The melody has played in the setup loop, so we will play it again and again getting faster every time until its too fast.

notes(); // this custom function plays the tones with only one LED lighting up per tone.
// The function itself is at the bottom of this Sketch.

// Once the wait varible is less than 40 we will play the melody one last time, with all the LEDs lit and at a set duration.
// Then increment the ending varible so that the Sketch goes dark and silent until reset.
delay(2500);
strip.setPixelColor(0, 220, 20, 60);
strip.setPixelColor(1, 220, 20, 60);
strip.setPixelColor(2, 220, 20, 60);
strip.setPixelColor(3, 220, 20, 60);
strip.setPixelColor(4, 220, 20, 60);
strip.show();

pcr();

}

void pcr() {
// This function turns all the LEDs off, reseting them.
// I wrote this function to overcome the only real shortcomming I saw in the Adafruit Library, a reset command.
strip.setPixelColor(0, 0, 0, 0);
strip.setPixelColor(1, 0, 0, 0);
strip.setPixelColor(2, 0, 0, 0);
strip.setPixelColor(3, 0, 0, 0);
strip.setPixelColor(4, 0, 0, 0);
strip.show();
return;
}

void notes() {

// This function plays the melody, lighting up only the LED that corresponds to the tone played.
pcr();
strip.setPixelColor(0, 100, 0, 0);
strip.setPixelColor(1, 0, 0, 0);
strip.setPixelColor(2, 0, 0, 0);
strip.setPixelColor(3, 0, 0, 0);
strip.setPixelColor(4, 0, 0, 0);
strip.show();

strip.setPixelColor(0, 0, 0, 0);
strip.setPixelColor(1, 170, 80, 10);
strip.setPixelColor(2, 0, 0, 0);
strip.setPixelColor(3, 0, 0, 0);
strip.setPixelColor(4, 0, 0, 0);
strip.show();

pcr();
return;

}

When I load this the LEDs come on very bright and white with no colour change. If you have any tips that would be great.

I have tried resistors in line but this has not helped.

Thanks I hope this helps and meets your site rules. I am seeking to develop a code and layout for use in the classroom.

Right, first things first.

Go and read the instructions, then go back and modify your post to mark up the code as such so we can examine it conveniently and accurately.

The data sheet outlines the data timing required to control these LEDs. I did not see any mentione that it is compatible with the LEDs used in the Neopixels, which are using WS2812b.

These LEDs use polar RZ encoding. These are not compatable with the Ardino driver.

"INDEX" is not the same as "index".

You left out the #includes you are using.

Yes as others have said those LEDs are not the same as the Adafruit Neopixels so the neopixel library will not work.

You will need at least a hardware interface to be able to get those waveforms from an Arduino to drive that sort of LED.

Many thanks, I am still learning and will stick with the standard RGB's that do work well.

Grumpy_Mike:
You will need at least a hardware interface to be able to get those waveforms from an Arduino to drive that sort of LED.

Out of interest, do you think a 5~10K pull-up and pull-down on an Arduino output would be enough? The output would be normally high-z/tri-state, and could be pulsed high or low to send 0 or 1. I wonder what data rate could be achieved. The data sheet does not seem to indicate anything about the length of data pulses, only that latching occurrs 3ms after the last data bits.

Yes that would give you the signals you want, although I would go for a 510R up and down if it was me.

I have been trialling this a little more and have Red and blue colour, as well as the bright white the seems the default.

These results seem to be random and are not repeatable. It is more of a curiousity at the moment. I will feedback results when I get a chance.

These results seem to be random and are not repeatable.

If you are using that code you posted then yes these will be random results. Surprising there are any results at all.

It is a bit like having a car that runs off petrol ( gas ) and then filling it up with paraffin and saying it dosn't run very well.

Running this with a 10k pot on the 5V supply now.

Turning the pot turns the LED's on and off and each time I turn them on the colour changes. Quite cool in its own way.

I have tried to load a photo but it exceeds the size allowed.

#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip = Adafruit_NeoPixel(5, 10, NEO_RGB + NEO_KHZ800);
void setup() {

  strip.begin();
  strip.show();
    
  pcr(); // PixelColorsReset function, it turns all of the LEDs completely off.
  strip.setPixelColor(0, 255, 0, 0);
  strip.setPixelColor(1, 255, 69, 0);
  strip.setPixelColor(2, 255, 255, 0);
  strip.setPixelColor(3, 0, 255, 0);
  strip.setPixelColor(4, 0, 0, 255);
  strip.show();
  pcr();
}
void loop() {
  delay(500);
  strip.setPixelColor(0, 0, 0, 255);
  strip.setPixelColor(1, 255, 69, 0);
  strip.setPixelColor(2, 255, 255, 0);
  strip.setPixelColor(3, 0, 255, 0);
  strip.setPixelColor(4, 0, 0, 255);
      strip.show();
      pcr();
    }
void pcr() {
  return;[code]

Running this with a 10k pot on the 5V supply now.

Where is the pot? Not that it matters anyway as it is futile.

I am not sure what you hope to prove but you might as well just stuff lines of code at random, sorry but engineering doesn't work like that. You have to read the specifications of the LED and then write code that will talk to it in a language it understands.

Not trying to prove anything. I have many trials on the go with Neopixels, standard RGB leds and these addressable RGB leds.

The later are the only ones that don't behave, hence my posting here in the hope to see what I was doing wrong.

Neopixels are fun for school as they catch the attention and give a way to bring interest. However I quite like the idea of getting pupils to design and build their own circuits so I wanted to use RGB leds to develop ideas. They are also cheaper than neopixels.

I have tried various approaches that I have used in other circuits to see what is going on. I have observed the interesting change of colour with the current set up. Thought it might interest others as well or someone may have a reason for this.

The later are the only ones that don't behave

Yes they DO behave, it is just that they are not Neopixels and so do not behave like neopixels, big surprise?

Thought it might interest others

Sorry no one should be faintly interested in what you are doing, it is so brainless. It sounds like you might be a teacher, can that be?

In which case what you should be doing is encouraging your students to do a little thinking and research, not throw things in a bag and shake them up.

Oh I do the standard things and other extension with them. I always trial things before looking for how I could use them with pupils.

I have picked up the wrong RGB leds and come here to find this out. No harm finding out a little more from this experiment first. Sorry if you don't see any value in it.

Here is a datasheet: ost4ml5b32a.pdf

A schematic shows that 2 outputs + 2 resistors are required. You will need to write or find code.

I'm guessing this transmission method allows better performance on long lines or in a noisy
environment. Pretty sure that's not a requirement for you.

I think Grumpy_Mike was trying to get you to acknowledge that every engineer licks a light socket
once in their lifetime - they just don't keep licking it and giggling in between.

@MSqDT, can you try this code?

// Experimental code for driving OST4ML5B32A addressable rgb leds
// PaulRB
// Nov 2015

#define LED_PIN 3
#define DELAY 50

void setup() {
  
}

void loop() {

  byte red = 0;
  byte blue = 0;
  byte green = 0;

  for (int i = 0; i < 256; i++) {
    red = i;
    blue = 255 - i;
    sendByte(green);
    sendByte(blue);
    sendByte(red);
    delay(10);
  }

  for (int i = 0; i < 256; i++) {
    red = 255 - i;
    green = i;
    sendByte(green);
    sendByte(blue);
    sendByte(red);
    delay(10);
  }

  for (int i = 0; i < 256; i++) {
    blue = i;
    green = 255 - i;
    sendByte(green);
    sendByte(blue);
    sendByte(red);
    delay(10);
  }

}

void sendByte(byte b) {

  for (int n = 7; n >= 0; n--) {
    digitalWrite(LED_PIN, bitRead(b, n));
    pinMode(LED_PIN, OUTPUT);
    delayMicroseconds(DELAY);
    pinMode(LED_PIN, INPUT);
    delayMicroseconds(DELAY);
  }

}

Adjust the LED_PIN to whichever you are using, and put 1K pullup and 1K pulldown resistors on that pin also. Describe what happens for us (assuming anything!)

@PaulRB

Trialled your code.

I got the LED's lighting up one after the other and repeating the effect after a short delay. The colour is close to white with no change. Linking to other replies I am interested and still licking this breadboard out of curiosity, but I have moved on with the main work.

I am now using some RGB LED's from cool components link below:
https://www.coolcomponents.co.uk/digital-rgb-addressable-led-5mm-through-hole-10-pack.html

These are WS2811 addressable RGB LEDs so as the helpful feedback pointed out to me will work with the Adafruit neopixel code.

I have breadboarded these and now produced a PCB to run them successfully. I now hope to use this to learn more about the coding of the RGB led's.