Home » A look at the Scroll pHAT

A look at the Scroll pHAT

by shedboy71

The Scroll pHAT provides a matrix of 55 white LED pixels that is ideal for writing messages, showing graphs, and drawing pictures.

Use it to output your IP address, show CPU usage, or just play some basic games. The library actually has a wide range of examples to get you started

Here is a picture of the Scroll pHat

scrollphat

The Scroll pHAT is compatible with all 40-pin GPIO Raspberry Pi variants

Features

  • 55 white LEDs
  • Brightness control
  • Python API
  • pHAT format board
  • Communicates with the Pi over I2C interface

At the heart of Scroll pHAT is ISSI’s IS31FL3730 matrix LED driver chip. It can drive multiple LED matrix and segment display formats and also supports controllable display brightness.

You have to solder a header onto the hat to use it, so some basic soldering skills are required but nothing too difficult

Examples

A stated more information and examples can be found at https://github.com/pimoroni/scroll-phat

Lets look at a couple

This is a basic counting example

[codesyntax lang=”python”]

import sys
import time

import scrollphat


if(len(sys.argv) == 1):
    print("Type a number in under 999 as an argument.")
    sys.exit(-1)
val = int(sys.argv[1])

if(val > 999):
    print("Number must be under 999 to fit on screen")
    sys.exit(-1)

scrollphat.set_brightness(7)

for x in range(1, val+1):
    try:
        scrollphat.write_string(str(x))
        time.sleep(0.35)
    except KeyboardInterrupt:
        scrollphat.clear()
sys.exit(-1)

[/codesyntax]

 

This is one of my favourites, its a binary clock

[codesyntax lang=”python”]

#!/usr/bin/env python

# simple binary clock
# bcd for hours, minutes and seconds
# chart for time past the hour (one light per whole ten minutes)
# please see disclaimer at bottom of file

import sys
import time

import scrollphat


def string_to_bcd(digit):

    bcd_digit = bin(int(digit))[2:]
    return ('00000' + bcd_digit)[-5:]


def plot_digit(digit, position):

    bcd_digit = string_to_bcd(digit)
    for y in range(0, 5, 1):
        scrollphat.set_pixel(position, y, int(bcd_digit[y]) == 1)

while True:
    try:
        current = time.strftime('%H0%M0%S')
        for x in range(0, 8):
            plot_digit(current[x], x)
        for i in range(0, 5):
            scrollphat.set_pixel(10, i, (5 - i) <= ((int(current[3:5])) / 10))
        scrollphat.update()
        time.sleep(0.5)
    except KeyboardInterrupt:
        scrollphat.clear()
sys.exit(-1)

[/codesyntax]

Link

You can but it from

Ebay link

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More