Skip to content
/ UnoKb Public

Simple macro keyboard with Arduino Uno and Python

Notifications You must be signed in to change notification settings

flowln/UnoKb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnoKb - Ayy another macro keyboard

This is a simple macro keyboard made to work with an Arduino Uno board without firmware modification. The board communicates with a Python program on the computer side via the serial port. Currently it only works on Linux!

My board (made in TinkerCad): My board setup

Dependencies

For the arduino side, if you want LCD support (enabled by default), you'll need LiquidDisplay. You can install it via the Library Manager in Arduino IDE, or via arduino-cli with arduino-cli update && arduino-cli lib install LiquidCrystal.

On the Python side, you'll need Python 3.x with the following external modules:

Files

There are four files on this repository:

  1. unokb.py: This is the python script that spawns and kills the daemon on the computer. It receives the inputs from the board and translates that into commands and/or scripts to be run on the PC. It also sends to the board the selected mode.
  2. UnoKb.ino: This is the arduino program. It has options to disable LCD support before compilation, as well as customize the pin layout and the latency settings. It polls the input pins every x milliseconds (by default, x is ~50ms), and sends the appropriate message to the serial port in case any pin is pressed.
  3. install_arduino.sh: This is a simple linux utility script to compile and install the UnoKb.ino program on the board.
  4. monitor.sh: Another simple linux utility, to monitor the serial port for debug. I kept forgetting the command to do so, so that's why this script exists. :P

How to use

Firstly, you should take a look at both the .ino and .py files, and adjust them to your preferences. Probably the most important things to take note are the pin numbers in the .ino file, and the macros / modes in the .py file.

Once this is done, install the sketch with your preferred tool (if on Linux, the install_arduino.sh script should work if you have arduino-cli installed on your machine).

Finally, you (should) be able to start the Python program, which will spawn a daemon process that communicates with the board on the background. To stop the daemon, just run the python program again.

Debugging

To debug problems on the board, make sure the python program is not running, and use the monitor (either via arduino-cli or via the Arduino IDE interface) to see what's going on in the serial port. There's also a debug setting in the .ino file, which prints some more debug info to the port.

For the Python side, make sure the stdout and stderr lines at the end of the file are uncommented, as they can provide valuable information about what's going wrong.

TODO:

  • Add Windows support

About

Simple macro keyboard with Arduino Uno and Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published