Can anyone help setting up PiGlow on OSMC?

I was wondering if anyone has PiGlow set up on OSMC. I am trying to run the test.py script and I keep getting this message:

Traceback (most recent call last):
File “test.py”, line 7, in
from piglow import PiGlow
File “/home/osmc/piglow/piglow.py”, line 16, in
import RPi.GPIO as rpi

I am ultimately trying to install PiGlow information addon and I can’t get the test script to run because of these errors. I had this problem with 14.1 Raspbmc which is why I never switched to it.

I tried this: sudo apt-get -y install python-rpi.gpio

and got this: E: Unable to locate package python-rpi.gpio
E: Couldn’t find any package by regex ‘python-rpi.gpio’

and tried this: sudo apt-get -y install python3-rpi.gpio

and got: E: Unable to locate package python3-rpi.gpio
E: Couldn’t find any package by regex ‘python3-rpi.gpio’

and I can’t get either to install. I don’t know what the real issue is and how to resolve it but this addon was designed for XBMC/KODI and someone in the comments on that link said they had it working on OSMC alpha2. Thank you for your time any help would be appreciated!

Ok after following every instruction in the previous comments from the link I get this:

Traceback (most recent call last):
File “test.py”, line 9, in
piglow = PiGlow()
File “/home/osmc/piglow/piglow.py”, line 33, in __ init __
self.bus = SMBus(i2c_bus)
IOError: [Errno 2] No such file or directory

I don’t know what the problem could be now. I give up. For now.

got i2c enabled under firmware settings ?

Where exactly would I find these settings? Under My OSMC>Pi Config>Hardware Support I found these two options:
LIRC GPIO Support and W1Gpio.

I know LIRC GPIO is for IR remotes so it is not enabled.
I left the options under W1Gpio at their defaults since I don’t know what they do or what they’ll change. The options are as follows:
-gpio-out-pin, -gpio-in-pin, -gpio-in-pull and w1gpio.

gpio out pin has a value of 17, gpio in pin has a value of 18 and gpio in pull has “none” selected with the option of “up” or “down”. And w1gpio is set to “none” with two options: “w1-gpio-pullup-overlay” or “w1-gpio-overlay”.

dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on

try sudo apt-get install python-pip

sudo pip install rpi.gpio

then it will install the missing python package

Ok wow this is new to me. so I just add the dtparam settings you mentioned to config.txt?

Begin with adding that python package via pip see if it starts working if it doesn’t try the config.txt param

I added these dtparams like so to config.txt and ran sudo apt-get install python-pip and sudo pip install rpi.gpio. Both python package commands said they were up to date. I’m still getting the same error though. BTW I really appreciate your help Toast!

since i dont own a piglow myself but i do got stuff using i2c since i hate it when rpi2 get confused and thinks its 1970 i added a hwclock to my rpi2 thats why i know how shitty documentation there is on i2c stuff outthere…

now in your case i think i found a way with this guide

do the preparation stuff

you can do the additional stuff to just for testing then your addon should work when the test files are done.

remember if there isnt any file for raspi-blacklist.conf create it and add the content

This is the first step I took to installing the PiGlow information addon I have linked in my first entry on this post. I got snagged on the sudo python test.py part. So I referred to the PiGlow information addon link and followed the directions in the comments. After going through those instructions I hit a snag with that i2c_bus error.

I’ve done it before on Raspbmc so long ago when it was pretty simple to just follow the instructions and get it working. I just kept the same img up until 13.2. Stability slipped soon after support was dropped. I started on a B model and kept the same img on a 4gb card and just went through the updates leading up to 13.2. Once I switched to B+ I carried the img over to an 8gb card but couldn’t figure out how to expand memory to use the additional 4gb eventually the system became very stressed for memory. I tried 13.2 on a fresh 8gb to see if I could upgrade but ran into the same problems I have now so I just kept my old card.

But with new improvements with OSMC I wanted to upgrade. Really what I liked about PiGlow info addon was being able to monitor volume and progress of media playing with the LEDs. Those were the two main functions I got the most use out of. The other less important function I monitored was temperature. It never really lit up other than the first LED probably because of heatsinks.

I’ve set it up on Raspbian on Pi2 as well no problem. In Raspbian I followed the directions from Boeeerb’s github to have it run binary clock script on bootup.

Keep in mind that osmc doesn’t use raspbian on the pi2.
So some packages are not available that are in raspbian.

I figured as much since OSMC was built on Jessie and Raspbian is still Wheezy based. Early on PiGlow didn’t work on Pi 2 at all due to the implementation of EEPROM in post Pi 2 addons boards before they adopted the term HAT.

First Script

This script should enable the piglow and make it work

    #!/bin/bash
    touch /etc/modprobe.d/raspi-blacklist.conf
    sudo sed -i /etc/modprobe.d/raspi-blacklist.conf -e "s/^blacklist[[:space:]]*i2c-bcm2708.*/#blacklist i2c-bcm2708/"
    		
    sudo modprobe i2c-bcm2708
    sudo modprobe i2c-dev
    sudo dtparam=i2c_arm=on" | sudo tee -a /boot/config.txt
    echo "i2c-dev" | sudo tee -a "/etc/modules"
    echo "i2c-bcm2708" | sudo tee -a "/etc/modules"
    sudo apt-get --force-yes --yes install python-dev python-pip python-smbus
    sudo pip install piglow -I
    reboot

Second script

This script should be the software part think this one is just testing stuff still worth installing since you can see that everything is working the way it should.

    #!/bin/bash
    WORKING_DIR=$USER_HOME/Pimoroni
	if ! [ -d $WORKING_DIR/piglow ]; then
		echo "Downloading PiGlow examples..."
		export TMPDIR=`mktemp -d /tmp/pimoroni.XXXXXX`
		cd $TMPDIR
		git clone https://github.com/pimoroni/piglow
		cd $WORKING_DIR
		mkdir piglow
		cp -R $TMPDIR/piglow/examples/* $WORKING_DIR/piglow/
		rm -rf $TMPDIR
		echo ""
		success "Examples copied to $WORKING_DIR/piglow/"
	
	else
		if confirm "Examples already exist, shall I replace them?"; then
			mv $WORKING_DIR/piglow $WORKING_DIR/piglow-backup
			echo "Updating PiGlow examples..."
			export TMPDIR=`mktemp -d /tmp/pimoroni.XXXXXX`
			cd $TMPDIR
			git clone https://github.com/pimoroni/piglow
			cd $WORKING_DIR
			mkdir piglow
			cp -R $TMPDIR/piglow/examples/* $WORKING_DIR/piglow/
			rm -rf $TMPDIR
			echo ""
			warning "I backed up the examples to piglow-backup, just in case you've changed anything!"
			success "Examples copied to $WORKING_DIR/piglow/"
		fi
	fi

	echo ""
	
	success "All done!"
	echo ""
	echo "Enjoy your new PiGlow!"
	echo ""
	echo "Note: PiGlow currently supports Python 2 only."
	echo ""

else
	echo ""
	echo "Aborting..."
	echo ""
fi

try that see if this gets it working removed the raspbian parts in the script so that it installs the software needed for communicating with the piglow its not using any necessary raspian specific software yet they implemented a raspbian check for some dumb reason, try it worst of it fails or works :smiley: who knows kinda hard to do this with no actual hardware.

if this stuff works then my guess is that the kodi addon for piglow is gonna work also

@DxFx see if the script above makes your piglow work

Hey sorry it’s been a while since I’ve logged on. Ok so I don’t really know how to test this. I’m still new to most of this stuff. But from the looks of it you seem to know your way around. Maybe if I could send you a PiGlow board you could try to see if you could get it working? They’re not too expensive and I don’t mind the cost for the greater good. If you could get it working you could start a permanent thread for PiGlow support. Looking for a solution I’ve come across other people blogging about wanting to use PiGlow with this new OSMC. Let me know and I’ll order one as soon as I get the chance.

Since I just spent the last hour setting this up for myself, I wanted to make sure I documented the steps I took.

I don’t use my piglow as an OSMC status indicator, but I am a fan of running Boeeerb’s binary clock script on it beside my TV, because who doesn’t like blinky lights?

I hit upon the following steps through trial and error and some fancy Google skills.

sudo apt-get update sudo apt-get install python-dev python3-dev sudo apt-get install python-pip sudo apt-get install gcc sudo pip install rpi.gpio sudo apt-get install python-smbus python-psutil -y sudo pip install piglow -I sudo easy_install -U distribute

Next you need to edit three files, adding lines to the end of them:

sudo nano /etc/modules
i2c-dev
i2c-bcm2708

sudo nano /etc/modprobe.d/raspi-blacklist.conf
#blacklist spi-bcm2708
#blacklist i2c-bcm2708

sudo nano /boot/config.txt
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on

After all that, you should at least be able to run Boeeerb’s scripts. I don’t know if it will specifically assist in the OSMC status light add-on, but it’s a step in the right direction in any event.

1 Like

Thanks for posting! I haven’t checked in a while. What version of Pi do you have? I recently got the PiGlow working on the Pi3 running Raspbian so I know it works. I wasn’t sure how to enable i2c on OSMC so I will have to try this out. I don’t know how much success I might have since most of the info out there is outdated. But it’s worth a shot! Hopefully my PiGlow will rise from it’s grave like Altered Beast!

Hello Guys, I have a similar problem, Mys system OSMC with Raspberry2.

My installation was with no problem till “Starting your script”

I can’t do:
"mkdir /home/pi/piglow

cd /home/pi/piglow"

at the terminal :
mkdir: cannot create directory ‘/home/pi/piglow’: No such file or directory
cd: /home/pi/piglow: No such file or directory

any idea what is wrong?

test.py works successfully but can’t add any script