pimoroni / led-shim

Python library for the Pimoroni LED SHIM
https://shop.pimoroni.com/products/led-shim
MIT License
32 stars 8 forks source link

Ubuntu 20.04 Support for LEDshim and (probably) blinkt #12

Open tstigen opened 3 years ago

tstigen commented 3 years ago

This is on a Rpi 4

First install a normal Raspbian image and run apt update apt full-upgrade (this will update the firmware to the current version)

Now install an image of Ubuntu Server 20.04 (you can use the official Rpi imager app for this)

apt update apt upgrade apt-get install libi2c-dev apt-get install i2c-tools apt-get install libraspberrypi-bin apt-get install python3-smbus apt install python3-pip pip3 install RPi.GPIO pip3 install smbus2==0.4.1 pip3 install spidev==3.5 pip3 install ledshim

in /boot/config.txt (you can install raspi-config to do this as well, but honestly its easier to manually enter the two lines) dtparam=i2c_arm=on dtparam=spi=on

If everything is working, you can test that i2c is working with this command, if all is well you should see a i2c channel matrix in the console with a 75 respresenting the ledshim i2c id. i2cdetect -y 1

If things aren't working, you can check that the i2c and spi kernel modules are loaded, mine were already working but if your modules aren't loaded sudo modprobe i2c-bcm2708 sudo modprobe spi-bcm2708

to get the all the examples to test and develop off of git clone .git

Then depending on how close it is to your desk run a test.py or other example script sleep 15; sudo python3 test.py ( you can omit sleep if you don't need to run to another room to see the lights)

I haven't tried everything, but the 5 examples I tried so far all worked fine.

Some other useful commands while you're checking scripts like the temp script This one will tell you the CPU temp cat /sys/class/thermal/thermal_zone0/temp //divide by 1000 to get Celsius value

These will give you some scripts to run the temperature up so you can watch the temperature script lights change with temperature increase. sudo apt-get install stress-ng mesa-utils stress-ng --cpu 0 --cpu-method fft