{"id":14978047,"url":"https://github.com/pioreactor/rpi_hardware_pwm","last_synced_at":"2025-04-04T17:04:01.189Z","repository":{"id":37436502,"uuid":"364587013","full_name":"Pioreactor/rpi_hardware_pwm","owner":"Pioreactor","description":"Access the hardware PWM of a Raspberry Pi","archived":false,"fork":false,"pushed_at":"2025-02-04T00:24:13.000Z","size":44,"stargazers_count":74,"open_issues_count":7,"forks_count":19,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-04T17:03:43.513Z","etag":null,"topics":["gpio","hardware","python","raspberry-pi","raspberrypi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pioreactor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2021-05-05T13:31:43.000Z","updated_at":"2025-04-01T02:10:31.000Z","dependencies_parsed_at":"2024-06-20T21:49:02.188Z","dependency_job_id":"abfc03e9-8adf-4c41-83d6-064a91e99995","html_url":"https://github.com/Pioreactor/rpi_hardware_pwm","commit_stats":{"total_commits":33,"total_committers":4,"mean_commits":8.25,"dds":"0.12121212121212122","last_synced_commit":"95598b5d0ed3542007f8eeeaf630eb9eccc19975"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pioreactor%2Frpi_hardware_pwm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pioreactor%2Frpi_hardware_pwm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pioreactor%2Frpi_hardware_pwm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pioreactor%2Frpi_hardware_pwm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pioreactor","download_url":"https://codeload.github.com/Pioreactor/rpi_hardware_pwm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217174,"owners_count":20903008,"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":["gpio","hardware","python","raspberry-pi","raspberrypi"],"created_at":"2024-09-24T13:56:46.786Z","updated_at":"2025-04-04T17:04:01.166Z","avatar_url":"https://github.com/Pioreactor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rpi hardware pwm\n![CI status](https://github.com/pioreactor/rpi_hardware_pwm/actions/workflows/ci.yaml/badge.svg)\n[![PyPI version](https://badge.fury.io/py/rpi-hardware-pwm.svg)](https://badge.fury.io/py/rpi-hardware-pwm)\n\nAccess the hardware PWM of a Raspberry Pi with Python. More lightweight than alternatives.\n\n### Installation\n\n1. On the Raspberry Pi, add `dtoverlay=pwm-2chan` to `/boot/firmware/config.txt`. This defaults to `GPIO_18` as the pin for `PWM0` and `GPIO_19` as the pin for `PWM1`.\n    - Alternatively, you can change `GPIO_18` to `GPIO_12` and `GPIO_19` to `GPIO_13` using `dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4`.\n    - On the Pi 5, use channels 0 and 1 to control GPIO_12 and GPIO13, respectively; use channels 2 and 3 to control GPIO_18 and GPIO_19, respectively\n    - On all other models, use channels 0 and 1 to control GPIO-18 and GPIO_19, respectively\n2. **Reboot your Raspberry Pi**.\n    - You can check everything is working on running `lsmod | grep pwm` and looking for `pwm_bcm2835`\n3. Install this library: `sudo pip3 install rpi-hardware-pwm`\n\n\n\n### Examples\n\n\n\u003e For Rpi 1,2,3,4, use chip=0; For Rpi 5, use chip=2\n\n\n\n```python\nfrom rpi_hardware_pwm import HardwarePWM\n\npwm = HardwarePWM(pwm_channel=0, hz=60, chip=0)\npwm.start(100) # full duty cycle\n\npwm.change_duty_cycle(50)\npwm.change_frequency(25_000)\n\npwm.stop()\n\n\n```\n\n### History\n\nThe original code is from [jdimpson/syspwm](https://github.com/jdimpson/syspwm), We've updated it to Python3 and\nmade it look like the `RPi.GPIO` library's API (but more Pythonic than that.), and we use it in [Pioreactor](https://pioreactor.com) bioreactor system.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpioreactor%2Frpi_hardware_pwm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpioreactor%2Frpi_hardware_pwm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpioreactor%2Frpi_hardware_pwm/lists"}