Persons with disabilities related to communication may utilize grid based communication systems as Alternative Augmentative Communication (AAC). One such web based and open source system is AsTeRICS Grid developed in Vienna under government funding with the goal of making this type of communication free and accessible to all. It has a wide range of features and input methods, one of which is the Huffman input method which assigns key combinations to each cell.
This got me thinking about Adafruit's NeoKey Emoji Keyboard project and what a great fit it would be for this type of input. I managed to tweak the project's file so each key press sends the numbers 1- 4 to support navigation through the cells. Thanks to Liz Clark for the code and wonderfully helpful and easy to follow tutorial!
# SPDX-FileCopyrightText: 2021 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Modified August 7, 2024 by Loreto Dumitrescu for Huffman input
import time
import board
import busio
from adafruit_neokey.neokey1x4 import NeoKey1x4
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
# use STEMMA I2C bus on RP2040 QT Py
i2c_bus = busio.I2C(board.SCL1, board.SDA1)
# Create a NeoKey object
neokey = NeoKey1x4(i2c_bus, addr=0x30)
# create a keyboard object
keyboard = Keyboard(usb_hid.devices)
print("Huffman Input Device")
# states for key presses
key_0_state = False
key_1_state = False
key_2_state = False
key_3_state = False
while True:
# switch debouncing
# also turns off NeoPixel on release
if not neokey[0] and key_0_state:
key_0_state = False
neokey.pixels[0] = 0x0
if not neokey[1] and key_1_state:
key_1_state = False
neokey.pixels[1] = 0x0
if not neokey[2] and key_2_state:
key_2_state = False
neokey.pixels[2] = 0x0
if not neokey[3] and key_3_state:
key_3_state = False
neokey.pixels[3] = 0x0
# if 1st neokey is pressed...
if neokey[0] and not key_0_state:
print("Button 1 pressed")
# turn on NeoPixel
neokey.pixels[0] = 0xFF0000
# open macOS emoji menu
keyboard.send(Keycode.ONE)
# delay for opening menu
time.sleep(.2)
key_0_state = True
# if 2nd neokey is pressed...
if neokey[1] and not key_1_state:
print("Button 2 pressed")
# turn on NeoPixel
neokey.pixels[1] = 0xFFFF00
# open macOS emoji menu
keyboard.send(Keycode.TWO)
# delay for opening menu
time.sleep(.2)
key_1_state = True
# if 3rd neokey is pressed...
if neokey[2] and not key_2_state:
print("Button 3 pressed")
# turn on NeoPixel
neokey.pixels[2] = 0x00FF00
# open macOS emoji menu
keyboard.send(Keycode.THREE)
# delay for opening menu
time.sleep(.2)
key_2_state = True
# if 4th neokey is pressed...
if neokey[3] and not key_3_state:
print("Button 4 pressed")
# turn on NeoPixel
neokey.pixels[3] = 0x00FFFF
# open macOS emoji menu
keyboard.send(Keycode.FOUR)
# delay for opening menu
time.sleep(.2)
key_3_state = True
This project can be a great device to support users with physical disabilities who may otherwise struggle with directly selecting cells on the grid but do have movement in their fingers. This project also requires no soldering and is beginner friendly making it possible for novice makers to support the need. Here is a quick overview video of how it all functions.
This page (Hoffman Input Device using Neokey 1x4 for AAC Access) was last updated on August 08, 2024.