{"id":17252094,"url":"https://github.com/ppetr/hw-opto-counter","last_synced_at":"2025-03-26T07:23:11.933Z","repository":{"id":215134165,"uuid":"708503922","full_name":"ppetr/hw-opto-counter","owner":"ppetr","description":"Universal infrared proximity sensor/counter of events","archived":false,"fork":false,"pushed_at":"2024-10-03T20:56:05.000Z","size":23206,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-31T08:44:23.810Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/ppetr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"docs/code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-10-22T18:46:58.000Z","updated_at":"2024-10-03T20:56:09.000Z","dependencies_parsed_at":"2024-01-02T18:44:20.149Z","dependency_job_id":null,"html_url":"https://github.com/ppetr/hw-opto-counter","commit_stats":null,"previous_names":["ppetr/hw-opto-counter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fhw-opto-counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fhw-opto-counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fhw-opto-counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fhw-opto-counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppetr","download_url":"https://codeload.github.com/ppetr/hw-opto-counter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245606532,"owners_count":20643194,"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-10-15T06:53:00.758Z","updated_at":"2025-03-26T07:23:11.911Z","avatar_url":"https://github.com/ppetr.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Universal IR optical, directional proximity detector/counter with TWI (I²C) interface\n\n_*Disclaimer:* This is not an officially supported Google product._\n\n\u003cimg align=\"right\" src=\"docs/opto-counter-3d.jpg\" alt=\"3D model of the board\"/\u003e\n\nThe board uses two IR LEDs with a modulated signal (both either 38KHz or 56KHz,\ndepending on the receiver type) whose light reflects off objects in front of\nthe device into an IR receiver.\n\nUsing two LEDs allows to determine an approximate position (or direction of\nmovement) of an object in one dimension. Modulating the signal significantly\nreduces interference from natural IR light sources.\n\nThe microcontroller\n([ATtiny3224](https://www.microchip.com/en-us/product/attiny3224)) varies the\nsignal strength to compute the strength of the reflected signal using the\n[binary search\nalgorithm](https://en.wikipedia.org/wiki/Binary_search_algorithm).\n\nThe measured values are made available through I²C (subordinate).\n\n## Event counter\n\nIn addition to reporting current values of reflections from both LEDs, the\nmicrocontroller also counts the number of times the reflection quickly changes\n(which we call \"events\"). These events are defined using two parameters:\n\n- [Exponential moving\n  average](https://en.wikipedia.org/wiki/Exponential_smoothing) smoothing\n  factor (\"half-life\"), which computes the baseline signal to compare against.\n  The default value is half-life of 10s.\n- Delta factor \\[0..1\\]. An event is triggered when the signal differs more\n  than the delta factor from its exponential moving average.\n\nThere are the following event types that are counted independently:\n\n1. Signal reflected from LED1 crosses the delta boundary and returns while\n   LED2's signal remained within.\n   ```\n   LED1:  ___|‾‾‾|___\n   LED2:  ___________\n   ```\n2. Similarly the other way around.\n3. LED1's signal crossed outside the delta boundary followed by LED2's signal\n   crossing outside. This captures the situation when an object is moving in\n   the direction LED1-\u003eLED2.\n   ```\n   LED1:  __|‾‾‾|____\n   LED2:  ____|‾‾‾|__\n   ```\n4. Similarly the other way around.\n\n## Status\n\nDevelopment of a prototype.\n\n## Contributions\n\nPlease see [Code of Conduct](docs/code-of-conduct.md) and [Contributing](docs/contributing.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppetr%2Fhw-opto-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppetr%2Fhw-opto-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppetr%2Fhw-opto-counter/lists"}