# WS2801 on Raspberry Pi not working

**URL:** <https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084>\
**Category:** General\
**Created:** [12 December 2019 17:47 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084 "2019-12-12T17:47:38Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [12 December 2019 17:47 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/1 "2019-12-12T17:47:38Z")

</div>

I can't imagine there might be many people using these (string of 50 water proof RGB LEDS that use 2-wire SPI for data/clock)

I used to have them working in Node-RED last christmas but they only work this year if I say there is only 1 in the string - I can control that one fine

Once I say I have more (say 10) I just get a couple of them lighting up with random colour)

To prove they weren't broken, I installed an old Adafruit python lib and they worked fine

The only hint I'm getting is this error message in the terminal  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2e7e32dbf704ba8c72d206884e86ad54cebbfcb1.png)

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 December 2019 18:15 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/2 "2019-12-12T18:15:13Z")

</div>

Voltage Simon? If I seem to remember they need vdd \* 0.7 on the 2 wire SPI, sometimes they work and sometimes not.

[edit] have you got a level shifter handy?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [12 December 2019 18:19 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/3 "2019-12-12T18:19:15Z")

</div>

> [@cymplecy](#):
>
> To prove they weren't broken, I installed an old Adafruit python lib and they worked fine

🙂

I've been investigating and it seems that github was updated 18 days ago but npm hasn't caught up

So I installed it direct from github - but now I get a really big error message ☹

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4424a788b6afc4bf346ea4774fd848ea8fd42d05.jpeg)

But, I've tested the underlying npm rpi-gpio library and I can run a native JS file just using node itself so there is hope

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 December 2019 18:21 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/4 "2019-12-12T18:21:18Z")

</div>

I missed that you had tried with Python!!

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [12 December 2019 18:23 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/5 "2019-12-12T18:23:58Z")

</div>

I do that myself all the time - it must be age 🙂

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 December 2019 18:25 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/6 "2019-12-12T18:25:41Z")

</div>

Ha, I blame fingers being faster than the brain. A stupid hypothesis as the fingers are controlled by the brain 🙂

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [12 December 2019 18:30 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/7 "2019-12-12T18:30:16Z")

</div>

Looking at github for the contrib node and then looking at recent changes in the code for its upstream npm package, I can see where the connect function has changed from needing 3 to now needing 4 parameters  
Further investigation has found out that the upstream rpi-gpio package has change the package it uses to access the SPI bus and that is the thing causing the issue

Going to see if I can bodge my local copy to get it working!

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [12 December 2019 18:44 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/8 "2019-12-12T18:44:58Z")

</div>

Bodge success 🙂

```auto
node.leds.connect(node.numLeds, 0,0 , node.gamma); // bodge to cope with changes in rpi-ws2801 (which changed to using a different underlying spi lib)

```

 ![2019-12-12 18.42.02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b73d37b4a7cc4f6e35e96c7557a4ed0f933c1660.jpeg)

I've raised an issue with the node on github so hopefully it'll get sorted officially

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [12 December 2019 18:54 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/9 "2019-12-12T18:54:27Z")

</div>

Ha, ha - I can see the problem - the red wire (second from the left) is not making a very good contact.

Oops - the other problem might be 'Bott-RED' is empty at this end.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 December 2019 19:05 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/10 "2019-12-12T19:05:00Z")

</div>

Dave, are you using node-red-contrib-merlot?

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [12 December 2019 19:07 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/11 "2019-12-12T19:07:01Z")

</div>

Yes I am - I found it on the drop-down menu in the Human-In category.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [12 December 2019 19:54 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/12 "2019-12-12T19:54:40Z")

</div>

Anybody found the new node-red-contrib-auto-tidy-up yet?  
I also really need it urgently  
😉

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 December 2019 20:15 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/13 "2019-12-12T20:15:17Z")

</div>

> [@krambriw](#):
>
> Anybody found the new node-red-contrib-auto-tidy-up yet?

I've been working on it for years but the more I get it to clean up, the messier things end up. Go figure.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [12 December 2019 20:28 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/14 "2019-12-12T20:28:52Z")

</div>

If you are using native `tidy` together with native `auto` library then it fails most of time cos `auto` library contains `let-it-be` library and this overrides most of your custom methods. Took me years of trial and error to figure it out.

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [12 December 2019 20:56 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/15 "2019-12-12T20:56:24Z")

</div>

> [@cymplecy](#):
>
> ![2019-12-12 18.42.02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b73d37b4a7cc4f6e35e96c7557a4ed0f933c1660.jpeg)

Wow! And I thought _my_ workbench was messy... 🤣

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 December 2019 20:57 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/16 "2019-12-12T20:57:42Z")

</div>

I vote we move this to the Lounge so as not to scare newcomers!

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [12 December 2019 20:59 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/17 "2019-12-12T20:59:18Z")

</div>

That's my desk overflow area for when I can't get anything more on the desk itself 🙂

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 December 2019 21:01 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/18 "2019-12-12T21:01:20Z")

</div>

Posting photos of your desk might be too traumatic for your average viewer!

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [14 December 2019 12:19 UTC](https://discourse.nodered.org/t/ws2801-on-raspberry-pi-not-working/19084/19 "2019-12-14T12:19:59Z")

</div>

Back to business ...... 🙂

@nlecaude has asked me to do a PR as he is away at moment so I've done that but he'll need to update the main npm package

If anyone actually needs it ASAP- you can just install from my github fork in the meantime

`npm install https://github.com/cymplecy/node-red-contrib-rpi-ws2801#Change-to-deal-with-upstream-move-to-use-bus-and-device-instead-of-port`

_Maybe I could have used a less verbose branch name_ 🙂
