Skip to content

This gadget uses a forked version of David Carrion's firmware. Converts DB9 joysticks button presses to keyboard scancodes for ESPectrum PS/2 port with ATMEGA 328P (Arduino Pro Mini)

License

Notifications You must be signed in to change notification settings

hash6iron/PowaJoy

 
 

Repository files navigation

powajoy_logo_negro

Release notes

  • 07/10/2024 - Added bill of materials list.
  • 01/10/2024 - Powajoy added new feature, simulation of popular Sinclair ZX Spectrum+ reset button for ESPectrum emulator. This button emulates the F11 key pressing. Now is coded in pin A4

Important notes

This gadget uses a forked version of the original DB9_2_Keyboard firmware by David Carrión (https://github.com/dacarsoft/DB9_2_Keyboard).

This version only covers PS/2 driver of the original firmware for LilyGo TTGO VGA, Olimex FabGL and others. This firmware was modified to adapt to Arduino Pro Mini ATMEGA 328P 5V 16MHz (not USB support) to be used with ESPectrum emulator, but it's possible to adapt to others micro (See info/ folder to see information about pinout and below to conversion pin-out)

PowaJoy schematic

This is the schematic to make a Powa-joy. It's a conversor circuit from DB9 (joystick ports) to PS/2 for ESPectrum emulator on ESP32 LilyGo TTGO VGA board, Olimex FabGL board and others. This project uses the firmware by David Carrion (DB9_2_Keyboard_ESPectrum - See description below) but has been adapted to ATMEGA 328P micro.

See (schematics/esquema_328P.pdf)

esquema_v2

This fork aims to translate joysticks/pads button presses to keyboard presses by using a generic ATmega 328P boards Arduino Pro Mini, but is possible to integrated on, Arduino UNO, Arduino Micro and Arduino Nano, and others one.

Bill of material (BOM)

Here I put some of the main materials that you need to ensamble a powaJoy.

In case that you want a better board support, is making a PCB available on PCBWay site (soon)

Arduino Mini

image

See schematic for connection, above.

Arduino Nano

Pin coversion for Arduino Nano, see below.

Arduino Nano --> Arduino Mini

VCC --> 5V

GND --> GND

LED

  • D13 --> PIN 13

SPECTRUM+ RESET BUTTON

  • A4 (D18) --> A4

PS/2 (DATA / CLK)

  • DATA: D10 --> PIN 10
  • CLK: D12 --> PIN 12

PORT 1

  • D8 --> PIN 8
  • D9 --> PIN 9
  • D11 --> PIN 11
  • A0 --> A0
  • A1 --> A1
  • A2 --> A2
  • A3 --> A3

PORT 2

  • D0 --> PIN 0
  • D1 --> PIN 1
  • D2 --> PIN 2
  • D3 --> PIN 3
  • D4 --> PIN 4
  • D6 --> PIN 6
  • D7 --> PIN 7

image

Arduino UNO

Pin coversion for Arduino UNO, see below.

Arduino UNO --> Arduino Mini

VCC --> 5V GND --> GND

LED

  • 13 --> PIN 13

PS/2 (DATA / CLK)

  • DATA: PIN 10 --> PIN 10
  • CLK: PIN 12 --> PIN 12

SPECTRUM+ RESET BUTTON

  • A4 --> A4

PORT 1

  • PIN 8 --> PIN 8
  • PIN 9 --> PIN 9
  • PIN 11 --> PIN 11
  • PIN A0 --> A0
  • PIN A1 --> A1
  • PIN A2 --> A2
  • PIN A3 --> A3

PORT 2

  • PIN 0 --> PIN 0
  • PIN 1 --> PIN 1
  • PIN 2 --> PIN 2
  • PIN 3 --> PIN 3
  • PIN 4 --> PIN 4
  • PIN 6 --> PIN 6
  • PIN 7 --> PIN 7

image

DB9_2_Keyboard (by David Carrión - Forked by hash6Iron)

Firmware to converts DB9 joysticks button presses to keyboard scancodes through PS/2 port.

This translation is a big help for ESPectrum (official website https://zxespectrum.speccy.org or project repository https://github.com/EremusOne/ZX-ESPectrum-IDF ) with LilyGo board to use conventional 80's DB9 joysticks or compatible DB9 gamepads (wired or not like as 8-bitDO gamepad tested)

The code sends keystrokes when a button is pressed on a joystick. Two simulatenous joysticks are supported. PS/2 keyboard scancodes are sent. The supported joysticks are standard one-two buttons joysticks, Sega three buttons joysticks and Sega 6 buttons joysticks.

The USB detection is done in the first seconds from the boot when the ATmega board is connected to a PS/2 port and powered up. ESPectrum does a negotiation to comunicate with PowaJoy.

The default map for each joystick to execute the translation from joystick buttons is done according to these sequences:

DB9 PORT 1 (PS/2):

CURSOR UP, CURSOR DOWN, CURSOR LEFT, CURSOR RIGHT, RIGHT ALT, ENTER, ESCAPE, F1, Z, Y, X, M

Q, A, O, P, M, ENTER, ESCAPE, F1, Z, Y, X, C

CURSOR UP, CURSOR DOWN, CURSOR LEFT, CURSOR RIGHT, ZERO, ENTER, ESCAPE, F5, Z, Y, X, M

SEVEN, SIX, FIVE, EIGHT, ZERO, ENTER, ESCAPE, F1, Z, Y, X, M

DB9 PORT 2 (PS/2):

Q, A, O, P, M, ENTER, ESCAPE, F1, Z, Y, X, C

CURSOR UP, CURSOR DOWN, CURSOR LEFT, CURSOR RIGHT, RIGHT ALT, ENTER, ESCAPE, F1, Z, Y, X, M

CURSOR UP, CURSOR DOWN, CURSOR LEFT, CURSOR RIGHT, ZERO, ENTER, ESCAPE, F5, Z, Y, X, M

SEVEN, SIX, FIVE, EIGHT, ZERO, ENTER, ESCAPE, F1, Z, Y, X, M

The keymaps can be changed by pressing a direction button (up, down, left, right) while the board is plugged or powered up.

FLASH INSTRUCTIONS:

Tha Arduino IDE and tools can be used, but to flash easily the firmware on the ATmega 328P this DIY keyboard's updater program can be used also by using the .HEX file available under the build/PowaJoy folder of the project. Flash tools could be downloaded from:

MAC OS: https://github.com/qmk/qmk_toolbox/releases/download/beta/QMK.Toolbox.app.zip

WINDOWS: https://github.com/qmk/qmk_toolbox/releases/download/beta/qmk_toolbox.exe

To upload using AVRDUDE - Example:

  • avrdude -c arduino -P COM4 -b 115200 -p atmega328p -D -U flash:w:firmware.hex

About

This gadget uses a forked version of David Carrion's firmware. Converts DB9 joysticks button presses to keyboard scancodes for ESPectrum PS/2 port with ATMEGA 328P (Arduino Pro Mini)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.4%
  • C 5.6%