WS2812 addressable LEDs test

RGB LEDs are awesome – especially the new, fancy ones with the WS2812 RGB LED driver. These LEDs can be individually controlled to display red, green, and blue, but interfacing them with a microcontroller or computer.

To test controlling WS2812 RGB LEDs I bought a cheap addressable LED strip. An addressable RGB LED strip is a long flexible strand of LEDs each of which can be individually set to a certain color (hence: addressable). By varying the level of red, green and blue (RGB) per LED many color combinations can be made. Addressable LED promise is to be an easy way to add complex lighting effects to any project. WS2812 neopixels are addressable RGB LEDs. The integrated controller chip allows you to change the color of the LED and address each individual LED. ThoseWS2812 LEDs are powered with 5V – 7V power source (60 mA power consumption) and are controlled through a serial bus (one control signal).

I planned to use either Arduino or ESP8266 to control those LEDs. After some looking on vailable examples and technical data on the LEDs, I planned to use Arduino (Arduno Uno), because it’s 5V power and 5V logic level is directly suitable. And there are many Arduino tutorials for WS2812.

To get easy start, I planned to follow instructions fro Arduino Addressable LEDs & Splendid Projects page. That page had an example source code that looked to be useful and simple wiring instructions.

In the first test I fould out that in addition to the source code I also needed NeoPixel Arduno library. So I needed to get the library from https://github.com/adafruit/Adafruit_NeoPixel and install it according to instructions. After downloading, I had to rename folder to ‘Adafruit_NeoPixel’ and move it to Arduino Libraries folder. After restarting Arduino IDE , I opened File->Sketchbook->Library->Adafruit_NeoPixel->strandtest sketch example file.  This worked well. I also tried the original code fromArduino Addressable LEDs & Splendid Projects page which I modified to use 8 LEDs instead of one. Both examples made a “random” color light show on my LED strip. Enough for first testing.

image

 

image

image

294 Comments

  1. Tomi Engdahl says:

    How to use WS2812B RGB LEDs with Arduino
    https://www.youtube.com/watch?v=9hJyyUTflXA

    This tutorial is aimed at getting some instant gratification from your WS2812 LEDs (trade name: NeoPixels). I’ll briefly cover a bare-bones setup for Arduino.

    The full tutorial for this video (with images and step-by-step tips)

    WS2812 Addressable LEDs: Arduino Quickstart Guide
    https://core-electronics.com.au/tutorials/ws2812-addressable-leds-arduino-quickstart-guide.html

    Reply
  2. Tomi Engdahl says:

    The BEST Digital LED Strip Light Tutorial – DIY, WIFI-Controllable via ESP, MQTT, and Home Assistant
    https://www.youtube.com/watch?v=9KI36GTgwuQ

    Today, I’m bringing you a video of one of my favorite things – digital LED strips! These LED strips are everywhere these days, but getting started with them can seem daunting and I want to change that. In this video, I’ll be covering the basics on how to choose the right strip, strategies for mounting and powering them, how to control the strip(s) using a NodeMCU chip, and of course, how to automate your home with them.

    Reply
  3. Tomi Engdahl says:

    Home automation over WiFi using WeMos ESP8266
    https://www.youtube.com/watch?v=7Dv70ci-MOw

    This video shows how to use a smartphone to controll LED ligths.
    It also supports controlling switches.

    https://github.com/bitluni/bitluniHomeAutomation

    Reply
  4. Tomi Engdahl says:

    How to control WS2812B RGB LEDs with FastLED and Arduino
    https://www.youtube.com/watch?v=EcMKditEVtY

    Schematics and Arduino sketch download as .zip file: http://hamburgtech.de/downloads/
    FastLED Video Tutorial Code

    Reply
  5. Tomi Engdahl says:

    LED-ifying A Guitar, Part Two
    https://hackaday.com/2018/11/23/led-ifying-a-guitar-part-two/

    An electric guitar is all about stage presence. Need to be cooler than a single guitar? No problem — there are double neck guitars. Need to be cooler than that? No problem, the guy from Cheap Trick has a five-neck guitar. Need to be cooler than that? Robbie Robertson played a guitar with an extra mandolin neck on The Last Waltz. Where do you go from there? Obviously, the solution is putting a TV in your guitar with a boatload of individually addressable LEDs in a guitar. That’s what [Englandsaurus] is doing, and the build thread is now getting into how to turn a bunch of LEDs into a display.

    https://www.sparkfun.com/news/2822?utm_content=79997213

    The next logical step was to combine these two ideas and make a DMX-controlled, glowing guitar! Also, if you’d like to get more familiar, check out my tutorial on DMX below.

    DMX512 is an industry standard in lighting and stage design, whether it be controlling lights, motors, or lasers, DMX512 has many uses.

    The issue here is that DMX is a fire and forget protocol, meaning that it never checks to see if a message is actually received (this is why you shouldn’t control pyrotechnics or stage architecture with DMX). Due to this, DMX packets are occasionally dropped.

    Reply
  6. Tomi Engdahl says:

    Using Artnet DMX and the ESP32 to Drive Pixels
    https://learn.sparkfun.com/tutorials/using-artnet-dmx-and-the-esp32-to-drive-pixels?

    Creating an ArtNet Node on the ESP32

    We now have to get our ESP32 to listen for DMX data on the WiFi network. In order to do this, we’ll first need to setup the ESP32 Core on the Arduino IDE.

    Reply
  7. Tomi Engdahl says:

    12 Tips and Tricks for Neopixels Projects (Arduino, ESP8266/ ESP32)
    https://www.youtube.com/watch?v=IIl5nDjfkjY

    I love Neopixels, and I think they are a real invention. And they are dirt cheap. But you have to pay attention if you plan to use them! You can even burn your house.

    Comments:

    Tip #13: add a small and cheap 24 to 5V buck converter (less than 1$ for a 2A one) to each set of n neopixels, and use a 19v laptop power supply to feed the lot. I did this to avoid voltage drop and the ability to use much thinner wires.

    Having recently designed an LED system to go into an SUV for a ridesharing company, can confirm this is the way to go.

    Tip #14: find neopixels based on the WS6812. These are easier to drive, and exist in RGBW (cold or warm white) when you want more purer white or nicer pastel colors. The disadvantage is that when only blue is on also makes the phosfor in the white part glow a bit, so the blue will be less pure.

    Connect the first +5V/GND (in) and the last +5V/GND(out) the your power supply, to fix the problem with different brightnesses. AND you don’t have the full current on one cable pair.

    Reply
  8. Tomi Engdahl says:

    How to Make RGB Scrolling Text Display Using NeoPixel Matrix
    https://www.youtube.com/watch?v=QIijJGk0uCk

    Reply
  9. Tomi Engdahl says:

    Build Festive Lighting for the Holidays with balena
    https://www.hackster.io/chriscw/build-festive-lighting-for-the-holidays-with-balena-899f0e

    Set up some programmable festive tree lighting with Raspberry Pi, Fadecandy and Glediator software driving addressable RGB LED pixels.

    There’re a few things you’re going to need to build this project:

    Some addressable 5V RGB LEDs
    Raspberry Pi 3 & SD Card
    A free balenaCloud account
    Fadecandy board
    High quality power supply (i.e. Mean Well LRS-100-5)
    Case to put everything in (or 3D printer to print one)

    Reply
  10. Tomi Engdahl says:

    Homemade Daft Punk Helmet
    https://hackaday.com/2018/12/29/homemade-daft-punk-helmet/

    You may not be French, and you may not have had a series of hit records, but you can still have the blinky LED helmet, thanks to this build from [Electronoobs]. They have put together a neat Daft Punk helmet built from 3D printed parts, an Arduino, a Bluetooth module, a string of WS2812 addressable LEDs and a simple app. The helmet itself is 3D printed, and the Arduino, Bluetooth, and battery are mounted in the chin. The LED panel is a series of WS2812 LED light strips wired together in series. The whole thing is controlled over a Bluetooth connection to an Android app that was built with the MIT App Inventor.

    Daft Punk Helmet Bluetooth RGB strip
    https://www.electronoobs.com/eng_arduino_tut62.php

    Reply
  11. Tomi Engdahl says:

    Glue Sticks Turned into Brilliant “Fiber Optic” Display
    https://blog.hackster.io/glue-sticks-turned-into-brilliant-fiber-optic-display-70bae0cb065b

    An Arduino Nano powers 128 WS2811 LED modules that produce this light, and because of the way these amazing devices work, control is accomplished with only two digital outputs — and could be reduced to one in a pinch.

    Reply
  12. Tomi Engdahl says:

    Dave Lights Up His Garage with ESP32s and 16,000 RGB LEDs
    https://blog.hackster.io/dave-lights-up-his-garage-with-esp32s-and-16-000-rgb-leds-36312e7237fe

    Dave’s massive garage has been absolutely crammed full of LEDs. Those appear to be generic WS2812B individually-addressable RGB LEDs — what most people refer to by Adafruit’s “NeoPixel” brand name. But, powering and controlling 16,000 animated RGB LEDs is no small feat, which is why Dave turned to the humble ESP32.

    Reply
  13. Tomi Engdahl says:

    Interesting idea but considering that there are around 100 LEDs that look like WS2812 or similar. 100 ws2812 LEDs would need to have 6A 5V power supply to to support full brightness. Thin wires, hundreds of small soldering joints and consuderable currents next to flammable ping pong ball material does not feel very safe design.

    Iridescent LED Clock Made with Ping Pong Balls
    https://blog.hackster.io/iridescent-led-clock-made-with-ping-pong-balls-ed478595c5a1

    Reply
  14. Tomi Engdahl says:

    Use WS2812B Make a Suit that Light Up
    https://create.arduino.cc/projecthub/kuongshunelectronic/use-ws2812b-make-a-suit-that-light-up-2620d4

    Use the WS2812B SMD LED Strip to sew on clothes. The control board uses Arduino UNO R3 and Mega 2560.

    Reply
  15. Tomi Engdahl says:

    Inefficient NeoPixel Control Solved with Hardware Hackery
    https://hackaday.com/2019/02/18/inefficient-neopixel-control-solved-with-hardware-hackery/

    Everyone loves NeoPixels. Individually addressable RGB LEDs at a low price. Just attach an Arduino, load the demo code, and enjoy your blinking lights.

    But it turns out that demo code isn’t very efficient. [Ben Heck] practically did a spit take when he discovered that the ESP32 sample code for NeoPixels used a uint32 to store each bit of data. This meant 96 bytes of RAM were required for each LED. With 4k of RAM, you can control 42 LEDs. That’s the same amount of RAM that the Apollo Guidance Computer needed to get to the moon!

    His adventure is based on the thought that you should be able to generate these signals with hardware SPI. First, he takes a look at Adafruit’s DMA-Driven NeoPixel example.

    [Ben]’s solution uses some external hardware to reduce software requirements. The 74HC123 dual multi-vibrator is used to generate the two pulse lengths needed for the NeoPixels. The timing for each multi-vibrator is set by an external resistor and capacitor, which are chosen to meet the NeoPixel timing specifications.

    The 74HC123s are clocked by the SPI clock signal, and the SPI data is fed into an AND gate with the long pulse

    https://github.com/benheck/SPI-Neopixel

    Reply
  16. Tomi Engdahl says:

    Low cost LED Panel
    https://hackaday.io/project/162951-low-cost-led-panel

    The aim of this project is to have a low cost led panel assembled

    I am using Jinx and an Arduino Uno board to drive the LED Panel.
    Next step will be to drive the panel using an ESP32 DEV KIT board and have a 50cm x 25cm LED Panel with a better resolution (30×17 leds).

    Reply
  17. Tomi Engdahl says:

    Can You Live Without the WS2812?
    https://hackaday.com/2019/03/26/can-you-live-without-the-ws2812/

    As near as we can tell, the popular WS2812 individually addressable RGB LED was released to the world sometime around the last half of 2013. This wasn’t long ago, or maybe it was an eternity; the ESP8266, the WiFi microcontroller we all know and love was only released a year or so later. If you call these things “Neopixels”, there’s a good reason: Adafruit introduced the WS28212 to the maker community, with no small effort expended on software support, and branding.

    The WS2812 is produced by WorldSemi, who made a name for themselves earlier with LED driver solutions, especially the WS2811, an SOIC chip that would turn a common anode RGB LED into one that’s serially controllable. When they stuffed the brains from the WS2811 into a small package with a few LEDs, they created what is probably the most common programmable LED lighting solution available today.

    A lot has changed in the six years that the WS2812 has been on the market.

    While the WS2812B, 2813, and associated LEDs are great for adding blinky, there’s only so much you can do with a large, 5 mm x 5 mm square package.

    WS2815

    While the WS2812 plays well with five volts, ohm’s law is a thing and RGB LEDs draw a lot of current. It would be nice if there were an individually addressable RGB LED that worked with higher voltages. It’s like how electric kettles aren’t a thing with 120 V mains power. Sometimes more voltage is better.

    Enter the WS2815. Running at 12 V decreases the current, decreases resistive losses, and if you’re running really long strands of LEDs, makes mixing LED colors more consistent.

    APA-109B

    there are other manufacturers of serially addressable LEDs, and some of these chips have some interesting features.

    If you want to create a display with a wide color gamut, you need to make a display with four colors: red, green, blue, and what’s best described as ’emerald’. The emerald is deeper, and not as ‘neon’ as a traditional green sub-pixel on an LCD TV.

    An executive at Sharp ran with the idea until a marketer stepped in and said that nobody can sell two greens. What would you call it, “other green”.
    The APA-109B is the solution to trying to display white with red, green, and blue LEDs.

    Reply
  18. Tomi Engdahl says:

    Lots of Blinky! ESP32 Drives 20,000 WS2812 LEDs
    https://hackaday.com/2019/05/07/lots-of-blinky-esp32-drives-20000-ws2812-leds/

    To be fair, we’re not sure that [yves-bazin] has put together 20,000 LEDs yet, but he HAS demonstrated the feasibility of driving 20k LEDs all at once thanks to some editing of the FastLED I2S library and hardware GPIO expansion. The trick is in using a shift register to convert a single ESP32 pin into five outputs.

    https://old.reddit.com/r/esp32/comments/bkyeq0/20000_ws2812b_pushed_at_130fps_with_esp32_and/

    Reply
  19. Tomi Engdahl says:

    DIY LED Video Wall made in 24 hours
    https://www.youtube.com/watch?v=fz2QAV9z_o8

    This is how I made an LED video wall within 24h. It’s based on WS2812 controlled RGB LEDs and supported by a wide range of Arduino libraries. Enjoy!

    Reply
  20. Tomi Engdahl says:

    Rust, a Raspberry Pi and Addressable LED’s
    https://blog.tomarrell.com/post/rust_and_leds

    The WS2812b runs a protocol that can nicely be mapped to Pulse Width Modulated (PWM) peaks with a frequency of 800,000Hz or 800KHz. We’re able to encode a 1 using a duty cycle of approximately 66%, and a 0 with a duty cycle of approximately 33%.

    we need to send a buffer of 24 bits which is consumed by the next pixel in line. The 24 bits encode the red, green and blue hues for the consuming pixel. Once a pixel has consumed a buffer, it will forward any further bits along the chain until it receives a reset signal, where it will display its resulting hue.

    The Raspberry Pi does have built in hardware PWM. However, I wanted to make it a little more difficult than simply relying on hardware implementation. So bit-banging it was.

    Experimenting with bit banging on the Raspberry Pi to the WS2812b’s made things pretty evident. Trying to bit bang from user space on top of the Linux Kernel, even without a garbage collector in your binary, is just not very feasible.

    So with raw bit banging a digital pin off the table, I had a look at another relatively simple serial protocol (…interface), SPI. SPI

    we can approximate the highs and lows to some multiple of 1/3.

    This means that if we run a MOSI SPI signal at triple the frequency the lights expect, then we can send a single WS2812b “panel bit” using a combination of 3 SPI bits.

    This would give us rough timings of 416.67ns per SPI bit, and overall 1.25us for the entire panel bit.

    The LED’s run with a scan frequency of no less than 400Hz, with a data transfer rate of 800kbps.

    Implementation
    The very unpolished code to make this work is surprisingly minimal, thanks to the fantastic library rppal, written by @golemparts. It allows for controlling the Raspberry Pi’s SPI ports using the Linux Kernel’s SPI device interface from Rust.

    Reply
  21. Tomi Engdahl says:

    sorry to hear about the passing of Daniel Garcia, the originator of FastLED.
    Dan’s legacy will live on in countless colorful Arduino projects…

    http://fastled.io/

    FastLED is a fast, efficient, easy-to-use Arduino library for programming addressable LED strips and pixels such as WS2810, WS2811, LPD8806, Neopixel and more. FastLED is used by thousands of developers, in countless art and hobby projects, and in numerous commercial products.

    Reply
  22. Tomi Engdahl says:

    Arduino RGB LED Control Code with Excel
    https://www.hackster.io/news/arduino-rgb-led-control-code-with-excel-1001fee0325d

    WS2812 RGB LEDs have revolutionized what people are able to make with Arduino boards on a rather limited budget, but when you need to program them in a grid, things get a bit more complicated.

    The Arduino of course needs to know how to handle ‘mapLEDXY(X,Y,R,G,B),

    https://youtu.be/A_S3LAUQHwU

    Reply
  23. Tomi Engdahl says:

    This RGB LED Bonsai Tree Makes for a Very Peaceful Clock
    https://www.hackster.io/news/this-rgb-led-bonsai-tree-makes-for-a-very-peaceful-clock-6207d8a3f967

    Redditor Bobbassoonguy found an alternative to time-
    consuming bonsai pruning in the form of this RGB LED Bonsai Tree Clock.

    Reply
  24. Tomi Engdahl says:

    Choosing an RGB LED
    Find out which RGB LED is correct for the project you have in mind with this guide
    https://www.hackster.io/news/choosing-an-rgb-led-38d7f2311a3b

    Reply
  25. Tomi Engdahl says:

    ESP8266 Art-Net DMX to WS2812 © GPL3+
    Control WS2812 LED strings with Art-Net DMX over WiFi.
    https://create.arduino.cc/projecthub/jackguy/esp8266-art-net-dmx-to-ws2812-41c5fa?use_route=project

    This is a simple sketch that allows an ESP8266 board running Arduino to receive DMX from a lighting control program that is broadcasting Art-Net UDP packets over a WiFi network, and relay the RAW 3x8bit RGB DMX channels to a single connected string of WS2812 LEDs. The DMX addressing starts at channel one of any Art-Net universe. Each LED pixel is sent three consecutive DMX channels.

    Reply
  26. Tomi Engdahl says:

    Internet API for LED Pixel Strip
    https://www.hackster.io/donowak/internet-api-for-led-pixel-strip-faec91

    It allows you to change theme of your LED pixel strip in an easy way over the internet in two modes: real-time display or saved animation.

    Reply
  27. Tomi Engdahl says:

    New Part Day: SK6812 Mini-E. A Hand Solderable Neopixel Compatible LED!
    https://hackaday.com/2020/01/28/new-part-day-sk6812-mini-e-a-hand-solderable-neopixel-compatible-led/

    SK6812 Mini-E is a WS2812 or Neopixel compatible multi-colour LED of a type that has been available for a while now.

    What makes this component new though is its packaging. The Mini-E variant of the SK6812 only appeared last year and has now found its way through to smaller order quantities on AliExpress. Its special feature is that it has a set of flat leads rather than the usual pads on the underside of the package. This means that unlike its predecessors it is readily hand solderable, as he demonstrates by attaching a set of leads to one.

    Looking at the SK6812MINI-E – A hand solderable Neopixel compatible LED
    https://www.youtube.com/watch?v=oLYkzn0jwg8

    Reply
  28. Tomi Engdahl says:

    WS2812B LED Clones: Work Better Than Originals!
    https://hackaday.com/2017/01/25/ws2812b-led-clones-work-better-than-originals/

    Commodity electronics manufacturing is a tough game. If you come out with a world-beating product, like WorldSemi did with the WS2812B addressable RGB LED “pixel”, you can be pretty sure that you’re going to be cloned in fairly short order. And we’re all used to horror stories of being sold clones instead of what was ordered. But what if the clones were actually an improvement?

    the cheaper LED modules that he’d previously bought weren’t from WorldSemi, but were actually SK6812 clones labelled as WS2812Bs. When he switched to the real thing, he discovered that they had some temperature and pressure sensitivities that the clones didn’t. The clones were better!

    PSA: WS2812B LEDs may not be what you think they are!
    https://talk.vanhack.ca/t/psa-ws2812b-leds-may-not-be-what-you-think-they-are/5626

    Reply
  29. Tomi Engdahl says:

    New Part Day: SK6812 Mini-E. A Hand Solderable Neopixel Compatible LED!
    https://hackaday.com/2020/01/28/new-part-day-sk6812-mini-e-a-hand-solderable-neopixel-compatible-led/

    SK6812 Mini-E is a WS2812 or Neopixel compatible multi-colour LED of a type that has been available for a while now.

    What makes this component new though is its packaging. The Mini-E variant of the SK6812 only appeared last year and has now found its way through to smaller order quantities on AliExpress. Its special feature is that it has a set of flat leads rather than the usual pads on the underside of the package.

    https://www.youtube.com/watch?v=oLYkzn0jwg8

    Reply
  30. Tomi Engdahl says:

    Use the cursor to change the color of NeoPixels! Create light experiences with visual software like Photoshop or After Effects.

    From Pixel to NeoPixel © CC BY
    https://create.arduino.cc/projecthub/user0448083246/from-pixel-to-neopixel-6a49fd

    Use the cursor to change the colour of NeoPixels. Create light experiences using visual software like Photoshop or After Effects.

    This project contains two pieces of code; one to capture the current location of the cursor and find out what colour(s) it is pointing to (in Processing). And one that is connected to the Arduino that takes the RGB colours from the screen and sends it to the NeoPixel(s) (of course with a bit of tweaking; servo’s and other devices could also be controlled in this way).

    Especially when you want to sync sound experiences with the light experiences or on-screen animations these examples can help out

    In processing it takes a little screenshot of the current pixel at the cursor position; it doesn’t see the cursor itself. You can, of course, change that aswell to a fixed position

    Sometimes you don’t want to just send one colour, but you want more of an animation. This is possible by just sending more pixels at the same time. Both sketches need a few adjustments…

    Reply
  31. Tomi Engdahl says:

    Add Some Pizzazz to Your Property with ESP32-Powered Post Lights
    https://www.hackster.io/news/add-some-pizzazz-to-your-property-with-esp32-powered-post-lights-f4cff7213a10

    These WiFi-controlled octagonal lights use an interesting diffusion technique.

    Though p3nguin could have spent $1,500 or so on something that was only OK, he decided instead to build something custom that would be cheaper and much cooler.

    What he came up with was a series of six octagonal post tops, each containing 100 WS2812B addressable LEDS and an ESP32-DevKitC board. This allows for wireless coordination and control of the lights, which is taken care of by a WLED web server. A smartphone app provides user interface.

    Each lighting setup runs off of 12V “landscape” power, using a step-down transformer to produce the 5V needed to operate the LEDs.

    https://www.instructables.com/id/LED-Post-Lights/

    Reply
  32. Tomi Engdahl says:

    WLED!
    https://github.com/Aircoookie/WLED

    A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control NeoPixel (WS2812B, WS2811, SK6812, APA102) LEDs!

    Reply
  33. Tomi Engdahl says:

    PoE Powers Christmas Lights, But Opens Up So Much More
    https://hackaday.com/2019/12/31/poe-powers-christmas-lights-but-opens-up-so-much-more/

    The decoration is powered exclusively from power-over-Ethernet, with a PIC microcontroller translating Art-Net DMX-over-Ethernet packets into commands for the LED string. The control board is designed from the ground up and includes all the PoE circuitry

    https://bikerglen.com/blog/ethernet-powered-pixels/

    Reply
  34. Tomi Engdahl says:

    Ever wonder why is it that can make RGB LEDs turn into just any color of your choosing except brown?

    Technology Connections Investigates Why You Can’t Mix Brown From RGB LEDs
    https://www.hackster.io/news/technology-connections-investigates-why-you-can-t-mix-brown-from-rgb-leds-916f557157fb

    RGB LEDs are “actually very limited,” host Alec explains, “but at the same time they are nearly limitless.”

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

*

*