{"id":13802614,"url":"https://github.com/alankrantas/micropython-TTP229-BSF","last_synced_at":"2025-05-13T13:32:30.508Z","repository":{"id":113012377,"uuid":"222466214","full_name":"alankrantas/micropython-TTP229-BSF","owner":"alankrantas","description":"MicroPython ESP8266/ESP32 driver for TTP229-BSF 16-key capacitive keypad in serial interface mode","archived":false,"fork":false,"pushed_at":"2021-08-04T03:50:45.000Z","size":29,"stargazers_count":15,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-22T13:30:47.755Z","etag":null,"topics":["4x4-keypad","capacitive","capacitive-touch-sensor","esp32","esp8266","keypad","micropython","micropython-esp32","micropython-esp8266","ttp229"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alankrantas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-11-18T14:18:16.000Z","updated_at":"2024-04-18T17:20:33.000Z","dependencies_parsed_at":"2024-01-07T21:53:50.774Z","dependency_job_id":"a3068ab4-8c13-4edd-a22d-1119da676d6d","html_url":"https://github.com/alankrantas/micropython-TTP229-BSF","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alankrantas%2Fmicropython-TTP229-BSF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alankrantas%2Fmicropython-TTP229-BSF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alankrantas%2Fmicropython-TTP229-BSF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alankrantas%2Fmicropython-TTP229-BSF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alankrantas","download_url":"https://codeload.github.com/alankrantas/micropython-TTP229-BSF/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225229876,"owners_count":17441336,"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":["4x4-keypad","capacitive","capacitive-touch-sensor","esp32","esp8266","keypad","micropython","micropython-esp32","micropython-esp8266","ttp229"],"created_at":"2024-08-04T00:01:48.577Z","updated_at":"2024-11-18T18:30:28.738Z","avatar_url":"https://github.com/alankrantas.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Sensors"],"readme":"# MicroPython ESP8266/ESP32 Driver for TTP229-BSF 16-key Capacitive Keypad in Serial Interface Mode\n\nThis MicroPython driver is for TTP229-BSF capacitive keypad on ESP8266/ESP32. Tested on both ESP8266 (WeMos D1 mini) and ESP32 (BPI:bit) with v1.11 firmware.\n\nThe serial interface of TTP229-BSF \u003cb\u003eis not I2C\u003c/b\u003e but it allows you to control this keypad via only 2 wires. Not to be confused with TTP229-LSF, which is a true I2C device.\n\n## Hardware Configuration\n\nTTP229-BSF's serial interface supports either 8 or 16 key mode (see [datasheet](https://www.sunrom.com/get/611100)), as well as single/multiple key mode. For some of the settings hardware configuration is required:\n\n![11-1035x1200](https://user-images.githubusercontent.com/44191076/69064016-6ec49c00-0a58-11ea-9b46-c10f4f1a9cdf.jpg)\n\n**Connect these places with either simple wires or soldering. Do not use resistors.**\n\n* TP2 not connected: 8 keys\n* TP2 connected (pulled low): 16 keys\n\n* TP3 and TP4 not connected: single key mode\n* TP3 and TP4 both connected (pulled low): multiple key mode\n\nWithout any modification the TTP229-BSF is in 8-key/single mode. Connect the TPx pins by wires or soldering to enable these options.\n\n## Wiring\n\n* VCC: 3.3V\n* GND: GND\n* SCL: scl pin (output)\n* SDO (not SDA): sdo pin (input)\n\n## Example\n\n```python\nfrom machine import Pin\nfrom TTP229_BSF import Keypad\n\nscl_pin = Pin(5, Pin.OUT)\nsdo_pin = Pin(4, Pin.IN)\n\nkeypad = Keypad(scl=scl_pin, sdo=sdo_pin, inputs=16, multi=False)\n\nwhile True:\n    print(keypad.read())\n    # return a index number like 15 in single mode\n    # return a list like (0, 2, 11, 15) in multiple mode\n```\n\n## Parameter\n\nYou can set the following initializing parameter:\n\n* **input=8** (default): 8 key mode\n* **input=16**: 16 key mode\n\n\u003cb\u003emulti\u003c/b\u003e parameter:\n\n* **multi=False** (default): single mode\n* **multi=True**: multiple mode\n\nIn single mode ```keypad.read()``` will return the index of the pressed key (0~15). Return -1 when no key is pressed.\n\nIn multiple mode ```keypad.read()``` will return a list containing all the indexes of pressed keys. Return an empty list when no key is pressed.\n\nIf the TTP229-BSF is configured to multiple mode, read it in single mode will return the lowest index of all pressed keys. Read in multiple mode for a keypad configured in single mode, you'll get a list containing only one key index if any key is pressed.\n\nThere's also a \u003cb\u003eraw\u003c/b\u003e parameter, default ```False```. When set as ```True```, ```keypad.read()``` will return the raw 8 or 16 key list indicating all keys' status (from key 0 to 15; value 1 = not pressed, 0 = pressed).\n\n```python\nkeypad = Keypad(scl=scl_pin, sdo=sdo_pin, inputs=16, multi=False, raw=True)\n# return a list like (0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0)\n\nwhile True:\n    print(keypad.read())\n```\n\nIf the keypad is configured to multiple mode and you read it in single/raw mode, you'll still get a list which contains multiple key pressing results.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falankrantas%2Fmicropython-TTP229-BSF","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falankrantas%2Fmicropython-TTP229-BSF","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falankrantas%2Fmicropython-TTP229-BSF/lists"}