This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

WS2812 with nRf51822 sample code not working

Hello All,

I am interfacing WS2812 RGB ringx16 with nRF51822 and use nrf51-neopixel library from github.com/.../nrf51-neopixel

Its not working.

for example : value of red = 124, blue = 23 and blue = 255. how can send this value on gpio.

Regards, Rajneesh

  • nrf51-neopixel library from github.com/.../nrf51-neop...

    Where it says,

    Developed by Lava, LLC

    So if you have problems with that code, or need guidance in how to use it, you need to contact the author - Lava, LLC - it has nothing to do with Nordic.

  • I've successfully been able to drive several WS2812 leds from a nrf51. Most of my hickups came from my hardware setup. Since I don't know you're set up, here are few things to look out for:

    In hardware, you need a Logic Level Shifter. I tried using a mosfet and two pull up resistors to translate the gpio signal from 3.3v to 5v but, I was unsuccessful with getting the square signal the LEDs really want. In addition, too small of a resistors leads to current waste. Too big of resistors and you get this voltage ramp from 0 to 3.3v and another from 3.3v to 5v. This ramp delay doesn't meet the requirements for the LEDs to recognize the the rise/fall of a square wave.

    If you are planning on adding more LEDs, then I'd considered you have a stable battery source through your strip of ws2812s. I would place bypass capacitors at the beginning of your led strip, solder 5v and ground leads intermittently through the strip. This will allow for a stable 5V power to be fed evenly through out your strip. Likewise, ensure that you will be able to source enough current for the number of LEDs you are going to drive. (Each led consuming 20mA at full brightness)

    As far as software is concerned, the main thing to look for the timing for the WS2812. It's picky. There is such a bit banging frequency that is too fast for the LEDs. Even more importantly, beware of trying to update the LEDs while having the soft device enabled. Since the SoftDevice runs on a higher priority, the program will interrupt your the bit banging code. Thus, you will see flickering periodically as it latches the first half of you're led strip and quickly overwrites the first couple leds with the latter half of your intended led color.

  • the main thing to look for the timing for the WS2812

    Absolutely - the WS2812 is entirely dependent upon timings!

    There is a specific note about this on the GitHub page

  • Yes, powering WS2812 from 5V and feeding them with 3.3V signal wont work, because a logic level high must be 0.7*Vcc (which is 3.5V) specified in the datasheet. However you can power the LEDs with a supply voltage lower than 5V, so that 3.3V is over the logic high voltage level. As the voltage drop across the blue LED is 3.2-3.4 the voltage should be higher than that for the blue LED to work like it should. A LiPo battery (nominal voltage of 3.7V) connected to the strip and the nRF5x running at 3.3V should be good. Also be careful of voltage drop when using many LEDs, see here.

Related