Defective Unicorn hat? (Random colors showing) [SOLVED]

When I run any demo I just get random flashing colors on the unicorn hat matrix. Nothing looks sane or intelligible. I get about 1 second of movement of colors and then a second of stillness.

I also audibly head a buzzing through the speakers when it is updating.

The power supply is a 2A USB power pack.

Is something wrong, or is my unicorn hat defective?

I believe I installed everything correctly and am running the demo correctly:

I installed everything using “\curl -sS get.pimoroni.com/unicornhat | bash” and as far as I know it worked.

I then cd into the unicorn had directory and I see the demos there like rainbow.py

I try to run one using “sudo python rainbow.py”/

Also: Does the company have any customer service or support for hardware problems?

UPDATE: Apparently, you cannot have sound enabled when using the unicorn hat, for reasons that are either bad design or are just plain undocumented. Comment out the sound if you do not have HDMI sounds, and it will work.

Why is this happening? Is is bad hardware design or bad software design?

And, why must everything about the Raspberry pi be obscure, poorly documented, and be full of gotchas and interactions?

It’s not bad design on either the hardware or software front, it’s because the Raspberry Pi uses the same PWM hardware to generate analog audio as we use to generate a signal for Unicorn HAT.

Without using a separate micro-controller to generate that signal ( which is what Sense HAT does, although it uses completely different LEDs altogether too ), this is the only way WS2812 pixels will work on the Pi at all, so it’s seen as an acceptable compromise.

The Pi is designed to be a hackable product, rather than a finished solution- therefore gotchas and interactions are the accepted norm. There’s a lot of software and hardware coming together from lots of different people, some of those people do it as a hobby, it’s pretty much chaos! The Pi will never “just work” although we spend a lot of time trying to make it easier.

You’re right that the audio interfering with Unicorn HAT could be better documented, however! I’ll update the product description and GitHub page.

Thank you very much for the reply. It was polite, clear, and I understand it.

Is there a way to get audio on the pie and use the unicorn? For example, does the problem go away if I buy a USB audio adapter? Or, will it still try to generate PWM audio?

I do understand the need for the use of PWM with the WS 2812 B controller chips. I wish there were an SPI to WS 2812 B converter chip. That would make the interface to these LED strips trivial.

Yes, documenting this interaction would be a wonderful thing and as a courtesy to others. I’m sure a lot of time gets spent on this problem, and it’s frustrating to realize your time is been wasted. Documentation would not unsell devices, but would be respectful of others. Thank you.

1 Like

I’ve updated the product page, and will update the GitHub ASAP.

I believe a USB adaptor will work, but I haven’t actually tested this- I’m sure I’ve got several lurking about somewhere, so I can give it a go.

I’m not sure how you’d go about switching the Pi to output all sound over the USB adaptor, either, it’ll warrant some investigation!

An AVR like the 328p on the Arduino Uno could be used as an SPI or I2C to WS 2812 converter, but it’d push the price of the Unicorn HAT up quite significantly if we put one on there. You can use more or less any Arduino as a bridge for the Unicorn HAT and stuff jumper wires into it, if you have one spare.

It may not be of help in this situation, however I believe sound via HDMI is not affected

Correct, although monitor doesn’t do HDMI audio.

The solution was to buy a USB sound card. That, too, worked.

Perhaps the 50¢ they saved to put a terrible sound chip on the Pi was not a good choice.