lucas1
Posts: 6
Joined: Sun Jul 22, 2018 7:39 am

neopixel led matrix

Sun Jul 22, 2018 7:50 am

Hi,
I would like to ask if it is possible to connect the led matrix (8x 32 flex led matrix) to raspberry pi
https://www.adafruit.com/product/2294


If so, in what way and if there are any libraries that help me control it?

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: neopixel led matrix

Sun Jul 22, 2018 10:20 pm

I have not used this exact product but I assume that it should be able to be used with RPi.

Neop Pixels are a bit complicated to use with RPi but doable.

Here is a short video that I made about using NeoPixels on RPi. https://www.youtube.com/watch?v=v7FoA8fZJQA

In that video I was powering the NeoPixels from the 5v pin on the RPi and that is ok if your only powering a few LEDs but if you want to power lots of LEDs like this matrix then it will need to be powered by an external power source that is capable of supplying the needed amps.

The LEDs need a supply of 5v to run and the data pin is supposed to get min of 0.7 of of the power supply (0.7 * 5v = 3.5v), the RPi data pin only outputs 3.3v so it is technically below the specs of 3.5v so many tutorial show using a level shifter to convert the 3.3v to 5v on the data pin but I have used Neopixles on RPi, ESP32 and STM32 (all 3.3v systems) and never used a level shifter just connecting the data pin to the Neoppixel strip directly and never had a problem.

To use Nowpixels on the RPi the software uses DMA transfer to the PWM channel to create all the on/off switching needed to communicate with the NeoPixels, the is exactly what the sound does to output to the speaker jack. So to use this channle for Neopixels you will need to disable the sound jack, see my earlier posted video.

Here is a link to Adafruit setup tutorial of the software https://learn.adafruit.com/neopixels-on ... i/software

lucas1
Posts: 6
Joined: Sun Jul 22, 2018 7:39 am

Re: neopixel led matrix

Mon Jul 23, 2018 10:50 am

Thank you for the tip
https://www.smart-prototyping.com/blog/ ... D-tutorial
Hmm look at this guide. I know it is for arduino, but can I use this solution? That I use such external power and connect through one data pin from RPi?

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: neopixel led matrix

Mon Jul 23, 2018 9:03 pm

This is how you will have to connect it.

Connect a 5v power supply (that is rated for enough amps) to the Neopixels then connect the data pin to the RPi and also connect a common ground to both the power supply and the RPi as the data signal that the RPi sends out needs to be able to return back to the RPi ground and the power that is sents out from the supply needs to return to the power supply ground.

Forris
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 280
Joined: Fri Jan 06, 2012 7:46 pm

Re: neopixel led matrix

Fri Jul 27, 2018 3:32 pm

The Pi can play quite happily with these, you just have to use the right Python library.

Firstly, there are some links on the page you referenced. Click them and read. Adafruit are experts in NeoPIxels and give a lot of information.

It seems that they have an Arduino library for the matrix, but not sure about Python. There is, however, a very good tried-and-tested library for general NeoPixel control - https://learn.adafruit.com/neopixels-on ... i/software. Read through all the information and you should be able to get started having some sparkly fun! The only downside with this standard library is that you'll have to work out the maths to convert a linear address to a matrix address.

As for powering them, in my experience they're quite happy with a little less than 5v, so just use 3 standard AA batteries or 4 rechargeable AAs. This will have the added benefit of ensuring that the data voltage from the Pi (3v3) is greater than 70% of the supply voltage, which means they should work reliably.

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: neopixel led matrix

Sat Jul 28, 2018 8:10 am

so just use 3 standard AA batteries or 4 rechargeable AAs.
In the specs of these LED matrix it says they can use up to 15amps, my understanding is that AA batteries struggle to supply anything more than 1 Amp. AA batteries would be a great solution for a small number of LEDs but I would be interested to know if they could power a LED matrix like this 1.

lucas1
Posts: 6
Joined: Sun Jul 22, 2018 7:39 am

Re: neopixel led matrix

Mon Aug 06, 2018 9:05 pm

Thanks for your help


Yesterday, all the equipment came to me and I started working with raspberry pi. It seems to me that I am doing something wrong with this matrix. LEDS don't shine.

I connected it in this way
Image

I use the code that you suggested to me from adafruit -> this https://learn.adafruit.com/neopixels-on ... i/software

Maybe I really did something wrong with the power supply

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: neopixel led matrix

Mon Aug 06, 2018 10:04 pm

By the look at it you have connected the power to 1 end and the data to the other end. You will need to make sure that you have connected both to the input end of the neopixel matrix. Each neo pixel has a data in pin and data out pin to chain them together. You need to connect your RPi data out pin to the first neo pixel data in pin.

You will have to alter the config.txt to turn the Audio off as the NeoPixels use the audio PWM channel to create the data waves.

In the config.txt you need to commit out these 2 lines with #

Code: Select all

# Enable audio (loads snd_bcm2835)
#dtparam=audio=on
As for wiring you will need a wire that goes from 5v on Neopixel to 5v battery and a wire from GND on neopixel to both battery and RPi and a wire from Data In on Neopixel to RPi data out pin.

Do be aware on the neopixel strip I have in front of me 5v is red and gnd is white and data is green. This is a little strange as 1 would expect gnd to be green not white. Look at your neopixel close to make sure the wiring is correct.

lucas1
Posts: 6
Joined: Sun Jul 22, 2018 7:39 am

Re: neopixel led matrix

Tue Aug 07, 2018 1:27 pm

everything works, tkanks, all LEDs are lit even at maximum brightness :D

Do you have an interesting example from python to learn how to use api?

https://learn.adafruit.com/neopixels-on ... i/software
Because here shows how to use the straps and not the matrix

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: neopixel led matrix

Tue Aug 07, 2018 10:13 pm

lucas1 wrote:
Tue Aug 07, 2018 1:27 pm
everything works, tkanks, all LEDs are lit even at maximum brightness :D

Do you have an interesting example from python to learn how to use api?

https://learn.adafruit.com/neopixels-on ... i/software
Because here shows how to use the straps and not the matrix
I would be very causoius about using max brightness on all LEDs at same time because the current draw will be very high and everything will likely get very hot very fast.

Now although the LEDs are physically in a square matrix as far as the LEDs and software is concerned they are all in a line. You will have to look at how the orfder is setup, I assume the LEds will follow a line then when they get to the end of a line they will then start at the beginning of the next line this is how real screens work. Real screen has 1 continual line of pixels in memory but then when the screen displays the pixels when it gets to the end of the line it wraps around and starts again at the beginning of the next line I row lower down. You can write a function that converts the x,y coordinates to the linear position in the LED strip like this linear_position = y * number_pixels_in_row + x

Return to “Python”