NeoPixel LED Strip Control Using ATtiny (Pin 12)
This project builds a compact NeoPixel LED controller using an ATtiny microcontroller. A potentiometer adjusts brightness or color, and a push button switches between lighting modes. A capacitor ensures stable power for the LED.
The LED used is WS2812 (commonly called NeoPixel), which allows full RGB color control using a single data pin.
Components Required
-
ATtiny microcontroller (e.g., ATtiny85)
-
WS2812 / NeoPixel LED
-
10kΩ Potentiometer
-
Push Button
-
1µF Capacitor
-
5V Power Supply
-
Jumper Wires
Basic Circuit Connections
1️⃣ NeoPixel (WS2812)
| NeoPixel Pin | Connect To |
|---|---|
| 5V | 5V Supply |
| GND | GND |
| DIN | ATtiny Pin 12 |
| 1µF Capacitor | Between 5V and GND (near LED) |
Capacitor helps prevent voltage spikes and ensures stable operation.
2️⃣ Potentiometer (10kΩ)
| Pot Pin | Connect To |
|---|---|
| Left | 5V |
| Right | GND |
| Middle | ATtiny Analog Pin (A1) |
Used to control:
-
Brightness
-
Or color value (Hue)
3️⃣ Push Button
| Button Side | Connect To |
|---|---|
| One Side | ATtiny Digital Pin (Pin 2) |
| Other Side | GND |
Use internal pull-up resistor in code.
Working Logic
Potentiometer
-
Reads analog value (0–1023).
-
Maps value to:
-
Brightness (0–255)
-
Or color variation.
-
Button
-
When pressed:
-
Switches to next lighting mode.
-
Modes can include:
-
Solid color
-
Rainbow
-
Breathing effect
-
Flash effect
-
-
NeoPixel
-
Displays selected color/effect.
-
Updates dynamically based on input.
Example Arduino Code (For ATtiny)
#include <Adafruit_NeoPixel.h>#define LED_PIN 12#define NUMPIXELS 1#define BUTTON_PIN 2#define POT_PIN A1Adafruit_NeoPixel pixels(NUMPIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);int mode = 0;int lastButtonState = HIGH;void setup() {pinMode(BUTTON_PIN, INPUT_PULLUP);pixels.begin();}void loop() {int potValue = analogRead(POT_PIN);int brightness = map(potValue, 0, 1023, 0, 255);int buttonState = digitalRead(BUTTON_PIN);if (buttonState == LOW && lastButtonState == HIGH) {mode++;if (mode > 2) mode = 0;delay(200);}lastButtonState = buttonState;pixels.setBrightness(brightness);if (mode == 0) {pixels.setPixelColor(0, pixels.Color(255, 0, 0)); // Red}else if (mode == 1) {pixels.setPixelColor(0, pixels.Color(0, 255, 0)); // Green}else if (mode == 2) {pixels.setPixelColor(0, pixels.Color(0, 0, 255)); // Blue}pixels.show();}
How It Works
-
ATtiny reads potentiometer value.
-
Converts value into brightness.
-
Button press increases mode number.
-
NeoPixel updates color based on mode.
-
Process repeats continuously.
Possible Lighting Modes
-
Rainbow cycle
-
Fade in/out
-
Flashing strobe
-
Fire simulation
-
Sound-reactive (with mic module)
-
Smooth color transition (HSV control)
What You Learn
Why Add a Capacitor?
The 1µF capacitor:
-
Stabilizes voltage
-
Protects NeoPixel from power spikes
-
Prevents flickering or reset issues
(For longer strips, 1000µF is commonly recommended.)
Applications
-
DIY LED lamp
-
Wearable LED projects
-
Mini mood light
-
Custom gaming LED controller
-
Decorative lighting system
-
Embedded electronics learning kit
BEGINNER PROJECTS (Foundation Skills)
- Ultrasonic Distance Measurement
- Traffic Light Simulation with 7-Segment Display
- 7-Segment Display Counter
- Kids Piano Circuit (8-Key Version)
- 16×2 LCD Display with Text Output
- LCD I2C to Arduino UNO
- Temperature Measurement using Arduino UNO
- LDR Controlled Street Light
INTERMEDIATE PROJECTS (Build Your Skills)
- Servo Motor Control Using Potentiometer
- DC Motor Speed Control
- Temperature Controlled Fan
- PIR Based Theft Alert System
- LPG Gas Leakage Detection System
- Automatic Door Locking System
- Soil Moisture Based Automatic Watering System
- Simple Digital Clock using Arduino UNO
- Automatic Voting Machine (EVM)
- Joystick Control using Arduino Uno
- RGB Lamp Control using Arduino Uno
ADVANCED PROJECTS (Master Level)
- Home Automation Using Arduino UNO
- Bluetooth RC Car using Arduino Uno
- Obstacle Avoiding Robot
- Line Follower Robot
- Radar System Using Arduino UNO
- Automatic Parking System
- Bi-Directional People Counter using Arduino Uno
- Automatic Plant Watering System
- NeoPixel LED Ring Control using Arduino Uno
- Smart Gloves for Bedridden People

Comments
Post a Comment