{"id":30099473,"url":"https://github.com/yamil-serrano/74hc165-microcontroller-input-expansion","last_synced_at":"2026-05-18T15:07:49.078Z","repository":{"id":294560339,"uuid":"987358812","full_name":"Yamil-Serrano/74HC165-Microcontroller-Input-Expansion","owner":"Yamil-Serrano","description":"Expand the number of digital inputs available on an any microcontroller, using just 3 GPIO pins and a 74HC165 shift register.","archived":false,"fork":false,"pushed_at":"2025-07-30T01:36:05.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-11T02:20:54.548Z","etag":null,"topics":["74165","esp8266","microcontroller","shift-register"],"latest_commit_sha":null,"homepage":"","language":"C++","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/Yamil-Serrano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"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,"zenodo":null}},"created_at":"2025-05-21T00:59:46.000Z","updated_at":"2025-07-30T01:36:09.000Z","dependencies_parsed_at":"2025-05-21T02:30:46.533Z","dependency_job_id":"fe05e1fa-320d-43b5-a18b-fa07a23fd7eb","html_url":"https://github.com/Yamil-Serrano/74HC165-Microcontroller-Input-Expansion","commit_stats":null,"previous_names":["yamil-serrano/74hc165-esp8266-input-expansion","yamil-serrano/74hc595-microcontroller-input-expansion","yamil-serrano/74hc165-microcontroller-input-expansion"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Yamil-Serrano/74HC165-Microcontroller-Input-Expansion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamil-Serrano%2F74HC165-Microcontroller-Input-Expansion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamil-Serrano%2F74HC165-Microcontroller-Input-Expansion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamil-Serrano%2F74HC165-Microcontroller-Input-Expansion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamil-Serrano%2F74HC165-Microcontroller-Input-Expansion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yamil-Serrano","download_url":"https://codeload.github.com/Yamil-Serrano/74HC165-Microcontroller-Input-Expansion/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamil-Serrano%2F74HC165-Microcontroller-Input-Expansion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32417885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["74165","esp8266","microcontroller","shift-register"],"created_at":"2025-08-09T14:32:23.458Z","updated_at":"2026-04-29T08:34:03.597Z","avatar_url":"https://github.com/Yamil-Serrano.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 74HC165-Microcontroller-Input-Expansion\n\nThis project explores how to use the **74HC165 shift register** to expand the number of digital **inputs** available on an **ESP8266**, using only 3 GPIO pins. It’s built with **PlatformIO**, but it’s also compatible with the **Arduino IDE**.\n\nThe example reads 8 parallel inputs (like buttons or switches) and prints their values to the serial monitor. It uses **parallel-to-serial** communication to achieve input expansion with minimal pin usage.\n\n---\n\n### 🧩 This Project is Part of a Shift Register I/O Expansion Series\n\nThis repository is the **second part** of a series exploring how to expand the I/O capabilities of microcontrollers using shift registers:\n\n- **Part 1**: [74HC595-Microcontroller-Output-Expansion](https://github.com/Yamil-Serrano/74HC595-Microcontroller-Output-Expansion)  \n- **Part 2**: [74HC165-Microcontroller-Input-Expansion (this repo)](https://github.com/Yamil-Serrano/74HC165-Microcontroller-Input-Expansion)\n\nIn Part 1, I explain how to use the 74HC595 to control 8 outputs using serial data.  \nThis project is the *reverse* — it reads multiple digital inputs using the **74HC165** via **parallel-to-serial** communication.\n\n---\n\n## What You'll Learn\n\n- What the 74HC165 does and how it works  \n- How to read multiple digital inputs using a shift register  \n- How to connect the 74HC165 to an ESP8266  \n- How to use clock, latch, and data pins to capture and shift input states  \n\n---\n\n## How It Works\n\nThe **74HC165** reads 8 parallel inputs (D0–D7) and shifts them out serially through a single `QH` pin. You control the data flow using 3 pins:\n\n- **PL (Parallel Load)**: Captures the current state of the input pins  \n- **CLK (Clock)**: Shifts bits one by one to the output  \n- **QH**: The serial output line, connected to the ESP8266\n\nBy toggling these lines, you can read 8 (or more, if cascaded) inputs using just a few GPIOs.\n\n---\n\n## Hardware Used\n\n- ESP8266 (NodeMCU / Wemos D1 mini)  \n- 74HC165 Shift Register  \n- Breadboard + Jumper Wires  \n- Push Buttons or Switches  \n- Optional: Pull-down resistors (10kΩ)  \n\n---\n\n## Wiring Table\n\n| 74HC165 Pin | Connected To (ESP8266) | Purpose         |\n|-------------|-------------------------|-----------------|\n| QH (9)      | D5 (GPIO14)             | Serial Data Out |\n| CLK (2)     | D2 (GPIO4)              | Clock           |\n| PL (1)      | D1 (GPIO5)              | Parallel Load   |\n| CE (15)     | GND                     | Enable (Active Low) |\n| GND         | GND                     | Ground          |\n| VCC         | 3.3V or 5V              | Power Supply    |\n| D0–D7       | Input Devices (Buttons) | Input Pins      |\n\n\u003e ⚠️ Remember to connect **pull-down resistors** on each button or input line to ensure a clean LOW signal when not pressed.\n\n---\n\n## Code Overview\n\nThe `readShiftRegister()` function handles:\n\n1. Loading the inputs by pulsing `PL` LOW then HIGH  \n2. Shifting bits out by toggling the `CP` clock pin  \n3. Reading each bit from `QH`\n\nSee `src/main.cpp` for the full implementation.\n\n---\n\n## Diagram\n\n![image](https://github.com/user-attachments/assets/7a26a4ef-fbca-4140-bd5b-d94dc830f609)\n\n\n\n---\n\n## License\n\nThis project is licensed under the MIT License – see the [LICENSE](LICENSE.md) file for details.\n\n---\n\n## Contact\n\nIf you have any questions or suggestions, feel free to reach out to me:\n\nGitHub: [Neowizen](https://github.com/Yamil-Serrano)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyamil-serrano%2F74hc165-microcontroller-input-expansion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyamil-serrano%2F74hc165-microcontroller-input-expansion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyamil-serrano%2F74hc165-microcontroller-input-expansion/lists"}