{"id":16525510,"url":"https://github.com/andrewn/sensor-gadget","last_synced_at":"2026-06-13T09:01:49.147Z","repository":{"id":66464838,"uuid":"117467954","full_name":"andrewn/sensor-gadget","owner":"andrewn","description":"Sensors connected to a Pi Zero USB gadget","archived":false,"fork":false,"pushed_at":"2018-01-14T22:50:58.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T02:24:58.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-01-14T21:25:14.000Z","updated_at":"2018-01-15T09:14:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"675b5a68-0176-4273-a798-ecb556f89715","html_url":"https://github.com/andrewn/sensor-gadget","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrewn/sensor-gadget","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fsensor-gadget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fsensor-gadget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fsensor-gadget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fsensor-gadget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewn","download_url":"https://codeload.github.com/andrewn/sensor-gadget/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fsensor-gadget/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34278154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-11T17:03:45.264Z","updated_at":"2026-06-13T09:01:49.129Z","avatar_url":"https://github.com/andrewn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sensor Gadget\n\nThis project sets up a Raspberry Pi Zero as a USB gadget device.\n\nThe Pi Zero has sensors etc connected to it's GPIO pins. When the Pi Zero is plugged into a \"host\" computer (another Raspberry Pi, or a laptop) via a USB cable then it appears as a Ethernet device and also as a serial port e.g. `/dev/cu.usbmodem1413`. The host computer can then listen on this serial port to receive messages from the RFID reader.\n\nCurrently, the MFRC522 RFID reader is supported, connected to the SPI interface.\n\n## Installation\n\n### Pre-setup\n\n* Flash Raspbian onto an SD card (tested with Lite but Desktop should also work)\n* On the computer you used to flash the SD, open up the boot partition and add to the bottom of the `config.txt` file `dtoverlay=dwc2` on a new line, then save the file.\n* Open up the `cmdline.txt`. Be careful with this file, it is very picky with its formatting! Each parameter is seperated by a single space (it does not use newlines). Insert `modules-load=dwc2,g_ether` after `rootwait`\n* Create a new file simply called `ssh` in the SD card boot\n* Eject the SD card\n* Put it into the Pi Zero and power it up via a USB cable in the 'USB' slot\n* You will now be able to SSH into the Pi\n\n### Setup\n\n* On the Pi, copy `gadget/deployment/provision`\n* Run `sudo ./provision`\n* The Pi Zero will be configured as a USB gadget with serial interface\n\n## RFID reader\n\n_insert diagram of wiring_\n\n## Usage\n\nOn boot, the RFID reader process will be started. On the `host` machine at the other end of the USB cable, you can listen on the serial port for JSON messages.\n\nA small nodejs script is provided as an example:\n\n    `./host/bin/sensor-gadget-host /dev/cu.usbmodem1413`\n\nWhere `/dev/cu.usbmodem1413` is the device that will have appeared representing the serial interface of the Pi Zero.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewn%2Fsensor-gadget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewn%2Fsensor-gadget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewn%2Fsensor-gadget/lists"}