Skip to main content

Python 3 library for working with electronics

Project description

This is a python library for using electronics (like i2c or spi devices) with a unified interface. It currently supports connecting to stuff through the Raspberry Pi gpio with the i2c kernel driver and using the Bus Pirate.

Usage

First create a instance of a gateway:

from electronics.gateways import BusPirate
from electronics.gateways import LinuxDevice

# Use a BusPirate to connect to a bus
gw = BusPirate('/dev/ttyUSB0')

# Use a i2c bus with a linux driver (like the raspberry pi)
gw = LinuxDevice(1) # /dev/i2c-1

Create instances for components connected to the gateway:

from electronics.devices import BMP180
from electronics.devices import MPU6050I2C

barometer = BMP180(gw, address=0x77) # Address is optional
inertia = MPU6050(gw)

# Do chip specific initialisation
barometer.load_calibration()
inertia.wakeup()

Read values from sensors:

temperature = barometer.temperature()
pressure = barometer.pressure()
acceleration = inertia.acceleration()
rotation = inertia.angular_rate()

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

pyelectronics-0.1.1.tar.gz (8.0 kB view hashes)

Uploaded Source

Supported by

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