Week 11 - Network and Communications #
Hero Shot: #
TL;DR #
I connected a WS2812B NeoPixel Ring 12 to my custom PCB and programmed it using a single-wire serial communication protocol. Each LED acts as an individually addressable node on a shared communication bus, allowing the microcontroller to control every LED independently with different colors and timing patterns.
Group Assignment #
Link to this week’s group assignment
Using a Neopixel Ring as Networking Device #
For this assignment, I designed and connected a simple communication network using a 12-pixel NeoPixel ring and my custom PCB from previous weeks. The NeoPixel ring communicates with the microcontroller through a one-wire serial communication protocol, where all LEDs share the same data line.
I learned that each LED in the NeoPixel ring can be controlled separately even though they all use the same data pin. The microcontroller sends serial data to the first LED, which then forwards the remaining data to the next LEDs in the chain.
The NeoPixel ring was connected to the PCB using:
- VCC
- GND
- Data pin
My first test code controlled all of the LEDs at once:
for (int i = 0; i < NUM_LEDS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 0, 255)); // blue
}
pixels.show();
To demonstrate the addressability of the network nodes, I programmed the microcontroller so that each LED lights up individually with different colors. The LEDs turn on one at a time, showing that each node can be independently controlled through its unique address in the communication chain.
// Light LEDs one by one
for (int i = 0; i < NUM_LEDS; i++) {
pixels.clear();
// Different color for different addresses
if (i % 3 == 0) {
pixels.setPixelColor(i, pixels.Color(255, 0, 0)); // Red
}
else if (i % 3 == 1) {
pixels.setPixelColor(i, pixels.Color(0, 255, 0)); // Green
}
else {
pixels.setPixelColor(i, pixels.Color(0, 0, 255)); // Blue
}
pixels.show();
delay(300);
}
This video shows the NeoPixel ring in action:
Files: