กลับไปหน้ารวมไฟล์
control-ws2812b-bluetooth-en.md

Responsive Lighting: Bluetooth NeoPixels

Why buy an $80 commercial smart light strip when you can build a customizable one for $15? The Bluetooth WS2812B Controller project fuses parsing Serial commands with the FastLED library to create gorgeous, responsive room lighting.

button_led_basic_interaction_1772681969235.png

The FastLED Library Magic

WS2812B strips (NeoPixels) only have 3 wires: 5V, GND, and a single Data line.

  • They are "Addressable." You can tell LED #5 to be Red while LED #60 is Blue.
  • The FastLED.h library handles the excruciatingly complex timing required for the Data line.
  • leds[0] = CRGB::Red; FastLED.show();

Parsing RGB Strings from Bluetooth

The true challenge is getting the exact color from your phone.

  1. You use an Android App (like Bluetooth Electronics) to dial in a custom purple color on a color wheel.
  2. The app sends a string to the HC-05 Receiver: R:150,G:0,B:200\n.
  3. The Arduino reads the string. It uses C++ String.indexOf() to find the commas, and String.substring().toInt() to pull out the exact 150 and 200 integers.
  4. It dynamically feeds those parsed numbers directly into fill_solid(leds, NUM_LEDS, CRGB(r, g, b));.

The Power Warning

  • Arduino Uno/Nano: The command logic.
  • HC-05 Bluetooth Module.
  • An Arduino pin can supply 500mA maximum. A 1-meter strip of 60 NeoPixels running full white draws 3.6 Amps! You must power the LED strip via an external 5V/5A power supply. If you plug the strip directly into the Arduino's 5V pin, you will instantly burn out the voltage regulator.

ข้อมูล Frontmatter ดั้งเดิม

title: "Control WS2812B LED Strips using Bluetooth"
description: "Color your world! Build your own smartphone app to wirelessly change the color, animation, and brightness of a massively addressable LED strip."
category: "Home Automation"
difficulty: "Intermediate"