moribellamy / porygon

Programmatic input to the JoyCon, with example script for Pokemon Let's Go

Home Page:https://invoked.net/2019-03-26-joycon-circuit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Porygon consists of two parts: a digital circuit that is wired between a RasPi and a JoyCon, as well as a script to run that circuit.

For a video of it in action, and some tips on how to put this together, see the announcement post at https://invoked.net/2019-03-26-joycon-circuit/

Circuit

The parts listed in the circuit:

Component Link Function
PI-IO raspi Array of GPIO pins on the raspi, used to toggle analog switches and to drive an I2C bus.
DG333A Analog Switch (x2) digikey Single Pole, Double Throw switches. To bridge points to COL, emulating a button press.
MCP4725 (x2) sparkfun Digital Analog Converters. The pi sends a signal here to output a variable voltage, which will emulate what the joystick does. I bought breakout boards instead of the chip itself to make soldering easier.

Script

To actually get the inputs going, you'll need shell access to the PI in your circuit. Then,

git clone https://github.com/moribellamy/porygon.git
cd porygon
python3 -m virtualenv venv
. venv/bin/activate
pip install -r requirements.txt

If your circuit diagram varies from the one documented here, there are some settings you can put in config.ini. This is if you didn't use the same pin numbers on your PI GPIO array, or if your power source isn't a clean five volts.

Then you are in control!

from porygon import *
import time

tilt_x(100)  # Go left a while!
time.sleep(1)
still()  # Zero out the joystick.

press(A)
press(X)  # And so forth.

For an example end to end script, which takes input from a webcam, read pokemon_lets_go.py.

Development

More games and automations could be added. Use py.test to run all of the tests.

About

Programmatic input to the JoyCon, with example script for Pokemon Let's Go

https://invoked.net/2019-03-26-joycon-circuit/

License:MIT License


Languages

Language:Python 100.0%