{"id":20995394,"url":"https://github.com/todbot/circuitpython_ps2controller","last_synced_at":"2025-06-17T18:35:05.503Z","repository":{"id":172262302,"uuid":"648896412","full_name":"todbot/CircuitPython_PS2Controller","owner":"todbot","description":"CircuitPython library to read Sony PS2 and PS1 (\"PSX\") game controllers","archived":false,"fork":false,"pushed_at":"2023-10-11T17:30:12.000Z","size":144,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-08T02:18:26.077Z","etag":null,"topics":["circuitpython","controller","gamepad","ps1","ps2","psx","psxcontroller","raspberrypipico","sony"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/todbot.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-03T06:01:12.000Z","updated_at":"2025-03-31T14:32:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0f9420d-9810-4c03-9165-12d72f9ada5a","html_url":"https://github.com/todbot/CircuitPython_PS2Controller","commit_stats":null,"previous_names":["todbot/circuitpython_ps2controller"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todbot%2FCircuitPython_PS2Controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todbot%2FCircuitPython_PS2Controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todbot%2FCircuitPython_PS2Controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todbot%2FCircuitPython_PS2Controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/todbot","download_url":"https://codeload.github.com/todbot/CircuitPython_PS2Controller/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254230866,"owners_count":22036258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuitpython","controller","gamepad","ps1","ps2","psx","psxcontroller","raspberrypipico","sony"],"created_at":"2024-11-19T07:23:36.898Z","updated_at":"2025-05-14T21:31:12.329Z","avatar_url":"https://github.com/todbot.png","language":"Python","readme":"Introduction\n============\n\n\n.. image:: https://readthedocs.org/projects/circuitpython-ps2controller/badge/?version=latest\n    :target: https://circuitpython-ps2controller.readthedocs.io/\n    :alt: Documentation Status\n\n.. image:: https://img.shields.io/discord/327254708534116352.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n.. image:: https://github.com/todbot/CircuitPython_PS2Controller/workflows/Build%20CI/badge.svg\n    :target: https://github.com/todbot/CircuitPython_PS2Controller/actions\n    :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nCircuitPython library to read Sony PS2 or PS1 (\"PSX\") game controllers\n\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython \u003chttps://github.com/adafruit/circuitpython\u003e`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle \u003chttps://circuitpython.org/libraries\u003e`_\nor individual libraries can be installed using\n`circup \u003chttps://github.com/adafruit/circup\u003e`_.\n\nInstalling from PyPI\n=====================\n\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\nPyPI \u003chttps://pypi.org/project/circuitpython-ps2controller/\u003e`_.\nTo install for current user:\n\n.. code-block:: shell\n\n    pip3 install circuitpython-ps2controller\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n    sudo pip3 install circuitpython-ps2controller\n\nTo install in a virtual environment in your current project:\n\n.. code-block:: shell\n\n    mkdir project-name \u0026\u0026 cd project-name\n    python3 -m venv .venv\n    source .env/bin/activate\n    pip3 install circuitpython-ps2controller\n\nInstalling to a Connected CircuitPython Device with Circup\n==========================================================\n\nMake sure that you have ``circup`` installed in your Python environment.\nInstall it with the following command if necessary:\n\n.. code-block:: shell\n\n    pip3 install circup\n\nWith ``circup`` installed and your CircuitPython device connected use the\nfollowing command to install:\n\n.. code-block:: shell\n\n    circup install ps2controller\n\nOr the following command to update an existing version:\n\n.. code-block:: shell\n\n    circup update\n\nUsage Example\n=============\n\n.. code-block:: python\n\n    import board\n    from ps2controller import PS2Controller\n\n    # one way to wire this up, for example on a Pico\n    ps2 = PS2Controller(dat=board.GP2, cmd=board.GP3, att=board.GP4, clk=board.GP5)\n\n    print(\"hi! Press buttons\")\n    while True:\n        events = ps2.update()\n        if events:\n            print(\"events\", events)\n            print(\"sticks: L:\", ps2.analog_left(), \"R:\", ps2.analog_right())\n\nWiring\n======\n\nWiring to the PSX controller needs four GPIO pins.These can be any pins.\nThe wiring is:\n\n* CLK pin - clock OUT to controller (blue wire)\n* CMD pin - command data OUT to controller (orange wire)\n* ATT pin - attention / chip select OUT to controller (yellow wire)\n* DAT pin - data IN from controller (brown wire)\n* GND pin - signal ground (black wire)\n* VCC pin - +3.3V power (red wire)\n* VCC2 pin - +7.5V power to rumble motors (optional)\n\nHere's one way to wire that up on a Raspberry Pi Pico:\n\n.. image:: https://raw.githubusercontent.com/todbot/CircuitPython_PS2Controller/main/docs/ps2controller_wiring.png\n\n(Thanks to `Vanepp \u003chttps://forum.fritzing.org/u/vanepp/summary\u003e`_ via `nandanhere/PiPyPS2 \u003chttps://github.com/nandanhere/PiPyPS2\u003e`_ for Fritzing wiring diagram)\n\n\nReferences\n==========\n\nThis library is highly inspired by the `SukkoPera/PsxNewLib \u003chttps://github.com/SukkoPera/PsxNewLib\u003e`_ library.\nIt currently has only been tested on a handful of PS1 and PS2 controllers,\nbut it should be easy to add any specialized controller tuning.\n\nOther resources that have been helpful:\n\n* https://store.curiousinventor.com/guides/PS2/\n* https://gist.github.com/scanlime/5042071\n* https://gamesx.com/wiki/doku.php?id=controls:playstation_controller\n* https://github.com/SukkoPera/PsxNewLib\n* https://github.com/nandanhere/PiPyPS2\n* https://github.com/veroxzik/arduino-psx-controller\n* https://github.com/madsci1016/Arduino-PS2X\n\nDocumentation\n=============\nAPI documentation for this library can be found on `Read the Docs \u003chttps://circuitpython-ps2controller.readthedocs.io/\u003e`_.\n\nFor information on building library documentation, please check out\n`this guide \u003chttps://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1\u003e`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n\u003chttps://github.com/todbot/CircuitPython_PS2Controller/blob/HEAD/CODE_OF_CONDUCT.md\u003e`_\nbefore contributing to help this project stay welcoming.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodbot%2Fcircuitpython_ps2controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftodbot%2Fcircuitpython_ps2controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodbot%2Fcircuitpython_ps2controller/lists"}