Actually, that probably makes no difference. I suspect you’ll still get the same error.
Can you post the output of
Your guess was right. I get the same error message even when the Hat is off.
The output of uname -a is:
pi@raspberrypi:~/unicorn-hat/python/examples $ uname -a
Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux
I think there is a value trying with the HAT off. If nothing else we’ll know whether the error occurs regardless of this particular unit being used.
I get the same error when the Hat is off.
Hmm, what tells us that? Obviously the hardware and software requirements are met:
It’s a Raspi 2, with Raspbian Jessy installed, with all the software up to date.
The Unicorn Hat installation script has installed all the necessary software, hasn’t it? (see the output of pip list above)
So for the Unicorn python scripts it obviously makes no difference if the Hat is on or off, so maybe the error occurs because the Hat is not recognized at all. Because it’s broken?
I have no idea. Any more guesses?
I don’t think the HAT is the culprit, I do not get that error (or any error) running that script on a bare Pi. I tried with 3 different ones now, just to be sure, using a clean but updated Jessie.
I am not sure what the problem is, the main difference I can see between my tests and yours is that your Pi is obviously not the one I’m using. That’s not to say I think it’s defective, but it’s a possibility.
I think we need to summon the whiz @gadgetoid here to shed some light on the error itself… but from what I can tell the init can’t assess that PWM is working properly and I can reproduce the error if I target a pin other than 18.
Oh, that’s a possibility that hasn’t come to my mind yet. Apart from that the Pi is working fine, but maybe it’s the culprit.
Maybe gadgetoid can make sense out this all. Thanks so far.
Did this ever get resolved because I’m having the same problem and error code with the only difference being that my Raspberry Pi model is a B+ which I thought was more compatible with the Unicorn Hat anyway, but apparently not. I have tried your auto set-up command on multiple different images (fresh install) including the latest Raspbian Jessie, but to no luck I still get the same error message. I really don’t think my Raspberry Pi is broken as it is relatively unused, but maybe coincidentally me and bingobongo just got lucky with 2 broken models. My Unicorn Hat is brand new and came in the mail 2 weeks ago, but with multiple efforts to get it working I have had no luck. I would like if this issue could get re-looked at or at least get a status update and maybe get some comment from @gadgetoid if he hasn’t already starting looking in to it.
I believe this issue might be related: https://github.com/jgarff/rpi_ws281x/issues/93
IE: A driver level fix is required to get it up and running with whatever has changed recently. It’s on my TODO list.
I’ve pushed up rpi_ws281x v2.0.2 to, hopefully, fix this issue both on existing Pi’s and the new rev 1.3 Pi Zero which is also unknown to the library.
sudo pip install -I rpi_ws281x
It looks like there are two problems:
Garbled/intermittent display on Unicorn HAT/PHAT
On Raspbian 2016-05-10 / NOOBS 1.9.1 booting to X seems to do something with analog audio, where it would have otherwise been left alone and worked, mostly, by sheer luck. You need to force your Pi to HDMI audio using these lines in
This pretends an HDMI monitor is plugged in, and that it supports audio.
You can also start in CLI mode, which doesn’t load whatever audio stuff is being used in X and has the same effect.
Failed with code -1
If you see something like
ws2811_init failed with code -1 this is because you’re running an old version of the rpi-ws281x library on a Pi that it doesn’t recognize. This could be hardware version 0x13 which is a previously unsupported version of the Model B+ as far as I’m aware, or much more likely version 0x900093 which is the Raspberry Pi Zero v1.3 ( new model with camera port )
In this case, the instructions in my post above should work:
sudo pip install -I rpi_ws281x
Unicorn HAT - latest Raspbian [ SOLVED ]
Thanks for the hint. However, meanwhile I swapped the Hat with the pHat which works without any problems right from the beginning.
Thanks for your help so far, but I’m sorry to say your fix for the error code -1 did not work for me. I tried running your command after a fresh install, but still got the same error. I also looked at the comments for the similar error posted on github that you linked and could understand their reasoning for the error and even saw that another user linked files for a supposed fix, but in trying to install those files I got lost on how to put them on my device as I could not see a setup.py to run. Also, out of curiosity I have a question as to how RogueM supposedly had it working on his devices as stated above. Was he using an outdated version of the driver or was the whole Unicorn Hat package outdated? If his success was due to an outdated package, would linking one be possible? I understand the answer to these questions are probably no as he did state he was using a clean but updated Jessie, meaning it should be the same as mine, but I’m just puzzled as to why his is working and not mine.
Again, thanks for help so far and sorry your fix didn’t work. Hope to hear back from you soon.
To answer the question regarding the setup I was running at the time I posted, this would have been my day-to-day Jessie based Pi3 as well as the same Pi with a clean SD imaged with fresh Jessie available at the time (which has now been superseded).
I then checked on a Pi2 and B+ using the same clean fresh SD. All those tests were within a X session, at the terminal, and using the latest libs available, not a prior version. Lib install via one-line installer, which means pip supplied version, and all known requirements fed from repo as the script enforces.
… my last tests involved a mod of the unicorn lib itself, targeting pin 17 instead of 18 (ran into error) and as I recall pin 12 (no error) hence my suggestion that pin 18 is not responding as expected to the library probe, which seems in line with @gadgetoid detective work at first glance.
Still, I have no idea why it would work for me on what seems to be as identical a setup as those who ran into issues. Colour me confused too. I’m away until the weekend so won’t be able to try the latest Raspbian + rpi_ws281x until then.
I’ve just successfully run Unicorn HAT on a fresh install of the latest full Jessie version, installing the Unicorn HAT library with
curl https://get.pimoroni.com/unicornhat | bash, modifying the
/boot/config.txt as above, and then rebooting. This was on a brand new Pi Zero.
@traptest it might be worth trying to clear out old versions of the library first, perhaps. It also depends if you’re using Python 2.x or 3.x since “pip install” will only update the library for 2.x.
If you’ve got a revision 0x13, Model B+ then this fix will certainly be the one you’re looking for. Try running the following to see what revision you’re running:
cat /proc/cpuinfo | grep Revision
You can try reinstalling the library for Python 2 and 3 like so:
sudo pip uninstall rpi_ws281x sudo pip3 uninstall rpi_ws281x sudo pip install rpi_ws281x sudo pip3 install rpi_ws281x
Unicorn pHAT and zero w (mood light kit)
@gadgetoid OK, so I don’t have totally good news in that the Python driver library re-installs did not get the Unicorn Hat command to resolve its same error code -1, but in running the Revision command I found out that I do not indeed have a revision 0x13 but instead a 0x10 which I would assume is quite outdated and probably the first revision. Hopefully this difference in revisions has been the culprit to my troubles all along and with this new information you can better be lead to uncover why the command is not working on my device. Revision 0x10 is supported and compatible with the Unicorn Hat, right? I would hope that all this trouble was not for a silly mistake on my part for not realizing that my revision is incompatible. Thanks again for your fast replies and new suggestions. Below will be an output of the
cat /proc/cpuinfo command. Hopefully it helps.
pi@raspberrypi:~ $ cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 2.00
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture : 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 1000010
@traptest now I’m only more confused! Revision 0x10 is the original revision of the Model B+, and 0x13 is the same B+ but with a v1.2 PCB revision. Both should be compatible with Unicorn HAT.
Your Pi is absolutely compatible, but something else is clearly afoot. It’s likely the
ws2811_init failed with code -1 RuntimeError is masking more than one underlying problem, and we’ve been barking up the wrong tree.
What do you see if you run:
@gadgetoid I’ve listed the output of the two commands below.
pi@raspberrypi:~ ** uname -a Linux raspberrypi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux **pi@raspberrypi:~ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
I’ve just set up a Model B, revision 0x10, with the latest Raspbian Jessie and it works fine. You should probably try updating and see if that helps:
sudo apt-get update sudo apt-get upgrade
If you see any errors about packages held back, you might need a more thorough update command. But we’ll cross that bridge if we come to it!