I have a Pi (not sure which one 3 I think) I have a unicorn hat HD from pimeroni and have downloaded the software from github to run it GitHub - pimoroni/unicorn-hat-hd: Python library and examples for Unicorn HAT HD
The software has gone onto a stick plugged into the Pi, with the tophat also plugged into the socket down oneside of the Pi,
When I plug the Pi in the tophat (an led board) all lights up as if it is properly connected.
The Pi sees the stick and if I click on one of the .py files in examples it opens geary and loads the file so I can see the program lines in geary. If I then go to build/execute it opens the run box and then crashes saying it can’t find a file. Each example I try does the same but fails to find a different file.
The downloaded files includes a library directory, do I need to load the libraries in first and if so how do I do that.
Otherwise what am I failing to do before running an example program (are they called sketches similar to the arduino?)
To install the libraries you run
curl https://get.pimoroni.com/unicornhathd | bash
as per the instructions here,
GitHub - pimoroni/unicorn-hat-hd: Python library and examples for Unicorn HAT HD
You run that command from terminal on that Pi, that needs to be connected to the internet.
To run the examples I personally (like most here) use Thonny.
This may come in handy
Welcome — Unicorn HAT HD 0.0.2 documentation
thank you for that.
I did as you directed and I think it was just that I did it at tea time as it took so long to reach the pictures below, I think it stopped for it’s tea and went down the pub for a few drinks before giving me the screen below.
Do you know what I am doing wrong?
As it happens I visit your building from time to time with the Aspire crew in Sheffield, might it be possible to drop in sometime and try to sort this ?
here are the specs (it would only let me send one picture at a time)
As far as I know I am using a debian package here are the specs
Bookworm uses a Python Virtual Environment. PITA if you ask me.
Some info can be found here.
Virtual Environments, Libgpiod, gpiodevice and the current mess I’m making of our Python libraries - Support - Pimoroni Buccaneers
I don’t work for of have any affiliation with Pimoroni. I’m in Canada eh, =) on the other side of the big pond.
You can contact tech support for more detailed help though.
Contact Us for Raspberry Pi Technical Support - Pimoroni
Thank you alphanumeric, the contact you link to is this forum site.
If I have the files you point to in github by typing
is it possible to run them from the stick? what command would I need to do that as I can’t find a file called unicornhathd?
I have opened a ticket with the pimoroni home site asking for help and linking this thread, lets see if I get a reply.
If you go here,
pimoroni/unicorn-hat-hd: Python library and examples for Unicorn HAT HD
and click the green code button.
You can download it all in a zip file. Then unzip it and transfer to your USB thumb drive (stick). I would then copy it to your Pi and then cd to the library directory, and run:
sudo apt-get install python-dev python-setuptools
sudo python3 setup.py install
You will likely have to do this from the virtual environment.
There is a way to disable / bypass the virtual environment. But it’s not at all recommended. And I’ve been chastised for doing it. That being said, it your really stuck, I can post how to do it.
For what it’s worth @alphanumeric , I had some Pimoroni BLINKT modules in my “this’ll come in useful one day” box for many many years. Having spotted your bypass routine a short while back I gave it a go and managed to get the BLINKTs working easily for the first time.
This virtual environment malarky is way beyond user friendly especially for the older stuff’s script installers.
When the virtual stuff gets in the way the bypass is worth it’s weight in chocolate :)
It’s been a headache for me, especially with older retired hardware.
Another option, if it’s not a Pi 5, is to just install an older version of Pi OS.
Index of /raspbian/images
What version works on what Pi can be found here.
Raspberry Pi OS - Wikipedia
Just tried with a Pi 5 / Bookworm - this sequence got things lighting up for me:
First I enabled SPI in sudo raspi-config
and rebooted.
Then I created a virtual environment:
python -m venv --system-site-packages ~/.virtualenvs/pimoroni
and activated it:
source ~/.virtualenvs/pimoroni/bin/activate
Then I installed the UHHD library and supporting packages using pip
:
pip install unicornhathd spidev numpy
Then I downloaded the examples from Github, navigated to them and ran them thus:
git clone https://github.com/pimoroni/unicorn-hat-hd
cd unicorn-hat-hd/examples
python demo.py
The examples run really fast on a Pi 5 :D
Weeelllllll!!! thanks for all the replies.
I am very impressed and extremely grateful.
Having sent a request straight to Pimoroni I got an e-mail saying hel had replied on this site so I just went straight to that thread and followed the instruction.
Thanks hel I tried your method and understanding due to my previous efforts the SPI is enabled I passed that one and did the rest.
When I got as far as downloading the files from github my computer sat for a while at 7%, went to 35% and then gave up with errors.
The next line was
cd unicord-hat-hd/examples
to which it said “no directory found”
so I did the load github line again and this time it loaded in without errors, morale: if you don’t succeed keep trying.(my poor internet reception I guess).
This time cd unicorn-hat-hd/examples and python demo.py worked.
I opened thorny as alphanumeric advised and loading and running the examples from within there is easy.
Thank you all so much for all your interest.