Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Created November 9, 2022 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akkiesoft/5adf8b801e9f63460bdd98c79f2ab4fe to your computer and use it in GitHub Desktop.
Save Akkiesoft/5adf8b801e9f63460bdd98c79f2ab4fe to your computer and use it in GitHub Desktop.
Play Raspberry Pi HAT boards on the StackyPi GPIO

Play Raspberry Pi HAT boards on the StackyPi GPIO

Requires

  • StackyPi or a board with GPIO design compatible with StackyPi

matrix

Product MicroPython CircuitPython
BLINKT! Not tested OK
Unicorn HAT Not tested OK
Scroll pHAT HD OK No (*1)
Nokia5110 / PCD8544 Module OK No (*1)

(*1) Can not detect device with StackyPi GPIO design (maybe).

BLINKT!

CircuitPython example

It can be controlled with the adafruit_dotstar library.

import board
import adafruit_dotstar as dotstar
dots = dotstar.DotStar(board.A0, board.A1, 30, brightness=0.02)
dots[0] = (255, 255, 255)
dots[7] = (255, 255, 255)
dots.show()

Unicorn HAT

CircuitPython example

It can be controlled with the neopixel library.

You can use example from https://learn.adafruit.com/circuitpython-essentials/circuitpython-neopixel and set board.A2 to pixel_pin and set 64 to num_pixels.

import neopixel

pixel_pin = board.A1
num_pixels = 64

pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.03, auto_write=False)

Scroll pHAT HD

MicroPython example

It can be controlled with the adafruit's is31fl3731 library.

https://github.com/adafruit/micropython-adafruit-is31fl3731

import time
from machine import I2C, Pin
import is31fl3731

i2c = I2C(0, scl=Pin(21), sda=Pin(20))
display = is31fl3731.Matrix(i2c)

def scrollphathd_pixel(x, y, b):
    py = 6 - y
    if (x < 9):
        px = 8 - x
    else:
        px = x - 9
        py = y + 8
    display.pixel(py, px, b)

brightness = 10
scrollphathd_pixel( 0, 0, brightness)
scrollphathd_pixel(16, 0, brightness)
scrollphathd_pixel( 0, 6, brightness)
scrollphathd_pixel(16, 6, brightness)

Nokia5110 / PCD8544 Module (Raspberry Pi form factor)

MicroPython example

You can use example from https://github.com/Akkiesoft/akkiesoft-pico/blob/main/MicroPython/test-pico-pcd8544/test-pico-pcd8544.py and change these parameters and use SoftSPI instead of SPI.

from machine import Pin, SoftSPI

cs = Pin(9)
dc = Pin(8)
rst = Pin(27)
spi = SoftSPI(sck=Pin(7), mosi=Pin(28), miso=dc)
print(spi)

lcd = pcd8544_fb.PCD8544_FB(spi, cs, dc, rst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment