{"id":13612588,"url":"https://github.com/bjoernQ/ps2keyboard-esp32c3","last_synced_at":"2025-04-13T12:32:12.991Z","repository":{"id":38458617,"uuid":"499071878","full_name":"bjoernQ/ps2keyboard-esp32c3","owner":"bjoernQ","description":"ESP32-C3 interfacing to a PS/2 Keyboard (bare-metal Rust)","archived":false,"fork":false,"pushed_at":"2023-12-21T12:58:17.000Z","size":148,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-07T20:43:02.139Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bjoernQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-06-02T09:26:16.000Z","updated_at":"2024-10-20T08:26:12.000Z","dependencies_parsed_at":"2023-12-21T15:00:38.979Z","dependency_job_id":null,"html_url":"https://github.com/bjoernQ/ps2keyboard-esp32c3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjoernQ%2Fps2keyboard-esp32c3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjoernQ%2Fps2keyboard-esp32c3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjoernQ%2Fps2keyboard-esp32c3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjoernQ%2Fps2keyboard-esp32c3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjoernQ","download_url":"https://codeload.github.com/bjoernQ/ps2keyboard-esp32c3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714637,"owners_count":21149931,"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":[],"created_at":"2024-08-01T20:00:32.034Z","updated_at":"2025-04-13T12:32:12.560Z","avatar_url":"https://github.com/bjoernQ.png","language":"Rust","funding_links":[],"categories":["Projects"],"sub_categories":["`no_std`"],"readme":"# ESP32-C3 interfacing to a PS/2 Keyboard (bare-metal Rust)\n\nThe example of connecting a PS/2 keyboard and USB keyboard with PS/2 COMBO mode support to ESP32-C3.\n\nYou need to build it with the release profile (i.e. `cargo run --release`) since otherwise the interrupt latency is too slow.\n\n![Screenshot](docs/screenshot.png \"Screenshot\")\n\n## Circuit\n\n- 2 x 2.2kΩ resitors\n- 2 x 120Ω resitors\n```\n\n    Keyboard                                    ESP32-C3\n\n    5V      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  5V\n\n    GND     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  GND\n\n                                        ┏━━━━━┓\n    DATA    ━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┫ 120 ┣━━━  IO1\n                                 ┃      ┗━━━━━┛\n                                ┏┻┓\n                                ┃2┃\n                                ┃.┃\n                                ┃2┃\n                                ┃k┃\n                                ┗┳┛\n                                 ┃\n                                 ┣━━━━━━━━━━━━━━━━  3V3\n                                 ┃\n                                ┏┻┓\n                                ┃2┃\n                                ┃.┃\n                                ┃2┃\n                                ┃k┃\n                                ┗┳┛\n                                 ┃      ┏━━━━━┓\n    CLK     ━━━━━━━━━━━━━━━━━━━━━┻━━━━━━┫ 120 ┣━━━  IO2\n                                        ┗━━━━━┛\n\n```\n\n### Wiring to PS/2 connector\n\nThe pinout of PS/2 connector is available at [Wikipedia](https://en.wikipedia.org/wiki/PS/2_port).\n\nHint 1: use [wire wrapping](https://youtu.be/L-463vchW0o?si=MtQrXpbTJznikXSJ) to connect wires to PS/2 connector\n\nHint 2: make sure to flip the [PS/2 pinout](https://en.wikipedia.org/wiki/PS/2_port#/media/File:PS-2_Y-cable_pinout_female.gif) if connecting to the male part the connector or to the back part of the connector.\n\n### Wiring to USB connector\n\nThe same circuit works with USB keyboards with PS/2 COMBO mode support.\nIt's sufficient to replace PS/2 connector with USB connector according\nthe schematics [USB to PS2 schematics](https://www.instructables.com/USB-to-PS2-convertor/).\n\n## Examples\n\n### Keyboard to serial converter\n\nThe example converts keyboard to serial which can be then consumed by other board.\nThe receiver board can use [pc-keyboard crate](https://crates.io/crates/pc-keyboard) to decode signals. The following connection is used in [RustZX-ESP32](https://github.com/georgik/rustzx-esp32/tree/main/m5stack-cores3) project.\n\n```\n  ESP32-C3 Converter                         ESP32-S3 Receiver\n\n     RX IO4 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ TX IO17\n\n     TX IO5 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ RX IO18\n\n     GND    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ GND\n```\n\nRun: `cargo run --release --example keyboard_to_serial`\n\n### Keyboard to serial converter - Embassy\n\nAsync implementation of the converter with Embassy.\n\nNote: CPU must be clocked at 160MHz to decode values properly,\nthe frequency 80 MHz is not sufficient.\n\nRun: `cargo run --release --example embassy_keyboard_to_serial --features embassy`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FbjoernQ%2Fps2keyboard-esp32c3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FbjoernQ%2Fps2keyboard-esp32c3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FbjoernQ%2Fps2keyboard-esp32c3/lists"}