Arduino UNO / Nano + SK6812 (4020) RGB-Led

Hallo,

bin relativ neu was die Thematik mit Arduino/LEDs/Elektronik angeht, möchte aber dennoch mein Glück probieren ein paar LEDs zum leuchten zu bringen, mit dem Arduino Uno oder Nano v3.

Mein Problem:

Ich habe mir bei Amazon 8-Pin-Strimer(Lian-Li) für den PC (beleuchtete Kabel für den Grafikkartenstromanschluss) gekauft, welche aber leider von meinen Mainboard nicht unterstützt wird bzw. die Anschlüsse fehlen (JST 3-Pin und/oder Digital LED-Controller für 3-Pin (5V, DI, GND))


Laut google und einigen foren habe ich aber gesehen/gelesen, dass man mit den Arduino SK6812/WS2812b steuern kann, also habe ich mir ein paar Arduinos (1x Uno, 3x Nano), widerstände, Kondensatoren und ein Breadboard geholt und nach folgenden Schematiken (und weitere) versucht das ganze zum laufen zu bringen:

Test #1:

Test #2:

Leider funktioniert das ganze nicht wirklich. Es leuchten ein paar LEDs, aber nicht alle und diese werden ganz schnell ganz schnell heiss, was wohl darauf schließen lässt, dass der Fehler bei mir liegt :slight_smile: :o

Ich möchte nun lieber ein paar Profis fragen, bevor ich die LEDs kaputt mache :smiley:

PS.: Die verbauten LEDs scheinen SK6812 4020 Side LEDs zu sein.

Hier noch ein paar Bilder von den LED-Streifen/Stick:


Hoffe ihr könnt mir weiterhelfen.

Beim "Test1" bräuchte es den Widerstand in der Datenleitung nicht da Arduino und LED-Strippe vom gleichen Netzteil versorgt werden. Er schadet aber auch nicht. Die 5V würde ich aber nicht auf Vin geben sondern auf 5V. Dabei aber USB nicht anschließen.

Beim "Test2" braucht es unbedingt einen Widerstand in der Datenleitung weil Du 2 unabhängige Spannungsversorgungen hast.

Ich weiß nicht wieso die Teile bei Dir heiß werden, Außer Du hast sie nicht nach Zeichnung angeschlossen.

Grüße Uwe

Hallo Uwe, vielen Dank für Deine Antwort. Ich habe die 5V nun versuchsweise von Vin auf 5V(ohne angeschlossenen USB-Stecker) gelegt, leider auch ohne Erfolg.

Es ist alles wie gehabt: Wenn ich Strom anlege, leuchten ein paar LEDs (immer die selben), mit oder ohne Datenleitung und egal was für eine Stromquelle ich anschließe (5V vom PC-Netzteil, 5V-Adapter oder nur per USB -> Arduino)

LED1, LED5 & LED8 = Rot
LED & LED6 = Grün
LED2, LED4 & LED7 = Aus

Vielleicht nutze ich auch die falschen Libraries oder man spricht diese Art von LEDs anders an?

Anbei noch die Sketches, welche ich momentan Probiert habe (FastLED-Beispiele):

#include "FastLED.h"
#define DATA_PIN 3
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS 8
#define BRIGHTNESS 96
CRGB leds[NUM_LEDS];
void setup() {
  delay(3000); // initial delay of a few seconds is recommended
  FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); // initializes LED strip
  FastLED.setBrightness(BRIGHTNESS);// global brightness
}
// switches off all LEDs
void showProgramCleanUp(long delayTime) {
  for (int i = 0; i < NUM_LEDS; ++i) {
    leds[i] = CRGB::Black;
  }
  FastLED.show();
  delay(delayTime);
}
// switches on all LEDs. Each LED is shown in random color.
// numIterations: indicates how often LEDs are switched on in random colors
// delayTime: indicates for how long LEDs are switched on.
void showProgramRandom(int numIterations, long delayTime) {
  for (int iteration = 0; iteration < numIterations; ++iteration) {
    for (int i = 0; i < NUM_LEDS; ++i) {
      leds[i] = CHSV(random8(),255,255); // hue, saturation, value
    }
    FastLED.show();
    delay(delayTime);
  }
}
// Shifts a single pixel from the start of strip to the end.
// crgb: color of shifted pixel
// delayTime: indicates how long the pixel is shown on each LED
void showProgramShiftSinglePixel(CRGB crgb, long delayTime) {
  for (int i = 0; i < NUM_LEDS; ++i) {
    leds[i] = crgb;
    FastLED.show();
    delay(delayTime);
    leds[i] = CRGB::Black;
  }
}
// Shifts multiple pixel from the start of strip to the end. The color of each pixel is randomized.
// delayTime: indicates how long the pixels are shown on each LED
void showProgramShiftMultiPixel(long delayTime) {
  for (int i = 0; i < NUM_LEDS; ++i) { 
    for (int j = i; j > 0; --j) {
      leds[j] = leds[j-1];
    }
    CRGB newPixel = CHSV(random8(), 255, 255);
    leds[0] = newPixel;
    FastLED.show();
    delay(delayTime);
  }
}
// main program
void loop() {
  showProgramCleanUp(2500); // clean up
  showProgramRandom(100, 100); // show "random" program
  
  showProgramCleanUp(2500); // clean up
  showProgramRandom(10, 1000); // show "random" program
  
  showProgramCleanUp(2500); // clean up
  showProgramShiftSinglePixel(CRGB::Blue, 250); // show "shift single pixel program" with blue pixel
  
  showProgramCleanUp(2500); // clean up
  showProgramShiftSinglePixel(CRGB::Maroon, 100); // show "shift single pixel program" with maroon pixel
  
  showProgramCleanUp(2500); // clean up
  showProgramShiftMultiPixel(500); // show "shift multi pixel" program
  
  showProgramCleanUp(2500); // clean up
  showProgramShiftMultiPixel(50); // show "shift multi pixel" program
}

Sketch2:

#include <FastLED.h>

FASTLED_USING_NAMESPACE

// FastLED "100-lines-of-code" demo reel, showing just a few 
// of the kinds of animation patterns you can quickly and easily 
// compose using FastLED.  
//
// This example also shows one easy way to define multiple 
// animations patterns and have them automatically rotate.
//
// -Mark Kriegsman, December 2014

#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif

#define DATA_PIN    3
//#define CLK_PIN   4
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS    8
CRGB leds[NUM_LEDS];

#define BRIGHTNESS          96
#define FRAMES_PER_SECOND  120

void setup() {
  delay(3000); // 3 second delay for recovery
  
  // tell FastLED about the LED strip configuration
  FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  //FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);

  // set master brightness control
  FastLED.setBrightness(BRIGHTNESS);
}


// List of patterns to cycle through.  Each is defined as a separate function below.
typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm };

uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
  
void loop()
{
  // Call the current pattern function once, updating the 'leds' array
  gPatterns[gCurrentPatternNumber]();

  // send the 'leds' array out to the actual LED strip
  FastLED.show();  
  // insert a delay to keep the framerate modest
  FastLED.delay(1000/FRAMES_PER_SECOND); 

  // do some periodic updates
  EVERY_N_MILLISECONDS( 20 ) { gHue++; } // slowly cycle the "base color" through the rainbow
  EVERY_N_SECONDS( 10 ) { nextPattern(); } // change patterns periodically
}

#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))

void nextPattern()
{
  // add one to the current pattern number, and wrap around at the end
  gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}

void rainbow() 
{
  // FastLED's built-in rainbow generator
  fill_rainbow( leds, NUM_LEDS, gHue, 7);
}

void rainbowWithGlitter() 
{
  // built-in FastLED rainbow, plus some random sparkly glitter
  rainbow();
  addGlitter(80);
}

void addGlitter( fract8 chanceOfGlitter) 
{
  if( random8() < chanceOfGlitter) {
    leds[ random16(NUM_LEDS) ] += CRGB::White;
  }
}

void confetti() 
{
  // random colored speckles that blink in and fade smoothly
  fadeToBlackBy( leds, NUM_LEDS, 10);
  int pos = random16(NUM_LEDS);
  leds[pos] += CHSV( gHue + random8(64), 200, 255);
}

void sinelon()
{
  // a colored dot sweeping back and forth, with fading trails
  fadeToBlackBy( leds, NUM_LEDS, 20);
  int pos = beatsin16( 13, 0, NUM_LEDS-1 );
  leds[pos] += CHSV( gHue, 255, 192);
}

void bpm()
{
  // colored stripes pulsing at a defined Beats-Per-Minute (BPM)
  uint8_t BeatsPerMinute = 62;
  CRGBPalette16 palette = PartyColors_p;
  uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
  for( int i = 0; i < NUM_LEDS; i++) { //9948
    leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
  }
}

void juggle() {
  // eight colored dots, weaving in and out of sync with each other
  fadeToBlackBy( leds, NUM_LEDS, 20);
  byte dothue = 0;
  for( int i = 0; i < 8; i++) {
    leds[beatsin16( i+7, 0, NUM_LEDS-1 )] |= CHSV(dothue, 200, 255);
    dothue += 32;
  }
}

LG :slight_smile:

Hi,

It's possible that you just need to change LED_TYPE to SK6812, as they use slightly different timing parameters.