-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Raspberry PI directly to 8 x 32 not working? #1
Comments
Hi, Unfortunately this project does not support driving the LED matrix from a Raspberry Pi alone. Instead it's expected that the LED matrix is driven via micro controller that either supports MicroPython (e.g. PyCom devices) or the Arduino FastLED library (e.g. a Teensy). The error message happens because the current code think it's running on the "host side" and expects to find a micro controller to talk to (using a special protocol) over a serial interface. When the serial port wasn't available the code crashed. Thanks for the link to the tutorial. It seems they make use of https://github.com/jgarff/rpi_ws281x to generate the necessary signals to control the LEDs using existing hardware on the Raspberry Pi. It also seems there are Python bindings available for this library: https://github.com/rpi-ws281x/rpi-ws281x-python. I suppose it would be technically possible to implement the HAL (hardware abstraction layer) expected by this project on top of the rpi-ws281x-python library. Something that would provide most of the methods as seen in upyhal.py. You would then need to make some modifications to main.py to make it all work because currently it's a bit of a mess to detect if the code is running on the host side or on the MCU side. |
Hi, @evanjmg, did you manage to port this project to run the led matrix natively connected to the pi? |
NOTE: weatherscene.py is known to NOT work under Python 3.x due to an incompatibility with MicroPython's handling of strings and bytes. This can be easily resolved although I opted to not do this, to preserve compabilitity with the original code. To use this on a Raspberry Pi, try: sudo apt install -y python-pip python-requests sudo pip install rpi_ws281x Then connect the display's data line to the Raspberry Pi's GPIO 18 (PCM CLK) (see https://pinout.xyz/) References: - #1 - https://github.com/rpi-ws281x/rpi-ws281x-python (userspace WS281x driver) - https://github.com/jgarff/rpi_ws281x (wiring docs)
Hi @willumpie82, @evanjmg. I just pushed two changes that should allow you to try this project on a Raspberry Pi (tested on a 3 model B+). To try it out: # Install dependencies
sudo apt install -y python-pip python-requests
sudo pip install rpi_ws281x
# Per the instructions on https://github.com/jgarff/rpi_ws281x#pwm
echo blacklist snd_bcm2835 | sudo tee /etc/modprobe.d/snd-blacklist.conf
echo hdmi_force_hotplug=1 | sudo tee -a /boot/config.txt
echo hdmi_force_edid_audio=1 | sudo tee -a /boot/config.txt
sudo reboot
# Wait for the Raspberry Pi to reboot Next, clone this repo and download necessary resources: git clone https://github.com/noahwilliamsson/lamatrix
cd lamatrix
# Download icons (see https://github.com/noahwilliamsson/lamatrix/tree/master/icons)
curl -o icons/game-brick.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=1524
curl -o icons/game-invaders-1.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=3405
curl -o icons/game-invaders-2.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=3407
curl -o icons/game-tetris.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=4007
curl -o icons/game-nintendo.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=5038
curl -o icons/game-pacman-ghosts.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=20117
curl -o icons/game-pingpong.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=4075
curl -o icons/game-snake.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=16036
curl -o icons/matrix.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=653
curl -o icons/newyears.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=9356
curl -o icons/tv-movie.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=7862
# Convert JSON to a less verbose binary representation
scripts/convert-animation.py icons/*.json
rm icons/*.json
# Download weather icons (see https://github.com/noahwilliamsson/lamatrix/tree/master/weather)
curl -o weather/sunny.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=1338
curl -o weather/sunny-with-clouds.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=8756
curl -o weather/cloud-partly.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=2286
curl -o weather/cloudy.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=12019
curl -o weather/fog.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=17056
curl -o weather/moon-stars.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=16310
curl -o weather/rain-snow.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=160
curl -o weather/rain.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=72
curl -o weather/snow-house.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=7075
curl -o weather/snowy.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=2289
curl -o weather/thunderstorm.json https://developer.lametric.com/api/v1/dev/preloadicons?icon_id=11428
# Convert JSON to a less verbose binary representation
scripts/convert-animation.py weather/*.json
rm weather/*.json Wire up the display's +5V, GND and DIN to the Raspberry Pi header pins 4 (5v Power), 6 (GND) and 12 (GPIO 18 PCM CLK) respectively (see https://pinout.xyz). Finally, try running the code: python main.py |
It works (Y) on my rpiZeroW I do have one challange and that is the rotation of my individual panales are rotated 90degr each. I have CJMCU-8*8 panels from Ali, i'll rotate them edit: |
You could try to modify My particular 32x8 display is laid out in a zig-zag pattern with the first eight pixels starting at the top-left corner going down in the first column. Pixels 9-16 start in the bottom of the second column going upwards. The above mentioned method takes care of translating a (x,y) coordinate (with (0,0) being the top-left corner) in a grid of HTH. |
Thanx for the hints, I came up with a formula to calculate (verified in Excel), need to be extended to be more configurable, and input and outputs protected for invalid values phys_addr = ((x-1)%self.panelcolumn) + ((y-1)*self.panelcolumn) + (self.round_down((x-1)/self.panelcolumn) * self.panelcolumn * self.panelrow) results in: edit: |
Hi, thank you so much for this LED text example! I'm a total noob but got my 8 row x 32 columns BTF - 256 pixels working with this other tutorial to display animated rainbows etc. However, I can't seem to get anything running with your code - I get the following port error below. Did I miss a step? Thank you for such a detailed readme - I've followed all the python setup and am using the pin setup from the other tutorial above.
The text was updated successfully, but these errors were encountered: