Skip to main content

Pure Python interface for PCA9685 built on smbus2

Project description

Python-PCA9685

A probably definitely not-best-practices way to use the PCA9685 with an Orange Pi Zero 3.

If it works, it works.

Purpose

This library replaces adafruit/Adafruit_Python_PCA9685 for the Orange Pi Zero 3 and presumably other single board computers that may or may not have reliable Blinka support.

Usage

This will set an SG90 micro servo plugged into channel 0 to spin to the -90° position.

from PCA9685_smbus2 import PCA9685

pwm = PCA9685.PCA9685() # defaults to using i2c-3 and address 0x40
pwm.set_pwm_freq(50) # set frequency to 50 Hz for SG90 servos

pwm.set_pwm(0, 0, 102) # channel 0, on time 0?, off time 102 (1 ms)

The on and off times above are the number of ticks on the PCA9685, which has a 12-bit resolution and therefore can range from 0 to 4096.

Tested on

This library has been tested on:

  • Orange Pi Zero 3

It likely supports any board in which the accessible I2C bus can be found by running ls /dev/i2c-*, since it relies on the smbus2 library for I2C interfacing.

Ensure that the relevant I2C interface has been enabled in sudo orangepi-config or sudo raspi-config (or whatever the case may be) for this to work right.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pca9685_smbus2-0.0.6.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pca9685_smbus2-0.0.6-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pca9685_smbus2-0.0.6.tar.gz.

File metadata

  • Download URL: pca9685_smbus2-0.0.6.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pca9685_smbus2-0.0.6.tar.gz
Algorithm Hash digest
SHA256 6539b533c7961139bb1679e7a405296abc0eef2bcd24abeaa6e11d6360367c16
MD5 4d6a8c79aace6b29ab81e863880d84c1
BLAKE2b-256 14a437693eb95fa7fee6549301ff9e920fa32d2d2f68845e370c3551fcad0bb1

See more details on using hashes here.

File details

Details for the file pca9685_smbus2-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pca9685_smbus2-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pca9685_smbus2-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0922ffbcb47d916ae070ac3caf3d65ff73254fb9c8d6d2337fee4267ba4993d9
MD5 f9e4e2f3ac1682def37b4fb645f5e499
BLAKE2b-256 41798f923927be3f739657f0b87f65d0226b13d340bccbd91de5b346063cce01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page