Go Down

Topic: WS2811 led strip (Read 5566 times) previous topic - next topic

tchinou1

Hi guys, I am trying to make a led strip with 5mm RGB leds and WS2811 chips. I don't really know were to start. I have build this schematic:

But now what library should I use ? If anybody could give me some hint for where to start I would be very nice !

Thanks

larryd

If it is not too late, buy WS2812B leds and use them.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

DrAzzy

Any library for WS2812/2811 should work.

I've used FastLED, but there are many others, and I don't claim that FastLED is better than any others.
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

tchinou1

LarryD, the strip will be use to light up a plexiglass plate, the led strip that I have test (flat led) doesn't diffuse the light as well a 5mm leds. If I use the FastLED, where do I start ? My goal is to make a Vu meter with this led strip.

lumbergnz

Some example libs :
https://github.com/FastLED/FastLED/wiki/Basic-usage
https://github.com/adafruit/Adafruit_NeoPixel
https://github.com/pololu/pololu-led-strip-avr

A Couple Of Tutorials :
https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library
http://www.instructables.com/id/Bitbanging-step-by-step-Arduino-control-of-WS2811-/

One of my projects:
http://y2u.be/GH7Zw5aINeU

Depending on the length of your strip you should run a external power supply to it. You may run into some lines you might need to comment out in libarys if you have ws2811 or Need to include the WS2811. The difference been the 2811 has 4 wire hookup ( GND VCC CLK DATA ) and the 2812 has 3 wire hookup (GND VCC DATA) there is still a lot of WS2811 stuff out there just google a few projects but like LarryD said WS2812 is a lot better. hope this sheds a bit of light on the subject for you.

tchinou1

Thanks guys, I was able to make it work on an arduino uno, but when I upload the same code on an arduino mega there is a bug. Maybe you could give me and idea of the problem. In the serial monitor, the audio value that I am reading is very slow, like if there was a delay...
Here is the code:

Quote
#include "FastLED.h"
#include <EEPROM.h>

#define NUM_LEDS 3
#define DATA_PIN 12
CRGB leds[NUM_LEDS];


int R[10] = {0, 0, 0, 0, 0, 255, 255, 255, 255, 255};
int G[10] = {0, 255, 255, 255, 255, 255, 255, 180, 50, 0};
int B[10] = {255, 180, 50, 0, 0, 0, 0, 0, 0, 0};


const int sensitivityPin = A2;  // Analog input pin that the potentiometer is attached to
const int audioPin = A0;        // Analog input pin that the audio channel is attached to
const int ledCount = 10;        // The number of LEDs in the bar graph

int audioValue;                 // Analog value read from audio channel
int maxAudioValue = 0;          // Maximum analog value read from audio channel
int sensitivityValue = 250;          
int ledLevel;                   // Value to map to the output LEDs


void setup()
{
  Serial.begin(9600);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);

}

void loop()
{
  int ledPins[]  = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 
 audioValue = analogRead(audioPin);
  Serial.println(audioValue);
  if (audioValue > maxAudioValue)
    maxAudioValue = audioValue;  

  ledLevel = map(audioValue, 0, 1023, 0, sensitivityValue/2);
  if (ledLevel > ledCount) {
    ledLevel = ledCount;
  }

  for (int thisLed = 0; thisLed < ledCount; thisLed++)
  {
    if (thisLed < ledLevel){
      leds[ledPins[thisLed]].setRGB(R[ledPins[thisLed]],G[ledPins[thisLed]],B[ledPins[thisLed]]);
      FastLED.show();
       delay(10);
    }
    else{
    leds[ledPins[thisLed]].setRGB(0,0,0);
   FastLED.show();
     delay(10);
    }
  }
  delay(1);        
}
  
  

  


PaulRB

#6
Jun 05, 2015, 08:07 pm Last Edit: Jun 05, 2015, 08:08 pm by PaulRB
Hi,

Can you amend your post above please and put the sketch in code tags instead of quote tags. As you can see, the quote tags have not saved you sketch from becoming partly garbled. You may need to re-post the sketch from the IDE.

Also can you post a schematic please so we can see what circuit is feeding the analog input.

Paul

tchinou1

#7
Jun 06, 2015, 02:41 am Last Edit: Jun 07, 2015, 03:41 am by tchinou1
Sorry my bad. My schematic is the same that the picture I posted in my first message.

Thanks !

Code: [Select]
#include "FastLED.h"

#define NUM_LEDS 3
#define DATA_PIN 12
CRGB leds[NUM_LEDS];


int R[10] = {0, 0, 0, 0, 0, 255, 255, 255, 255, 255};
int G[10] = {0, 255, 255, 255, 255, 255, 255, 180, 50, 0};
int B[10] = {255, 180, 50, 0, 0, 0, 0, 0, 0, 0};


const int audioPin = A0;        // Analog input pin that the audio channel is attached to
const int ledCount = 10;        // The number of LEDs in the bar graph

int audioValue;                 // Analog value read from audio channel
int sensitivityValue = 250;         
int ledLevel;                   // Value to map to the output LEDs


void setup()
{
  Serial.begin(9600);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);

}

void loop()
{
  int ledPins[]  = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 
 audioValue = analogRead(audioPin);
  Serial.println(audioValue);

  ledLevel = map(audioValue, 0, 1023, 0, sensitivityValue/2);
  if (ledLevel > ledCount) {
    ledLevel = ledCount;
  }

  for (int thisLed = 0; thisLed < ledCount; thisLed++)
  {
    if (thisLed < ledLevel){
      leds[ledPins[thisLed]].setRGB(R[ledPins[thisLed]],G[ledPins[thisLed]],B[ledPins[thisLed]]);
      FastLED.show();
       delay(10);
    }
    else{
    leds[ledPins[thisLed]].setRGB(0,0,0);
   FastLED.show();
     delay(10);
    }
  }
  delay(1);       
}
 

Grumpy_Mike

#8
Jun 06, 2015, 06:06 am Last Edit: Jun 06, 2015, 06:07 am by Grumpy_Mike
So where in that first schematic is the analogue input? where is the Arduino?

The Mega has a diffrent arrangement of timers and different pins for the SPI interface. How have you wired it up. That schematic shows no arduino so we don't know what pins you have used.

Why do you include the EEPROM libiary whe. YOu do not use it?

tchinou1

I have use the pin 12 as data pin, the 5v, the gnd and the audio pin is A0. For the EEPROM library this is a mistake, I isolated a part an other program were I was using EEPROM.

Grumpy_Mike

So you go to the doctors and he says "Open your mouth and say Arhh" and you say. " here is my urine sample"

Is that what you do?

Then why do you do this here?

Paul__B

Sometimes the pee sample gives more information. :smiley-lol:

Grumpy_Mike

Sometimes the pee sample gives more information. :smiley-lol:

Yes especially when you have a sore throat.   :o   

Paul__B

Yes especially when you have a sore throat.   :o  
Funny you should say that.

In diagnosing a sore throat, actually examining the throat generally plays a minimal part; the history is much more important and generally indicates the treatment.

tchinou1

WTF guys... ? Not sure to understand the metaphor...

Go Up