Projects / Addressable LED strip with light modes

Addressable LED strip with light modes

Beginner1 hGuided buildReviewed

Build it step by step

0 of 5 done
  1. NANO9.1 mA

    Check the direction

    The strip's arrows show data direction. Solder or clip the wires to the DIN end.

  2. NANO9.1 mA

    Power the strip

    5 V and GND straight from the supply, with the 1000 µF capacitor across them at the strip.

  3. NANO

    Wire data

    D6 through 330 Ω to DIN. Join the Nano GND to the supply GND.

  4. NANO

    Add the button

    From D2 to GND.

  5. NANO

    Upload and press

    Upload and press the button to cycle through the four modes.

In short

How do you build an addressable LED strip with light modes?

A button cycles a 60-LED WS2812B strip through rainbow, colour wipe, running light and soft white modes. You need Arduino Nano, WS2812B addressable RGB LED strip (1 m, 60 LEDs), Tactile push button 6 mm, Resistor 330 Ω, Electrolytic capacitor 1000 µF, 5 V 3 A USB buck module (12/24 V to USB), 12 V 2 A DC adapter and Jumper wires male to male (40 pcs, 20 cm). It takes 5 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
5 V supply + / −Strip 5V / GND (red / white)Strip power, not through the Nano
1000 µFAcross the strip 5V and GND, minus to GNDSoftens the inrush
Nano D6330 Ω to strip DIN (green)Data, with the arrow on the strip pointing away
Nano 5V / GND5 V supply + / −Board power, shared ground
ButtonNano D2 and GNDNext mode

Code

Arduino IDE, board "Arduino Nano". Install "FastLED". The power limit line keeps the strip within the supply.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <FastLED.h>

const int N = 60, PIN = 6, BTN = 2;
CRGB leds[N];
byte mode = 0;
const byte MODES = 4;

void setup() {
  pinMode(BTN, INPUT_PULLUP);
  FastLED.addLeds<WS2812B, PIN, GRB>(leds, N);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 2000);   // never ask for more than 2 A
  FastLED.setBrightness(120);
}

void loop() {
  static bool last = HIGH;
  bool now = digitalRead(BTN);
  if (last == HIGH && now == LOW) { mode = (mode + 1) % MODES; FastLED.clear(); delay(30); }
  last = now;

  static byte hue = 0; static int pos = 0;
  EVERY_N_MILLISECONDS(20) {
    hue++;
    switch (mode) {
      case 0: fill_rainbow(leds, N, hue, 255 / N); break;                    // rainbow
      case 1: leds[pos] = CHSV(hue, 255, 255); pos = (pos + 1) % N; break;    // colour wipe
      case 2: fadeToBlackBy(leds, N, 40); leds[pos] = CRGB::OrangeRed; pos = (pos + 1) % N; break;  // running light
      case 3: fill_solid(leds, N, CRGB(255, 180, 110)); break;                // warm white
    }
    FastLED.show();
  }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
First modeMoving rainbow over all 60 LEDs
Each button pressNext mode: wipe, running light, warm white, then rainbow again
Supply current in warm white at brightness 120Below 2 A (the code caps it)

If it does not work

Nothing lights

You wired the DOUT end. Move the data wire to DIN, the end the arrows start from.

Colours wrong (red shows green)

Change GRB to RGB in addLeds.

Flicker or random colours

Shared ground missing, or the data wire is long. Keep it short and use the 330 Ω.

Far end goes yellow or dim

Feed 5 V into both ends of the strip.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the addressable LED strip with light modes?

Arduino Nano, WS2812B addressable RGB LED strip (1 m, 60 LEDs), Tactile push button 6 mm, Resistor 330 Ω, Electrolytic capacitor 1000 µF, 5 V 3 A USB buck module (12/24 V to USB), 12 V 2 A DC adapter and Jumper wires male to male (40 pcs, 20 cm). Resistor 330 Ω: In the data line. Electrolytic capacitor 1000 µF: Across the strip supply. 5 V 3 A USB buck module (12/24 V to USB): Or any 5 V supply rated 3 A.

How long does the addressable LED strip with light modes take to build?

About 60 minutes for a beginner maker, in 5 steps.

How do I know the addressable LED strip with light modes works?

First mode: Moving rainbow over all 60 LEDs. Each button press: Next mode: wipe, running light, warm white, then rainbow again. Supply current in warm white at brightness 120: Below 2 A (the code caps it).

Nothing lights: what should I check?

You wired the DOUT end. Move the data wire to DIN, the end the arrows start from.

Colours wrong (red shows green): what should I check?

Change GRB to RGB in addLeds.

Flicker or random colours: what should I check?

Shared ground missing, or the data wire is long. Keep it short and use the 330 Ω.

Far end goes yellow or dim: what should I check?

Feed 5 V into both ends of the strip.