# Help please with the NEOPIXEL node

**URL:** <https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837>\
**Category:** General\
**Created:** [24 September 2019 00:37 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837 "2019-09-24T00:37:20Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 00:37 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/1 "2019-09-24T00:37:20Z")

</div>

Shoot me if you will, but I am missing something.

I have (finally) got around to trying to get some NeoPixel LEDs working on a RPI.

Installing the node and the required

> The Neopixel python driver need to be pre-installed... The easiest way to get the driver installed \>is to use the Unicorn HAT drivers install script... see the [Pimoroni Getting Started with Unicorn \>HAT](http://learn.pimoroni.com/tutorial/unicorn-hat/getting-started-with-unicorn-hat) page.

So I ran the script mentioned.

But I am missing which GPIO pin it uses.

Please.  
Someone.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 September 2019 07:59 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/2 "2019-09-24T07:59:31Z")

</div>

RTFM - [https://flows.nodered.org/node/node-red-node-pi-neopixel](https://flows.nodered.org/node/node-red-node-pi-neopixel)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 08:03 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/3 "2019-09-24T08:03:12Z")

</div>

Yeah, ok. I missed it.

Pin 18

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 08:46 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/4 "2019-09-24T08:46:22Z")

</div>

(If you are still reading this)

I got it working, but am now having problems understanding the _modes_.

```auto
Bar Chart

Defaults style mode using configured foreground and background colours. The foreground colour is used to indicate the number of pixels or length required.

It accepts a number in msg.payload that can be either the number of pixels, or a percentage of the total length.

If you want to change the foreground colour, you can set msg.payload to a comma separated string of html_colour,length or length,html_colour. The foreground will then remain that colour until changed again.
Needle

It can also display a needle (single pixel) type gauge. The rest of the pixels are set to the background colour on one side, and the foreground colour on the other side of the indicated pixel.

If you want to change the needle colour, you can set msg.payload to a comma separated string of html_colour,length or length,html_colour.
Shift left and Shift right

You can also select shift modes where a single colour pixel is added to either the start or the end of the strip, shifting all the others along by one. In this mode the msg.payload can be specified as either an html colour name, an r,g,b triple or #rrggbb.

```

What is the difference between `bar chart` and `Needle`?  
How do I `shift left` (or right)  
I can't resolve the syntax to understand what I need to send to do these.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 September 2019 09:32 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/5 "2019-09-24T09:32:11Z")

</div>

Maybe you could try them and see ?  
I'm not sure what else to say apart from a bar is a bar and a needle is a single pixel.  
They are all just different modes  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/45ca186a271cc859a8441cdff2518e6c954723bc.jpeg)  
In the shift modes (add to start or end) - as the info you actually quoted it says "In this mode the msg.payload can be specified as either an html colour name, an r,g,b triple or #rrggbb."

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 09:38 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/6 "2019-09-24T09:38:11Z")

</div>

`It can also display a needle (single pixel) type gauge. The rest of the pixels are set to the background colour on one side, and the foreground colour on the other side of the indicated pixel.`

Let's take apart that sentence.

`(single pixel)` That's one.  
`The rest of the pixels are set to the background colour` so far so good.  
`and the foreground colour on the other side of the indicated pixel`

Well that kinda messes with the `single pixel` notion.

_up to the pixel_ the LEDs are set to the background colour.  
**the pixel** not really explained what colour it is.  
_and the foreground colour on the **other** side of the indicated pixel_.

Nah. That's a bar. Well, actually a _reverse bar_.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [24 September 2019 09:42 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/7 "2019-09-24T09:42:09Z")

</div>

If you think the documentation can be improved, I'm sure that the author would be glad to accept a pull request to update it.

---

<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:** [24 September 2019 09:42 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/8 "2019-09-24T09:42:11Z")

</div>

think of the BAR as being vertical where all pixels up to the specified value are lit up

think of the needle horizontal where the color change is the needle

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 09:45 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/9 "2019-09-24T09:45:23Z")

</div>

> [@ukmoose](#):
>
> If you think the documentation can be improved, I'm sure that the author would be glad to accept a pull request to update it.

No, I am just confused that I am being pointed to the documentation which is vague.  
Though it may be for me to point out the problem, I can't get why people seem to think that because they understand something everyone else has to.

I asked, I didn't understand the answer and it is my fault.  
Yeah. Ok. Story of my life.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 09:49 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/10 "2019-09-24T09:49:10Z")

</div>

@zenofmud  
Yeah, I kind of get it.

But be it horizontal or vertical..... A bar is like the old _VU meters_ that tape decks used to have.

a _needle_ is a single pixel. Yeah. but that isn't what is written for that.  
It says that upto the _value_ all the LEDs are background colour. After the LED they are foreground colour.

That's a reverse bar to me.

Example: . = off. \* = on.  
Bar  
` ****....`

Needle  
`....*......`

But how it is said:  
`.... ****** `

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [24 September 2019 09:49 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/11 "2019-09-24T09:49:10Z")

</div>

> [@Trying\_to\_learn](#):
>
> No, I am just confused that I am being pointed to the documentation which is vague.

Then you do think it can be improved. So after you have got your flow working, see if you can do a better job. Have a go modifying the text to make it easier to understand. If you think your modified version is easier to understand, then submit it so that other that are in your situation in the future benefit from the time you spent working it out.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 09:51 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/12 "2019-09-24T09:51:22Z")

</div>

I am having enough trouble understanding what is happening here, now.

The node.... That is WAY in the future.

I accept it: I'm stupid!

I don't like it. I try to learn. All I get is "if you think . . . . . ."

Nah, I'm not going there.  
I'm better than that - in light of a recent post of mine and what happened: I'm shutting up.

---

<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:** [24 September 2019 09:51 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/13 "2019-09-24T09:51:53Z")

</div>

> [@Trying\_to\_learn](#):
>
> a _needle_ is a single pixel. Yeah. but that isn't what is written for that.  
> It says that upto the _value_ all the LEDs are background colour. After the LED they are foreground colour.

Keep reading the documentation and look at the `shift modes`

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 09:53 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/14 "2019-09-24T09:53:54Z")

</div>

I haven't got to that yet.

I have it _working_ in that I send it this:  
(example)  
`0,0,128,0`

Turn on first LED at 50% green.  
It works.  
and  
`0,0,0,0`  
Turns it off.  
This is while the node is in `bar - percentage of length` mode.

And that doesn't make sense looking at it another time.

`percentage of length`.

I send 0,255,255,255

`0`%. Invalid.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 September 2019 10:04 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/15 "2019-09-24T10:04:48Z")

</div>

OK ... it is

- = foreground, . = background, \*=needle

Bar  
`-----....`  
Needle  
`---*....`

foreground and background are set in the node config so can be set to the same colour if you just want the needle to show. The needle defaults to white.  
You can just send a single number for the payload to move the needle to the percentage of the length required.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 September 2019 10:08 UTC](https://discourse.nodered.org/t/help-please-with-the-neopixel-node/15837/16 "2019-09-24T10:08:39Z")

</div>

Ok. I'd call that _peak indication_, but that is me getting picky.

I still don't really get it. But it is working in that I can send commands to turn individual LEDs _on/off_ (with the colour set in the payload) but don't get the other bits.

As I pointed out:  
How can I send `0,128,128,128` and it works (turns on first LED) if it is set to `display percentage`.

0% - That's nothing. Not _the first_.

Anyway, I'll stick my face back against the grind stone.  
Though for me, I have it working to what I want at this stage.
