Skip to content
Programmatic input to the JoyCon, with example script for Pokemon Let's Go
Branch: master
Clone or download
Latest commit 487c665 Apr 1, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs readme Mar 31, 2019
.gitignore basic tests and formatting Mar 31, 2019
LICENSE Initial commit Mar 27, 2019
README.md add test info Mar 31, 2019
config.ini
pokemon_lets_go.py basic tests and formatting Mar 31, 2019
porygon.py basic tests and formatting Mar 31, 2019
requirements.in modularity iter Mar 29, 2019
requirements.txt modularity iter Mar 29, 2019
test_porygon.py basic tests and formatting Mar 31, 2019

README.md

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.

You can’t perform that action at this time.