Node.js Raspberry Pi GPIO Flowing LEDs
Here is a clear, complete, and beginner-friendly guide for Node.js Raspberry Pi GPIO – Flowing LEDs (LED Chaser / Running Lights).
🌈 Node.js Raspberry Pi GPIO – Flowing LEDs (LED Chaser Effect)
In this project, you will connect multiple LEDs to Raspberry Pi and create a flowing / chasing light effect like:
➡ LED1 → LED2 → LED3 → LED4 → LED5 → LED1 → repeat…
This effect is similar to “Knight Rider”, “Running Lights”, or “Larson Scanner”.
✅ 1. What You Need
Hardware:
-
1 × Raspberry Pi
-
5 × LEDs (any color)
-
5 × 330Ω resistors
-
Jumper wires
-
Breadboard (recommended)
🔌 2. GPIO Pin Selection
We will use these pins:
| LED | GPIO Pin | Board Pin |
|---|---|---|
| LED 1 | GPIO17 | Pin 11 |
| LED 2 | GPIO27 | Pin 13 |
| LED 3 | GPIO22 | Pin 15 |
| LED 4 | GPIO23 | Pin 16 |
| LED 5 | GPIO24 | Pin 18 |
🧩 3. Wiring Diagram
Each LED:
Repeat for all 5 LEDs.
📦 4. Install GPIO Library
💡 5. Create File
🚀 6. Node.js Code – Flowing LED Effect
▶ 7. Run the Program
You will now see LEDs turning ON one after another in a “flowing” pattern.
⚙ Adjust the Speed
Slow down (500ms):
Very fast (50ms):
🔥 Advanced Animation Effects
You can create many LED patterns.
1️⃣ Reverse Flow
2️⃣ Ping-Pong Motion (Knight Rider)
Same as reverse flow above — popular sci-fi effect.
3️⃣ Wave Effect (Two LEDs ON at once)
4️⃣ Random LED Flicker
🧠 Best Practices
✔ Always turn off LEDs before exit
✔ Use resistors to avoid GPIO damage
✔ Avoid drawing too much current (max 50mA total)
✔ For many LEDs, use ULN2803 or transistor driver
