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.


Install it from pypi:

$ pip3 install pyelectronics


Read the full docs at pythonhosted.

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

Read values from sensors:

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

Supported chips/devices

Read the contributing guide to add devices

  • Bosch BMP180 Digital pressure sensor
  • Honeywell 3-Axis Digital Compass IC HMC5883L
  • MPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking™ Device
  • NXP LM75A Digital temperature sensor

Project details

Download files

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

Files for pyelectronics, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size pyelectronics-0.1.2.tar.gz (9.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page