{"id":15416871,"url":"https://github.com/ussserrr/frequency-meter-avr-lf","last_synced_at":"2025-08-22T05:04:31.604Z","repository":{"id":113441742,"uuid":"135003833","full_name":"ussserrr/frequency-meter-avr-lf","owner":"ussserrr","description":"Arduino-based frequency meter for LF band (\"Input Capture\" mode)","archived":false,"fork":false,"pushed_at":"2018-05-29T00:39:37.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-25T20:07:02.710Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ussserrr.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-05-27T00:23:36.000Z","updated_at":"2018-05-29T00:39:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"b8728996-f3b8-411f-9a26-08797cfae5cd","html_url":"https://github.com/ussserrr/frequency-meter-avr-lf","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"c0fbf8da547bc25ac99bc048b4dcc9928ec3131e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ussserrr/frequency-meter-avr-lf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ussserrr%2Ffrequency-meter-avr-lf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ussserrr%2Ffrequency-meter-avr-lf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ussserrr%2Ffrequency-meter-avr-lf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ussserrr%2Ffrequency-meter-avr-lf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ussserrr","download_url":"https://codeload.github.com/ussserrr/frequency-meter-avr-lf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ussserrr%2Ffrequency-meter-avr-lf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271588743,"owners_count":24785751,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"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-01T17:14:03.882Z","updated_at":"2025-08-22T05:04:31.581Z","avatar_url":"https://github.com/ussserrr.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Overview\nFrequency meter firmware for ATmega328P MCU. It uses 16-bit Timer/Counter1 (TC1) as a main measuring part of the MCU. Can be used as a standalone solution (no need in PC - HD44780 compatible LCD is used for indication). See [frequency-meter-avr-hf](https://github.com/ussserrr/frequency-meter-avr-hf) for measuring an HF band.\n\n```\n     __________________________                                     ____\n    /▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉\\ ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉/\n   / ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉ \\▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉  ▉▉\n__/__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉__▉▉_______\n      1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 /16\nstart on                           \\                           /\nrising edge                         \\                         /\n                                     -------------------------\n\n    =\u003e 16 reference pulses in one input signal period\n```\nConfigured in \"Input capture\" mode, TC1 stores a number of internally generated pulses (with known timings) that had been counted during the one period of input signal (filling frequency), so we can find out its frequency as\n```\nfrequency = number_of_counted_ticks * filling_frequency                \n```\nThis method is especially good for LF band as the accuracy there is a parameter of\n```\naccuracy ~ N_pulses * period\n```\nvalue, so to improve it we should whether increase the internal frequency of TC1 (which we can't do in general) or increase the period of the measured signal (i.e. measure LF bands). We also use an averaging to get more accurate results.\n\nThe algorithm also detects when input frequency is rapidly changes (e.g. you tune it) and increases refresh rate of LCD indications.\n\n\n## Pinout\nPin | Function\n--- | --------\nPB0 (Arduino's pin 8) | Input signal\nArduino's 0, 1, 2, 3, 4, 6, 7 pins (respective PDx pins) | RS, RW, E, D4-7 (HD44780 LCD, LiquidCrystal library)\n\n\n## Build and run\nBuild and run via [PlatformIO](https://platformio.org/). In `platformio.ini` specify parameters (e.g. F_CPU or programmer). Then run:\n```bash\n$ pio run  # build\n\n$ pio run -t program  # flash using external USBASP programmer\nor\n$ pio run -t upload  # flash using on-board programmer\n```\n\n\n## Limits and accuracy\nCheck this [spreadsheet](https://docs.google.com/spreadsheets/d/1x5buIiSePPuyIJX-X4MWf-NA7JHJYz23IA_RD0JLFfs/edit?usp=sharing) to see some test measurements (second page). Generally, this method gives the most accurate results for input frequencies below 1 kHz. HF algorithm is more suited for all frequencies above that value.\n\nAlso, you can replace crystal oscillator with another one (and even overclock a little bit) to increase maximal measurable frequency. In this case, remember to adjust F_CPU, Timer 0 and 1 clock sources for correct calculations and `board_build.f_cpu` in `platformio.ini` file.\n\nWhile TC1 is simply triggered by voltage level (rising or falling edge), MCU is able to measure not only strict square signals - sin wave, saw, triangle forms are also can be correctly recognized within certain limits of distortions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fussserrr%2Ffrequency-meter-avr-lf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fussserrr%2Ffrequency-meter-avr-lf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fussserrr%2Ffrequency-meter-avr-lf/lists"}