[SOLVED] Problems with Unicorn pHAT Software

Hi folks,
i bought two Mood light kids last week and have some problems with it.
When i start a program for the Unicorn pHAT, it takes up to 20sec until it runs on the pHAT.
During this time i can see - in my case - two static leds lit and then it runs normal, BUT…
After a while, the file system went read only and i cant edit my program over ssh on the Pi any more.
A reboot fix this problem temporarely until i start the program again.
This happens also with the included demo examples which come with the download-install of the Unicorn HAT software.

I tried to investigate the problem and tested some other pi’s (3x Pi Zero, 2x Pi3 and one Pi2), 12 different SD-Cards, and 4 different original Raspberry-Powersupplies, but no luck.
Also a change between Raspian Stretch Light and Jessy Light doesnt help - the file sys went read only on both systems.
Its really boring to do always a reboot during tinkering around with my python scripts so maybe someone can help to investigate whats wrong.

EDIT: I forgot to mention, that the load on the Pi3 is terrible high after starting a program for the unicorn pHAT.
Its over 3.75 (max. is 4.00) and it takes more then a minute until the load went down to a value under 1.00
Maybe this infos can help to investigate the problem too.

Thanks for your help

I hate to be unhelpful, but you might be interested in following any answers that I may get on my post for my Unicorn HAT, as my current problem started off just as your describe for yours.

I don’t know if it’s related, but this same issue was reported here: https://github.com/jgarff/rpi_ws281x/issues/208

And is claimed to be resolved by the suggestions here: https://github.com/jgarff/rpi_ws281x/issues/188

I’m confused that this problem has suddenly appeared out of nowhere, and that I haven’t encountered it myself, but it seems like there’s a potential fix in these issues that I will have to test this coming week.

If you’re confident tweaking the libraries and want to test this solution earlier, you could try grabbing the code from GitHub and editing this line: https://github.com/pimoroni/unicorn-hat/blob/master/library/UnicornHat/unicornhat.py#L15

…to read “LED_DMA = 10” and then reinstall the library from this source with “sudo python ./setup.py install”.

Well, while looking into another issue I stumbled upon this one and managed to re-create it. That’s progress at least! It seems that changing LED_DMA to 10 does fix it.

I’ve now pushed Unicorn HAT version 2.2.2 and rpi_ws281x-python version 3.0.2 which should fix:

  • SD card becoming write-only and Pi freezing
  • Gamma correction (or lack thereof) causing a washed out and over-bright appearance.

You can update with:

sudo pip install unicornhat --upgrade
1 Like

I installed your upgrade and what shall i say… Colors and brightness are not the same anymore.
Amber-Yellow (255,50,0) is now red/orange, light-blue (0,50,255) is now dark and the brightness at 0.5 is like at 0.1 …
I am not happy with this…

EDIT: Brightness at 1.0 is like 0.4 before… hmmmm…

Wait, you prefer it without gamma correction!? I did wonder why I didn’t hear a lot more complaining about the gamma correction being broken.

For the record, what you’re seeing how is the correct way, and what you saw before was a bug that resulted in bright, over-saturated pastel colours. However, there’s always the quote “a bug is a feature you can’t turn off” so clearly I’m going to have to make the gamma table user-settable.

Update: I’ve added disable_gamma and set_gamma in GitHub to this end. It’ll find its way into Unicorn HAT 2.2.3 and require RPi-WS281-Python 3.0.3 which I’ll aim to release ASAP.

Update 2: Pushed. Try sudo pip install unicornhat --upgrade

Then add unicornhat.disable_gamma() to the top of your code.

WOW! My colors are back! Thank you very much for this great support! Now it’s perfect!
By the way, you are right - one sees it as a bug, i see it as a feature ;-)))
I like the possibility to oversaturate the colors for some projects ;-)
Thanks again for implementing the user-settable gamma.

Thats tinkering on a high level!!! Great work!

You’re welcome! I had planned to implement it at some point anyway, but no time like the present!

That solved my problems too with Unicorn HAT on Raspbian Stretch, wrong gamma and brightness, lockups and read-only problems and now everything works great, thank you!