WS2811 RGB LED

Hi,
I Have a strip of 50 RGB LED type WS2811 and i want to know if can i control only one by one by lighting theme with only tow color RED OR Green on demande using serial port with arduino mega (library FastLed) and External c# programme. I do that with a normal RGB Leds without problème

Thank you for your Help

Excuse my poor English

Not too sure what you are asking, but I think the answer is no. The WS2811 normally controls three LEDs at a time with the same colour.

I think the answer is yes.
For every change, your code will have to send out 150 bytes, 3 per each WS2811.
If you change the values for One LED, you have to send all 150 bytes again so the others keep the same value they had.
So you could have an array of 150 bytes, manipulate as needed, and then send them out.
Not sure how you tell the Adafruit Neopixel code or the Fastled.h code how you would do that.

I suspect that, given the strip is 50 LEDs, which is not divisible by 3, that this could be a 5V strip or string where there is one chip per led and individual LEDs can be controlled, as opposed to a 12V strip where LEDs can only be controlled in groups of 3 because there is one chip for every 3 leds. I also found the OP very unclear.

@cmsdesigner: Please post a link to your WS2811 strip.

thank all of you for your answers
I reformulate my question or my problem,
I want to control a strip of rgb led individually addressable as this type of led

I want to make a matrix of 11 columns and 6 rows and i will scan a barcode that will give me the position of the led and I must light on this led with red or green according to a specific situation.

Ive made a test with normal RGB LED without problem but i will be limited by arduino pins that's what pushed me to think about the solution of RGB Strip led ws2811.

I also thought to Shift register 74HC595N there too I wonder if it's possible to control leds individually

Thank you so much for your help

I want to make a matrix of 11 columns and 6 rows and i will scan a barcode that will give me the position of the led and I must light on this led with red or green according to a specific situation.

OK that sounds perfectly feasible. It sounds like a stock location project, we have had a few of these in the past.

What you have to do is to translate your bar code value into an LED position number. This is best done with an array, where the index of the array represents the LED number on your strip and the contents of each array element is the bar code number for that LED number.

Then you get your bar code number and search through each array element using a for loop for a match between your bar code number and the contents of the array. Where you find a match that is the LED number you use in the set LED colour call of your chosen library. The colour you set it to will be either red or green depending on the other circumstances which I assume would either be in stock or out of stock.

I also thought to Shift register 74HC595N there too I wonder if it's possible to control leds individually

Yes you can and the soloution above would be needed so their is not much difference in the software.

if can i control only one by one by lighting theme with only tow color RED OR Green

  • Install the library Adafruit NeoPixel
  • See the example Sketch "simple"

to set one pixel you need two lines of code:

    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // Here we're using a moderately bright green color:
    pixels.setPixelColor(i, pixels.Color(0, 150, 0));
    pixels.show();   // Send the updated pixel colors to the hardware.

Where i is the index/number of the LED you want to address.
The second parameter - are the RGB colors.

So if you have already code to translate from your barcode to one specific LED you could easily iterate through all your LEDs - switch on the one in the desired color and switch off all the rest.

untested based on the "simple" example

void onlyOnePixel(uint8_t index, uint32_t color)
{
  for (uint8_t i = 0; i < NUMPIXELS; i++) { // For each pixel...
    if (i == index)
      pixels.setPixelColor(i, color);              // switch on in the desired color
    else
      pixels.setPixelColor(i, 0);                                    // switch off other LEDs
  }
  pixels.show();   // Send the updated pixel colors to the hardware.
}

call could be something like:

  byte targetLed;
  targetLed = 10;  // your exisiting program logic
  onlyOnePixel(targetLed, pixels.Color(150, 0, 0));

I think the ws2811 solution will be the easiest, but if you are looking for alternative solutions, you could make a charlieplexed matrix of red-green LEDs. This would require 12 Arduino pins, 12 resistors, but no other chips or components.

Assuming of course that you only want a few LEDs illuminated at once. :roll_eyes:

Yes indeed. From the OP's brief description, it sounds like only one led at once.

Thank you all for your great help. and I will test all your suggestions and I will come back to you in case of trouble or success.
And once again thank you very much for your help

Hi everyone i just got my WS2811 led strip. and i want to use the code of noiasca but without success the leds are still light on the same I used the example proposed by fastled, also without success. below my connection to the led strip and arduino

you will need a power supply for your RGB LEDs.

Powering 50 LEDs by the 5V of the mega will not work.

We can’t tell much from that picture, but I see no capacitor. Here is the OP’s picture

Have you tried the simple example code? Have you selected the right LED type?

Please post all the code you that you use in code tags please.

Add a 10k resistor from the Arduino pin that is producing the data stream, to ground. The LEDs should stay off until the code effectively programs them otherwise.

Hi noiasca i used your code and it works like a charm. the problem was the wrong way for the data wire i used the other side of led strip and surprise it works, for the power i used only arduino power but i will use extenal power be cause i will use 198 leds in my real project.

Once again thank you very much to all of you and to the arduino community.

hi Grumpy_Mike thanks for your reply here is the code used

#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUMPIXELS 50

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
 
  pixels.begin();
  pixels.show(); // Initialize all pixels to 'off'
}

void onlyOnePixel(uint8_t index, uint32_t color)
{
  for (uint8_t i = 0; i < NUMPIXELS; i++) { // For each pixel...
    if (i == index)
      pixels.setPixelColor(i, color);              // switch on in the desired color
    else
      pixels.setPixelColor(i, 0);                                    // switch off other LEDs
  }
  pixels.show();   // Send the updated pixel colors to the hardware.
}

void loop() {

  byte targetLed1;
  byte targetLed2;
  targetLed1 = 49;  // your exisiting program logic
  onlyOnePixel(targetLed1, pixels.Color(150, 0, 0)); // green

  targetLed2 = 40;  // your exisiting program logic
  onlyOnePixel(targetLed2, pixels.Color(0, 150, 0)); // red
}

fine that you share your code which worked for you. Hopefully it is of use for others.
Now you can go back in the thread and give Karma for answers which helped you to solve your problem.