Wednesday, August 31, 2016

Introducing the Joey Raspberry Pi Display

Gooligum Electronics (could they be more Australian?) recently sent me a Joey board to play with.

These boards are incredibly good value at $8 (the American sort of dollar) and a neat design that uses offset holes in the PCB so that it will slide over your Raspberry Pi's GPIO connector while leaving you access to the pins for other uses. This works well, with just the right amount of offset to ensure a good connection without bending the pins.

To make use of the Joey, you'll need to go and get the Python library for it.

Install it using the command:

git clone https://github.com/gooligumelec/Joey-support-Python-code.git

The Joey board also uses I2C so you will need to enable I2C which you can do from the Preferences->Raspberyy Pi Configuration menu option.

You'll also need to install smbus using the commands:

sudo apt-get install python-smbus

I tried out one of the example programs inside the folder joey_clock.py

cd Joey-support-Python-code
sudo python joey_clock.py

The Joey also has a row of three jumpers on the front that you can attach buttons to. Just the job for a Squid Button!

I added the Squid Button so that the clock could switch between showing the hours:mins or seconds. The modified program is listen below:

import time
import datetime
from joey_support import joeyBoard

display = joeyBoard()

show_seconds = False

# Continually update the time on the "Joey" 4 char, 7-segment display
  if display.getJumpers() == 7:
      show_seconds = not show_seconds
  now = datetime.datetime.now()
  hour = now.hour
  minute = now.minute
  second = now.second
  if show_seconds:
      display.writeDigit(3, int(second / 10))   # Tens
      display.writeDigit(4, second % 10)        # Ones
      # Set hours
      display.writeDigit(1, int(hour / 10))     # Tens
      display.writeDigit(2, hour % 10)          # Ones
      # Set minutes
      display.writeDigit(3, int(minute / 10))   # Tens
      display.writeDigit(4, minute % 10)        # Ones
  # Toggle colon
  display.setColon(second % 2)              # Toggle colon at 1 Hz
  # Wait one second

No comments: