Dalius's blog

Thursday, November 2, 2023

Keyboard with joysticks (part 4): PSP 2000 joystick added

Previous parts:

As I don’t want to wait until missing part arrives I have decided to give another chance to PSP 2000. It is a shitty joystick, but actually it works. Here how it looks like on my keyboard:

Keyboard

As suggested by u/MexPayneDive20 I have cut some plastic and soldered wires directly. I am not sure if that has any side effects or this joystick is really shitty, but again min axis value is not 0 but something about 250 (and actually different for X and Y). In other side I have soldered to 5V, GND, GP26 to X and GP27 to Y. Here is how it looks like in other side before soldering:

Keyboard

It is kinda usable, but I had to make some changes. Here is full QMK code for the keyboard (work in progress, naturally):

https://github.com/daliusd/qmk_firmware/commits/joyride-w

Now again it is really shitty joystick and when I move it to left it is not returning to start position and starts sliding to left (wondering pointer issue). I am using code from this PR (https://github.com/qmk/qmk_firmware/pull/21883 - it is not yet in QMK master) and I solved wondering pointer by settings initial weights to zero.

I have added scrolling on joystick when I click NAV layer button and had to make it slower. Good thing it is documented here:

https://github.com/qmk/qmk_firmware/blob/master/docs/feature_pointing_device.md

So I will use this for a while and will search how I can improve it further. As I am not happy that you must somehow figure out what’s axis min value for your keyboard.

Now if you want to try this out you will need branch mentioned above and those two commands:

make handwired/joyride:default:uf2-split-left
make handwired/joyride:default:uf2-split-right

BTW, if you want to figure out what’s min axis value for your keyboard you can do it like this.

Enabled debugging in rules.mk by adding line:

CONSOLE_ENABLE = yes

Modify drivers/sensors/analog_joystick.c by adding:

#include "print.h"

    ...
    uprintf("Read %ld %d\n", pin, position); // you will find where to add this

Use hidlisten (https://www.pjrc.com/teensy/hid_listen.html) utility to see output. On Ubuntu I compile it and run:

sudo ./hidlisten