vijayrajanna
Posts: 4
Joined: Tue Jun 14, 2016 5:33 am

Neopixel on Raspi 3

Tue Jun 14, 2016 5:39 am

Hi,
I am trying to run an animation on 60 NeoPixel LEDs (strip).
I have exactly followed the tutorial on Adafruit - https://learn.adafruit.com/neopixels-on ... i/overview, with no success.
The pixels light up randomly.

The pixel strip works fine using an Arduino, hence the strip is good.
I believe the issue is with Level-converter Chip - 74AHCT125.
I see the same issue with or without 74AHCT125.
Is there a way to check if 74AHCT125 is working properly?
How should I go about debugging this issue?

Thanks.

User avatar
Burngate
Posts: 6290
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Neopixel on Raspi 3

Tue Jun 14, 2016 4:34 pm

Probably the easiest way is to disconnect everything from the chip apart from power and ground, and use a meter to check the voltage on the output pin while alternately connecting the input pin to ground and 5v. The output should follow the input.
Instead of the meter, you could use an LED and resistor to monitor the output.

If that works, connect the input to a gpio of your choice, write a short script to slowly cycle that gpio high and low, and watch the LED or meter.

vijayrajanna
Posts: 4
Joined: Tue Jun 14, 2016 5:33 am

Re: Neopixel on Raspi 3

Wed Jun 15, 2016 1:56 pm

Thanks, yes, I tested with a meter and I am sure that the Level-converter Chip - 74AHCT125 is working.
Now I need to test the GPIO.
However, I wonder if GPIO will ever have an issue.

User avatar
Burngate
Posts: 6290
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Neopixel on Raspi 3

Thu Jun 16, 2016 9:52 am

vijayrajanna wrote:... However, I wonder if GPIO will ever have an issue.
There are many ways in which this could be true.
It could be physically damaged, if you've ever connected it to a voltage higher than it can accept, or tried to draw more current from it than it's designed to supply.

A more likely issue is a mistake in your program.
Perhaps an incorrect assumption regarding GPIO numbering - you can refer to a GPIO by its Broadcom number, or its physical pin number, or its WiringPi number.
Getting that wrong means that your signal will appear on a different pin, so your external circuit won't work as expected.

Hence my suggestion to write a small script to flash an LED.

vijayrajanna
Posts: 4
Joined: Tue Jun 14, 2016 5:33 am

Re: Neopixel on Raspi 3

Thu Jun 16, 2016 2:11 pm

Thanks, I will test if there is an issue with GPIO pin.
The program and pin configuration are all correct, I verified it multiple times.

As I had to get the pixels working pin PI 3, I switched **DotStar** which has a separate data and clock lines.
The data and clock can be driven over SPI interface on raspi.
With a level shifter, this set up works like a charm.
So, I am not using neopixel on PI 3 now, however, I must know the reason why it didn't work.
My debugging will continue.

Thanks for your help, I will update this thread with my findings ASAP.

User avatar
kolban
Posts: 143
Joined: Fri Dec 04, 2015 1:45 am
Location: Texas, USA

Re: Neopixel on Raspi 3

Thu Jun 16, 2016 2:59 pm

For my play on NeoPixels, I used a $3 Arduino Nano as the controller for the NeoPixels. I then configured the Nano as an I2C slave and used I2C from the Pi to drive the Nano. Effectively, the Nano becomes a NeoPixel driver receiving instructions from the Pi. Timing issues and everything else were no longer an issue and I could focus on the logic of what I wanted the pixels to do and no longer be concerned over low level timings from the Pi.
FREE book on Raspberry Pi usage and programming

https://leanpub.com/pi

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Neopixel on Raspi 3

Thu Jun 16, 2016 3:47 pm

AIUI the neo-pixels work by having a long string of instructions with the first neo pixel stripping off the instruction from the front of the queue and passing the remainder onto the next pixel (and so on, until all the pixels have received an instruction).

the issue with long chains of neo-pixels is that the FIFO buffer can overfill and the timing suffers, resulting in lost messages.

See this post:
joan wrote:
BMS Doug wrote:
joan wrote:I would like to point out that pigpio can not drive WS2812B (or similar) LEDs with waveforms.
A chap did manage to drive a few of the WS2812B LEDs with pigpio and SPI but it was not reliable for more than a few LEDs.
Grumpy Mike wrote: That makes no sense at all. The signals are regenerated on each WS2812b LED so if you can drive one you can drive any length of string of LEDs. What your "chap" probable did was run out of current on the 5V supply from his Raspberry Pi.
Not so, each additional LED needs it's own instruction string. The shorter the LED chain the less instructions transmitted.

Each WS2812b removes the first set of instructions then retransmitted the rest.
Correct. If the complete message fits in the SPI FIFO (from memory 128 bytes) then it was OK. Otherwise there is a point where the FIFO needs to be refilled in a timely fashion and that could not be guaranteed as the software to refill the FIFO was subject to Linux scheduling.

These refill errors are rare but each one causes the LED chain to reset, a highly visible glitch (so I'm told, I don't have a LED strip myself).
Confirmation method: send a signal to the first 10 LEDs and see if they operate as expected, if so repeat with the first 20, 30, 40 until your glitches return.

Workaround: if you find a point where you can reliably get a number of LEDs operating you could split the chain of 60 LEDs into sub chains, each run from a separate GPIO.
Doug.
Building Management Systems Engineer.

rhildinger
Posts: 32
Joined: Thu Jun 09, 2016 6:07 pm

Re: Neopixel on Raspi 3

Thu Jun 16, 2016 5:02 pm

vijayrajanna wrote:Thanks, yes, I tested with a meter and I am sure that the Level-converter Chip - 74AHCT125 is working.
Now I need to test the GPIO.
However, I wonder if GPIO will ever have an issue.
I wonder you are running into the same issue that we have with driving the HUB75 RGB matrix display panels. The problem is that the rpi_ws281x library is using the PWM module (GPIO 18) to drive the data line of the neopixels, which unfortunately conflicts with the built-in audio hardware which uses that same GPIO 18 to drive the audio output. Depending on your configuration of Raspbian, the sound drivers can be more aggressive in taking away control of GPIO 18 from any other process.

Here is a potential work around:

Create a kernel module blacklist file that prevents all the sound drivers from loading:

1. sudo vi /etc/modprobe.d/blacklist-rgb-matrix.conf
2. add the following lines:

blacklist snd_bcm2835
blacklist snd_pcm
blacklist snd_timer
blacklist snd_pcsp
blacklist snd

3. Save the file and quit vi
4. sudo update-initramfs -u
5. reboot and confirm no "snd" modules are running by executing the command "lsmod"

Now give your code a try and see if that helps...

animocap
Posts: 1
Joined: Thu Oct 13, 2016 10:21 am

Re: Neopixel on Raspi 3

Thu Oct 13, 2016 10:37 am

I tried using the rpi_ws281x library mentioned in the adafruit page https://learn.adafruit.com/neopixels-on ... i/overview. with a raspberry pi 3 and a ws2812 led strip.
It does say that there were reports it doesn't work on newer raspberry pis. I looked at the output on an oscilloscope and the waveform seemed too wide. Anyway after some fiddling around I changed this line in the file ws2811.c:

Code: Select all

#define OSC_FREQ 19200000   // crystal frequency
to:

Code: Select all

#define OSC_FREQ 76800000   // crystal frequency
And it worked. This is just a quick code hack as I'm not sure if this actually reflects the real crystal frequency of the pi 3, but it was the simplest line to change in the code to get the desired effect.

sanjayd
Posts: 12
Joined: Wed Aug 14, 2013 8:56 am

Re: Neopixel on Raspi 3

Mon Nov 14, 2016 6:47 pm

animocap wrote:I tried using the rpi_ws281x library mentioned in the adafruit page https://learn.adafruit.com/neopixels-on ... i/overview. with a raspberry pi 3 and a ws2812 led strip.
It does say that there were reports it doesn't work on newer raspberry pis. I looked at the output on an oscilloscope and the waveform seemed too wide. Anyway after some fiddling around I changed this line in the file ws2811.c:

Code: Select all

#define OSC_FREQ 19200000   // crystal frequency
to:

Code: Select all

#define OSC_FREQ 76800000   // crystal frequency
And it worked. This is just a quick code hack as I'm not sure if this actually reflects the real crystal frequency of the pi 3, but it was the simplest line to change in the code to get the desired effect.
Changing the Frequency did not help on the Raspberry pi 3. But the code did work on the Raspberry Pi 1 without any change. I had my old Pi and installed the program and ran the strandtest.py which worked very well. I could address each LED and color manually with Python commands.

Whats the problem with Raspberry Pi 3.

ydefeldt
Posts: 1
Joined: Wed Dec 14, 2016 1:13 pm

Re: Neopixel on Raspi 3

Wed Dec 14, 2016 1:26 pm

I was having the problems driving WS2812 on a Raspberry Pi 3. The LEDs were flickering a bit and did not work..

As stated here there could be some problems with having the sound card enabled at the same time as using the WS2812.
https://github.com/jgarff/rpi_ws281x/wiki

To disable the sound card use this guide:
http://www.instructables.com/id/Disable ... /?ALLSTEPS

I now have a working strand of 8 WS2812 running on Raspberry pi 3 - I am using a level converter from 3.3V -> 5V and did change the frequency as proposed earlier in the thread. But I am not sure if neither of that is necessarily, as the WS2812 usually works from 3.3V logic in practice..

bfelch
Posts: 1
Joined: Sat Mar 11, 2017 9:19 pm

Re: Neopixel on Raspi 3

Sat Mar 11, 2017 9:23 pm

ydefeldt wrote:I was having the problems driving WS2812 on a Raspberry Pi 3. The LEDs were flickering a bit and did not work..

As stated here there could be some problems with having the sound card enabled at the same time as using the WS2812.
https://github.com/jgarff/rpi_ws281x/wiki

To disable the sound card use this guide:
http://www.instructables.com/id/Disable ... /?ALLSTEPS

I now have a working strand of 8 WS2812 running on Raspberry pi 3 - I am using a level converter from 3.3V -> 5V and did change the frequency as proposed earlier in the thread. But I am not sure if neither of that is necessarily, as the WS2812 usually works from 3.3V logic in practice..
This is exactly what I needed. I disabled the sound card but did not change the frequency and my strand is now working as expected.

timnixon
Posts: 2
Joined: Tue Sep 05, 2017 4:41 pm

Re: Neopixel on Raspi 3

Tue Sep 05, 2017 4:44 pm

Had a similar issue.. a new raspian and fresh complete install and like magic it was working.. Interestingly enough I had the same symptoms.. just flickering, and perhaps the same cause: I had installed a USB based audio device..

Great that its working now!!

shahidare
Posts: 3
Joined: Thu Aug 09, 2018 6:07 am

Re: Neopixel on Raspi 3

Thu Aug 30, 2018 7:51 am

https://www.youtube.com/watch?v=YMqaNId5_ls&t=50s

We used fadecandy to control 4661 neopixels using raspberry pi 3.

Return to “Advanced users”