Controlling an LED strip with Rpi 3 B+

Hi everyone,

I am at my wits end right now. I’m trying to control a strip of WS2812 LED lights via a brand new resin enabled Raspberry Pi 3 B+. The strip is this one: https://www.amazon.com/gp/product/B018X04ES2/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1

I have it wired through a logic level converter to bump the Pi output from 3 to 5V. I’m using the rpi_ws218x library to control the LEDs: https://github.com/jgarff/rpi_ws281x.

Things I have already tried:

  1. Enable INITSYSTEM on
  2. Removing the snd_bcm2835 module, which is known to conflict with the rpi_ws281x library.
  3. Added RESIN_HOST_CONFIG_hdmi_drive = 2 and RESIN_HOST_CONFIG_hdmi_group = 1 as suggested in this forum post: How to disable Raspberry Pi 3 on-board sound?

I am using the resin-raspberrypi-node base image because I will be running a nodejs server from the pi to control the lights. Right now I am using the terminal on the dashboard to manually start the strandtest.py example from rpi_ws281x. The program runs, but there is no output to the lights.

Things are wired according to this: https://learn.adafruit.com/neopixels-on-raspberry-pi/wiring

Any assistance would be greatly appreciated.

Looks like @sqweelygig had a project with similar hardware? Maybe there are some pointers, or he has some useful feedback?

Indeed I have done a WS2812B controller board! I used the Pi Zero W, but that shouldn’t matter. Thanks for the ping Gergely.

The things I notice about these two projects are:

  • Note that your link references a WS2812B string of lights, and your description states WS2812. They are different, most crucially around supply voltage. (I made the same mistake in my write-up)
  • My dockerfile pulls in a couple of extra dependancies, specifically scons & node-gyp
  • I dispensed with the logic level converter. The spec on the WS2812B will allow a supply voltage of quite a bit lower than the 5v, and a signal voltage of 0.7 * supply voltage. This means you can get the supply voltage low enough that the Pi can signal to it. Just noticed that my README recommends a fixed voltage 5v supply, which is wrong.

I am using all 5 meters of the strip, so I wanted to keep the input voltage as high as possible to avoid fading over the course of the strip. To that end I will be powering it from both sides with 5V 10A supplies (the full 5m could pull a max of 18A at full bright white). I was also trying to use the rpi-ws281x-native library after failing with the rpi_ws281x python library but have not yet had success.

Is there any reason I would be seeing no output? I even tried going into the Python terminal and writing few lines to toggle the output to pin 18 from HIGH to LOW and back again, but the lights remained unaffected. I know the strip is fine because when tested with an Arduino they perform as expected.

Thanks so much for your help.

Could you try cloning https://github.com/resin-io-playground/ChristmasLights and seeing if that works?

will do after work today. I’ll report back here after I do! Really hoping its not a dumb issue on my end…

I ran into this issue yesterday and was hoping my issue on the rpi_ws281x_native GitHub would have been responded to by now, but I get this error when npm tries to install the library:
../src/rpi-ws281x.cc: In function ‘void init(const Nan::FunctionCallbackInfo<v8::Value>&)’: [main] ../src/rpi-ws281x.cc:100:38: error: no matching function for call to ‘v8::Object::HasOwnProperty(v8::Local<v8::String>&)’ [main] if(config->HasOwnProperty(symFreq)) { [main] ^ [main] ../src/rpi-ws281x.cc:100:38: note: candidates are: [main] [main] In file included from /root/.node-gyp/10.4.1/include/node/node.h:63:0,
Another issue referenced the same issue: https://github.com/beyondscreen/node-rpi-ws281x-native/issues/82

Their solution was to use an older version of node. What is the current node version for the resin/raspberry-pi-node image? Obviously this is not an issue on the resin side of things, I just really hope I can get it to work with a resin enabled device.

I’m not sure what the default is at the moment, but that probably isn’t as important to you as being able to steer which version you get. You can do this by appending a :<version> to your FROM statement. Details on our base image page https://docs.resin.io/reference/base-images/resin-base-images/, full list of <version>s for Node on the Pi3 https://hub.docker.com/r/resin/raspberrypi3-node/tags/

Indeed it was the node version that was causing the issue - rpi_ws281x_native isn’t yet compatible with node 10. Switching to an image with node 8 (resin/raspberry-pi-node:8) fixed the issue and I’m now in control of the lights! Thanks so much for all your help. Now on to the fun stuff…

Thanks for taking the time to close the thread off for future audiences, if you need any other help you know where to find us.
Oh, and feel free to update this thread when you’ve got some pictures!