Alessio
Published © GPL3+

Amiga PiJoystick

Control your Amiga 9-pin Joystick port with a Raspberry PI.

BeginnerWork in progress2 hours1,962
Amiga PiJoystick

Things used in this project

Hardware components

Raspberry Pi 1 Model B+
Raspberry Pi 1 Model B+
Any type of Raspberry PI should be OK
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×5
Resistor 100 ohm
Resistor 100 ohm
×5
Resistor 10k ohm
Resistor 10k ohm
×10
Jumper wires (generic)
Jumper wires (generic)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Story

Read more

Schematics

Raspberry 2 Amiga port board schematics

The schematic is very straightforward, we are taking advantage of the NPN transistor's ability to act as a ON/OFF switch.
Every Amiga pin is connected to the collector's transistor with a 100 Ohm resistor between them,.
The Raspberry PI pin instead is connected to the base.
When the corresponding Gpio is turned on (in the schematics this behaviour is represented by a mechanical switch), the transistor goes in saturation mode allowing the current to flow between the collector and the emitter therefore closing the circuit and turning the Amiga pin on as it happens on a regular Joystick.

Amiga joystick pinout

Connect each collector to pins 1,2,3,4,6 and 8 pin as these are the only meaningful pins in a Joystick configuration.
Button 2 is ignored in this project.

Code

PiAmigaJoystick

This web page waits for an input from your keyboard and when a key is pressed it sends a signal through HTTP to a raspberry PI turning on the corresponding GPIO pin. In the same way, the GPIO pin is turned off when the key is released.

PiAmigaJoystickWebserver

PiAmigaJoystickWebserver is in charge of translating incoming HTTP calls to GPIO switching operations. I suggest to configure the raspberry pi's root crontab to launch it at startup. For example: @reboot python app_outputs.py This python flask script is a modified version of this: http://randomnerdtutorials.com/raspberry-pi-web-server-using-flask-to-control-gpios/

Amiga with XboxController

This project is a fork of https://github.com/martinohanlon/XboxController with just a few edits to adapt to my needs. Just install and run xboxdrv, clone my repository in the raspberry pi and run AmigaPi.py. You can instruct crontab to start it at boot time with: @reboot xboxdrv --silent --detach-kernel-driver 2>&1 @reboot sleep 10 && python /home/pi/XboxController/AmigaPi.py 2>&1 WARNING: This script is very cpu intensive, in my raspberry pi the cpu usage spikes at 100% so don't run it at the same time with the web server. Pins mapping is hardcoded within the code so you have to adapt to this schema: Pin 4 : Fire Pin 17 : Up Pin 18: Down Pin 27: Left Pin 22: Right Fire button on the xbox controller is A. B button is linked to UP ( In platformer games I love to jump with a button rather than using directional up).

Credits

Alessio

Alessio

1 project • 1 follower
Software developer

Comments