Python Forum
Address WS2811 LED matrix attached to Raspberry Pi 3 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Address WS2811 LED matrix attached to Raspberry Pi 3 (/thread-7382.html)



Address WS2811 LED matrix attached to Raspberry Pi 3 - sebar - Jan-07-2018

Hi guys!
I ran into some trouble programming a DIY LED panel that is attached to my Raspberry Pi 3.
The hardware setup is like this:
  • a long stripe of WS2811 LEDs cut into pieces of 24 each
  • 4 of these pieces arranged horizontally, making a 24x4 LED matrix
  • the strips are soldered together on the left and right so they all get signal and power
  • all done according to this tutorial: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=201753 with the exception that my panel is directly connected to the pi - no other hardware or power supply is necessary.
Since I'm completely new to python and all my research led me only to failures I want to ask you for advice. The setup I explained above is working perfectly fine. I just want the LED matrix to show something else than the "strandtest.py" has to offer: https://github.com/jgarff/rpi_ws281x/blob/master/python/examples/strandtest.py

I'm just unable to change the code to get the result that I want. The "strandtest.py" runs several test patterns, that look really nice, but I want:
A) Scroll any given text
B) display an audio spectrum analyzer based on sound input

Is that possible? Can you help me with that?


RE: Address WS2811 LED matrix attached to Raspberry Pi 3 - sebar - Jan-08-2018

I made some humble progress and want to specify my problem a little further.
I installed the PIMODORI'S "unicornHAT" library:
curl https://get.pimoroni.com/unicornhat | bash
The scripts that came with it allow me to display example graphics on my DIY panel - so far so good.
The problem is, that I don't know how to customize the layout (from 8x8 to 24x4). The graphics are displayed fractured - of course - and only part of my panel is used.

Here is an example ("simple.py"). Can you help me customizing the code?
#!/usr/bin/env python

import time

import unicornhat as unicorn


print("""Simple

Turns each pixel on in turn and updates the display.

If you're using a Unicorn HAT and only half the screen lights up, 
edit this example and  change 'unicorn.AUTO' to 'unicorn.HAT' below.
""")

unicorn.set_layout(unicorn.HAT)
unicorn.rotation(0)
unicorn.brightness(0.5)
width,height=unicorn.get_shape()


for y in range(height):
  for x in range(width):
    unicorn.set_pixel(x,y,255,0,255)
    unicorn.show()
    time.sleep(0.05)

time.sleep(1)



RE: Address WS2811 LED matrix attached to Raspberry Pi 3 - Gribouillis - Jan-08-2018

You could perhaps write text in four pixels font


RE: Address WS2811 LED matrix attached to Raspberry Pi 3 - sebar - Jan-08-2018

That's missing the point...
I can't address the panel properly - the image appears fractured.


RE: Address WS2811 LED matrix attached to Raspberry Pi 3 - sebar - Jan-08-2018

Let me elaborate...
pi@raspberrypi:~ $ sudo ./rpi_ws281x/test -sgbr -x24 -y4 -g18 -c
Runs awesome! It generates a scrolling rainbow over the whole panel!
But I don't find a way to make it display stuff THAT I WANT...

In other folders, such as
pi@raspberrypi:~/Pimoroni/unicornhat/examples
There are a couple of cool example scripts that would really help me,
but they don't run over the whole panel and appear fractured!

How can I get these two together...?