{"id":26979803,"url":"https://github.com/julianwowra/node-anemometer","last_synced_at":"2026-02-20T23:39:17.243Z","repository":{"id":65826278,"uuid":"499136306","full_name":"JulianWowra/node-anemometer","owner":"JulianWowra","description":"Measuring the wind speed with an anemometer","archived":false,"fork":false,"pushed_at":"2025-04-13T10:12:21.000Z","size":268,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T11:08:57.712Z","etag":null,"topics":["anemometer","pcf8583","raspberry-pi"],"latest_commit_sha":null,"homepage":"https://julianwowra.github.io/node-anemometer/","language":"TypeScript","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/JulianWowra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-06-02T12:59:18.000Z","updated_at":"2025-04-13T09:49:40.000Z","dependencies_parsed_at":"2025-04-19T04:20:09.754Z","dependency_job_id":"52d03b1e-8a17-4ecd-9e53-6aef2a50ace1","html_url":"https://github.com/JulianWowra/node-anemometer","commit_stats":null,"previous_names":["julianwowra/node-anemometer","killerjulian/node-anemometer"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/JulianWowra/node-anemometer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianWowra%2Fnode-anemometer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianWowra%2Fnode-anemometer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianWowra%2Fnode-anemometer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianWowra%2Fnode-anemometer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JulianWowra","download_url":"https://codeload.github.com/JulianWowra/node-anemometer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianWowra%2Fnode-anemometer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260346877,"owners_count":22995151,"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":["anemometer","pcf8583","raspberry-pi"],"created_at":"2025-04-03T14:16:00.631Z","updated_at":"2026-02-20T23:39:17.211Z","avatar_url":"https://github.com/JulianWowra.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-anemometer\n\n[![NPM](https://nodei.co/npm/node-anemometer.png)](https://npmjs.org/package/node-anemometer)\n\n## Install\n\n```text\nnpm install node-anemometer\n```\n\n```text\npnpm install node-anemometer\n```\n\n```text\nyarn add node-anemometer\n```\n\n## Required hardware\n\n**At the moment this library can only be used with an extra counter module [PCF8583](https://www.nxp.com/docs/en/data-sheet/PCF8583.pdf)**\n\n### The circuit board\n\nThere are several ways to count the revolutions of the anemometer. The best result I got with the KY-003 board (a magnetic field sensor) and a magnet. The magnet is placed so that it triggers the sensor with each complete rotation. If you use mechanical components like reed switches, you need a debounce filter and additional hardware to avoid count many [noise values](https://ptvo.info/zigbee-configurable-firmware-features/external-sensors/pcf8583-zigbee-counter/). There are many designs of such PCBs. Here is one example: [circuit board from Horter](https://www.horter.de/doku/i2c-counter-PCF8583_db.pdf)\n\n## System settings\n\n[Configuring I2C on the Raspberry Pi](https://github.com/fivdi/i2c-bus/blob/HEAD/doc/raspberry-pi-i2c.md)\n\n[Creating Multiple I2C Ports](https://www-laub--home-de.translate.goog/wiki/Raspberry_Pi_multiple_I2C_bus?_x_tr_sl=de\u0026_x_tr_tl=en\u0026_x_tr_hl=de\u0026_x_tr_pto=wapp) (_for advanced people_)\n\n## Usage\n\nExample in TypeScript (with ES Modules):\n\n_Examples in the calculation not adjusted to your anemometer_\n\n```typescript\nimport { Anemometer, calcFactor, WindSpeed, WindSpeedUnits } from 'node-anemometer';\n\nconst calc = (pulses: number, time: number): WindSpeed =\u003e {\n  // You cannot divide by 0\n  if (time \u003c= 0) {\n    return new WindSpeed(0, WindSpeedUnits.kilometersPerHour);\n  }\n\n  // More about the calculation can you find in the readme file\n  const windSpeed = (pulses / 2 / time) * calcFactor(9, 1.18);\n\n  // You must always return a class of the type WindSpeed\n  return new WindSpeed(windSpeed, WindSpeedUnits.kilometersPerHour);\n};\n\n// Initialize the class for your anemometer.\n// Never initialize two classes for the same address on the same bus!\n// For more options on initializing the class, read the documentation\nconst myAnemometer = new Anemometer(calc);\n\nasync function start() {\n  // Establish an i2c connection to the PCF8583 and start the reading process\n  await myAnemometer.open();\n\n  // Wait 60 seconds to have a usable average value\n  setTimeout(async () =\u003e {\n    // '.getAverageWindSpeed()' calculates the average wind speed of the past x seconds\n    const average = myAnemometer.getAverageWindSpeed({ recentSeconds: 60 });\n    console.log(`Average wind speed: ${average.rounded(2)} ${average.unit}`);\n\n    // '.getPeakWindGust()' calculates the peak wind guest of the past x seconds\n    const peak = myAnemometer.getPeakWindGust({ recentSeconds: 60 });\n    console.log(`Peak wind speed: ${peak.rounded(2)} ${peak.unit}`);\n\n    // Herewith you can stop the reading process and close the i2c connection\n    await myAnemometer.close();\n  }, 60000);\n}\n\nstart();\n```\n\nYou can find more information in the full [documentation 📖](https://julianwowra.github.io/node-anemometer/).\n\n### Calculation\n\nThe wind speed is always calculated with the signals and the time. Often you can find information about this in the data sheet. If you can't find any, I will now describe how the calculation works.\n\nThe following basic equation applies:\n\n![calculation](./images/calculation.svg)\n\n**`pulses`**: Signals emitted by the anemometer. The are similar when you press a button\n\n**`pulses per rotation`**: Is the number of signals that are output for a complete rotation\n\n**`time`**: Is the duration (in seconds) in which the measurement was performed\n\n**`anemometer factor`**: Mostly to find in the datasheet, but can also be calculated by yourself. More information below\n\n![](./images/pulses.svg)\n\n### Calculate anemometor factor\n\nThe `.calcFactor()` function computes the multiplier for the calculation of the wind speed in km/h. The radius (measured distance from the center to the edge of one of the cups) in cm and the anemometer factor. The anemometer factor is a value to compensate for the lost wind energy when turning the arms. In my case this value is `1.18`.\n\n![](./images/anemometer.svg)\n\n---\n\n## Useful information and references\n\n**👉 Special thanks to [@DasMelone](https://github.com/DasMelone) who helped me to work out this project**\n\n- 🌟 [Measuring wind speed using Raspberry Pi](https://projects.raspberrypi.org/en/projects/build-your-own-weather-station/5)\n- 🌟 [Why a debounce filter?](https://ptvo.info/zigbee-configurable-firmware-features/external-sensors/pcf8583-zigbee-counter/)\n- 🌟 🇩🇪 [Setting multiple i2c buses on the Raspberry Pi](https://www.laub-home.de/wiki/Raspberry_Pi_multiple_I2C_bus)\n- 🇩🇪 [Video of the calculation with an Arduino](https://www.youtube.com/watch?v=Mr05UumeQsk)\n- 🇩🇪 [I2C pulse counter module by Horter](https://www.nikolaus-lueneburg.de/2019/05/i2c-impuls-counter-modul/)\n- [Counting events with Arduino and PCF8583](https://tinkerman.cat/post/counting-events-with-arduino-and-pcf8583/)\n- [Low Power Counters](https://hackaday.io/project/174898-esp-now-weather-station/log/184063-low-power-counters)\n- [What is a Schmitt trigger?](https://en.wikipedia.org/wiki/Schmitt_trigger)\n- [Datasheet anemometer](https://www.argentdata.com/files/80422_datasheet.pdf)\n- [Datasheet PCF8583](https://www.nxp.com/docs/en/data-sheet/PCF8583.pdf)\n- [Datasheet 74HC132](https://assets.nexperia.com/documents/data-sheet/74HC_HCT132.pdf)\n\n_🌟 - I recommend to read this_\n\n_🇩🇪 - Content that is only available in German_\n\n---\n\n## Author\n\n👤 **Julian Wowra \u003cdevelopment@julianwowra.de\u003e**\n\n- Github: [@JulianWowra](https://github.com/JulianWowra)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\u003cbr /\u003eFeel free to check the [issues page](https://github.com/JulianWowra/node-anemometer/issues). You can also take a look at the [contributing guide](https://github.com/JulianWowra/node-anemometer/blob/main/CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianwowra%2Fnode-anemometer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulianwowra%2Fnode-anemometer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianwowra%2Fnode-anemometer/lists"}