Git Product home page Git Product logo

unicorn-hat-hd's Introduction

Unicorn HAT HD http://shop.pimoroni.com/products/unicorn-hat-hd

Build Status Coverage Status PyPi Package Python Versions

Installing

Full install (recommended):

We've created an easy installation script that will install all pre-requisites and get your Unicorn HAT HD up and running with minimal efforts. To run it, fire up Terminal which you'll find in Menu -> Accessories -> Terminal on your Raspberry Pi desktop, as illustrated below:

Finding the terminal

In the new terminal window type the command exactly as it appears below (check for typos) and follow the on-screen instructions:

curl https://get.pimoroni.com/unicornhathd | bash

If you choose to download examples you'll find them in /home/pi/Pimoroni/unicornhathd/. To prototype and try out your code without having to deploy it onto a Raspberry Pi every time, you can use the Unicorn HAT simulator to run a mock Unicorn HAT on your computer.

Manual install:

SPI needs to be enabled to communicate with the Unicorn Hat HD. If the SPI on your Pi is not enabled or you are unsure if it is:

sudo raspi-config nonint do_spi 0
sudo reboot

Library install for Python 3:

sudo apt-get install python3-pip python3-dev python3-spidev
sudo pip3 install unicornhathd

Library install for Python 2:

sudo apt-get install python-pip python-dev python-spidev
sudo pip install unicornhathd

Development:

If you want to contribute, or like living on the edge of your seat by having the latest code, you should clone this repository, cd to the library directory, and run:

sudo apt-get install python-dev python-setuptools
sudo python3 setup.py install

(or sudo python setup.py install whichever your primary Python environment may be)

In all cases you will have to enable the SPI bus.

Documentation & Support

unicorn-hat-hd's People

Contributors

asongtoruin avatar cleoqc avatar dependabot[bot] avatar gadgetoid avatar helgibbons avatar iamsrp avatar jayniz avatar lovebootcaptain avatar matthew1471 avatar misterbrash avatar mutiny-games avatar robtom5 avatar roguem avatar sandyjmacdonald avatar tanyafish avatar waveform80 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unicorn-hat-hd's Issues

Feature Request: Animated Weather Icons

Hey there,

just wanted to ask if you would fork my animated weather icons repo for the examples.
i made some icons for old and new unicorn hat (8x8 and 16x16px).
i will maintain and update the icons as often as i can.

https://github.com/LoveBootCaptain/unicornhat_weather_icons

sadly nobody is replying to my mails to the shop how i can contribute some code. so i try this way.

would be great if i can give something back to this great project.

kind regards

Stephan

High performance Unicorn Hat HD

It is not an issue of course, but I have a quick question about the Unicorn Hat matrix. Is there anyway that I can get 200 frame per second (refresh rate) with this library?

thanks

Missing Font in Raspbian Lite

Hi ๐Ÿ˜„

Was scratching my head trying to work out why text demos don't work. Looked at the source and spotted I'm missing a font in the expected path.

Fix was:
apt-get install fonts-freefont-ttf

Suggest adding fonts-freefont-ttf as a dep to https://get.pimoroni.com/unicornhathd

Kind Regards,
Matthew

API documentation 0.0.1 is not up to date with code.

[http://docs.pimoroni.com/unicornhathd/#](API documentation) refer to x and y from 0 to 7 where in the code inline comment, it is obviously from 0 to 15.

Dunno how you create content on docs.pimoroni.com, but you should regenerate it.

example heartbeats.py fail on python3

The title says it all.
Python 2 only code should be banish...

Traceback (most recent call last): File "heartbeats.py", line 46, in <module> for i in 2 * (range(10, 0, -1) + range(1, 10)): TypeError: unsupported operand type(s) for +: 'range' and 'range'

Orientation should be uniform across all examples

Building from #26. Examples currently follow no clear orientation rule, following from work in heartbeats.py I propose that all examples be orientated such that they have the same orientation as the text on the back of the pcb, even those that are technically are direction independant (such as game of life).

This will involve setting the rotation to 270 degrees at the start of all examples.

In the same vein the brightness should probably also be set to a standard level / a standard example template constructed that can be called in each example.

Duplicate key in COLORS

Possibly the most useless issue around but I happened to notice that there is a duplicate of purple in the COLORS list (dictionary?).

Request for more consistent examples

Only a few small niggles, but it would be nice if these could be tidied up. I recently bought a Unicorn Hat HD from https://www.raspberrypi.org/blog/guess-what/ and finally got round to playing with it this evening. I quickly ran through the example demos and noticed:

  1. Not all demos use the same "up direction", meaning you have to keep spinning round your Pi to get each of the demos "looking correct"
  2. Not all demos display the helpful "Press Ctrl+C to exit"
  3. Seems like some demos clear the Unicorn HAT when they exit, but others just leave whatever was last being displayed as still visible

Haven't tried writing any of my own code yet, but the hardware and the demos seem really good ๐Ÿ˜€

bug: show_my_ip displays the ip address regardless of the argument to scroll_text()

This bug is only seen if the user tries to use scroll_text() to show something other than the ip address.

The fix is simple: In the function def create_image_from_text(in_text): the call:

    draw.text((text_x, text_y), my_ip, colours, font=font)

should be:

    draw.text((text_x, text_y), in_text, colours, font=font)

The demo works only when the values of the in_text and my_ip variables are the same. The user will only see the bug if they modify the code to use the scroll_text() function to show something else besides the ip address.

The root problem is that as written the variable my_ip has global scope. If the main code was in a function instead the variable my_ip would have been local to that function and create_image_from_text() would have failed because my_ip would no longer be global and therefor not in scope to the code in that function.

The following design pattern is more robust and would have revealed the error before the code was released:

def do_main_stuff():
    <main code>

if __name__ == '__main__':
    do_main_stuff()

Some example broken with Raspbian Stretch Lite

On a fresh new install, using "pimoroni-dashboard" and fully update minutes ago, some examples are not working. Not sure I got exactly the same version of the example as on github, but I'll assume so as this place has not been updated recently.

Most notably and strange one is "stars.py" and I know this was working with last version of Raspbian:

~/Pimoroni/unicornhathd/examples $ python3 stars.py
Unicorn HAT HD: Stars

This example simulates a wooshing star field.

Press Ctrl+C to exit!

Traceback (most recent call last):
File "stars.py", line 41, in
unicornhathd.set_pixel(stars[i][0], stars[i][1], v, v, v)
File "/usr/lib/python3/dist-packages/unicornhathd/init.py", line 79, in set_pixel
_buf[x][y] = r, g, b
IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Other example just need a little help (I did not test if it is due to "lite" or "stretch"):

"text.py" and "rainbow-text.py" were failing on me, but this solved the problem:

sudo apt install fonts-roboto
(it could be printed at first run or when the exception is raised)

"snake.py" does not work as it need pygame but this solve it for me:

sudo apt-get install python-pygame
(it could be detected as missing at the import time and display instruction to fix it)

PS: I did not test raspicam.py as I had not cam at hand.

any one had luck with piping video?

i love the camera example and have tried to adapt it for streaming m3u8 but my novice python skills are no match. any one have a good example of displaying any video on the unicorn hat hd?

No mention that SPI needs to be enabled

Please can the need to enable SPI be added to the readme.md file. As I get the below error if SPI is not enabled.

>>> import unicornhathd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/unicornhathd/__init__.py", line 20, in <module>
_spi.open(0, 0)
FileNotFoundError: [Errno 2] No such file or directory

This is on a Raspberry Pi Zero W, Python 3.4.2.

Pimoroni HATs not supported for Arch-Linux?

Hi.

After struggling to setup i3 tiling manager for Raspbian, I was recommended by someone over at Reddit to switch to Arch-Linux.
I thought this was a good idea as I'm very familiar with Arch.

But when it came to the installation of the 5 HATs I'm using, I get a message saying:

Your operating system is not supported, sorry!

Is it possible to bypass this?

What is the reason it is not supported?

graph.py error in python3

Traceback (most recent call last):
    File "graph.py", line 38, in <module>
        for x in range(u_width / bar_width):
TypeError: 'float' object cannot be interpreted as an integer

A bug I ran into using Python3. I verified the issue is resolved if forcing integer division:
for x in range(u_width // bar_width):

Unicorn hat hd with jetson Nano

Hi,

I am trying to use NVIDIA jetson nano to control unicorn hat hd thought Jetson.GPIO which is provided by jetson board. It is supposed to replace RPi.GPIO somewhere in unicorn library. Would please please point it out for me?
Have you tested unicorn library on others device containing 40 header pins.

Thanh

Severe banding when using Unicorn Hat with Picamera

Hi

I am using the Unicorn Hat HD for illumination in a microscope. Unfortunately when I capture images I find that my images have severe banding effects (rolling shutter) which corrupts the images. I am in the UK so have tried matching exposure time to both 50hz and 60hz mains frequency but the problem still persists. The only way I can alleviate this is with very long exposures (over 1 second).

I imagine this is down to the PWM control. Is there any way to find out the PWM frequency so that I can match the exposure speed to it? Alternatively, have you ever noticed this problem before, and do you have any suggestions for solutions?

Thanks

stars.py errors

Traceback (most recent call last):
File "stars.py", line 41, in
unicornhathd.set_pixel(stars[i][0], stars[i][1], v, v, v)
File "/usr/lib/python2.7/dist-packages/unicornhathd/init.py", line 79, in set_pixel
_buf[x][y] = r, g, b
IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None ) and integer or boolean arrays are valid indices

Detecting hat using EEPROM Product ID.

Hello!

I'd like to detect whether the Unicorn HAT HD is installed so my Gif2UnicornHat tool can automatically work on both the Unicorn HAT and the Unicorn HAT HD.

With the Unicorn HAT, I can just cat /proc/device-tree/hat/product and it tells me I have a Unicorn HAT installed. That's not so with the Unicorn HAT HD. I get No such file or directory.

I see that the Unicorn pHAT has no EEPROM which means no auto-detect even though the pinout says it has an EEPROM product ID.

So, is there some way to detect this? Or perhaps pinout.xyz is wrong for both the Unicorn pHAT and Unicorn HAT HD?

snake.py requires sudo

On a Pi 3 with Wifi.

python snake.py 
xcb_connection_has_error() returned true
xcb_connection_has_error() returned true
Traceback (most recent call last):
  File "snake.py", line 141, in <module>
    screen = pygame.display.set_mode((160,160))
pygame.error: Unable to open a console terminal

vs

sudo python snake.py 
xcb_connection_has_error() returned true
xcb_connection_has_error() returned true

There be: snakes on an (Euclidean) plane

All the other examples work without sudo.

UniHatHD Lights

Hi guys... I just received my Unicorn HD Today and right off the bat I'm having some problems. I was on Raspbian Stretch but then I downgraded to Jessie thinking that maybe it was incompatible. But still my matrix isn't lighting up AT ALL when I run a demo. I don't think the board is fried because occasionally a row lights up dimly or brightly when I seat the HAT on the GPIO. Why is this happening? I've run the one-time installer.

Bookworm Support

I performed an upgrade to bookworm on my raspberry pi that I use to run a Unicorn HAT HD display. Unfortunately, the display stopped working after the upgrade.

I posted here in the forum to get some assistance:
https://forums.pimoroni.com/t/unicorn-hat-hd-bookworm-challenges/22454

I mention this post because it contains the full output from the automated Unicorn install script.

Someone mentioned performing a manual install. I went to the git page for the HAT, and did this. Via this process, I could see that it was failing first on the python3-spidev package. I was able to force the install of that package with:
sudo pip install spidev --break-system-packages

But the HAT still wouldn't function. After this, I performed an install of the unicornhathd package as follows:
sudo pip3 install unicornhathd --break-system-packages

Via these two commands, the HAT now works again and I have not experienced any system issues otherwise.

I hope this information can help to provide an update to make this functional for others in the future.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.