Skip to main content

Device driver and automation for common sensors

Project description

plugandpie was designed to automatically set up sensors with drivers, making the initial hardware configuration simpler and faster to implement. It is powered by community contributed drivers and it’s flexible enough to work with devices not yet directly supported. The package also aims to provide utilities for monitoring and analyzing sensors, so you can make software-level polling and set up complex observation models.

Driver Examples

By specifying directly the hardware interface and address, you have an unified access method for any register on the device.

accelerometer = GenericDriver(interface=SMBusAdapter(1), address=0x1D)
accelerometer.registers[0x2A].set(8)  # inactive
accelerometer.registers[0x0E].set(0)  # range = 2g
accelerometer.registers[0x2A].set(9)  # active, 800Hz

By reading a device configuration file that reflects its datasheet, you can have better namings for your registers.

# TODO

By instantiating the correct driver, a standardized API can provide the meaningful data easily.

accelerometer = MMA8452Q(interface=SMBusAdapter(1), address=0x1D)
accelerometer.get_ms2()

By reading a device configuration file, you can initialize all drivers immediately.

# TODO

Check out the documentation for examples of basic and advanced usages.

Monitor Examples

The most common uses of sensors is history analysis and real time telemetry. Both should seamlessly plug into plugandpie drivers, so the package includes some utilities for this purpose.

Installation: pipv pipstatus pipl pippyversions pipdm

plugandpie requires SMBus, which at this time has no good Python 3 implementation or bindings. A workaround can be found at https://procrastinative.ninja/2014/07/21/smbus-for-python34-on-raspberry/

Also, SMBus requires repeated starts in the i2c driver. This is not enabled by default on Raspberry Pi and can be fixed with:

echo -n 1 > /sys/module/i2c_bcm2708/parameters/combined

This configuration resets on boot, so make sure to put this in a startup script.

setup.sh is a script that contain a fix for both problems, but does so in an intrusive way. It is recommended for inexperienced users to install plugandpie for the first time, but experienced users should solve those problems individually.

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

plugandpie-0.1a7.zip (18.6 kB view details)

Uploaded Source

Built Distribution

plugandpie-0.1a7-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file plugandpie-0.1a7.zip.

File metadata

  • Download URL: plugandpie-0.1a7.zip
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for plugandpie-0.1a7.zip
Algorithm Hash digest
SHA256 33f08bfec337e1a79a83ac0a4aa0da356e7e2b9f20a2c2b5a75efb753cab202f
MD5 6a5a9675de24f5c2fdf985c708f693f8
BLAKE2b-256 40ee176a43b7287a8073501bdb7e204b27a071b2f8e0fee4d664a4e504841104

See more details on using hashes here.

File details

Details for the file plugandpie-0.1a7-py3-none-any.whl.

File metadata

File hashes

Hashes for plugandpie-0.1a7-py3-none-any.whl
Algorithm Hash digest
SHA256 65006fbacbf10cb206fd1ea6bc73b38f4de63ee504ea6899816e347e45adc9f7
MD5 7761bdd7f24795b83a909f07a733f412
BLAKE2b-256 66fdb0c7aaed476c9fa460bdb05154bbb42eb6412473c8803046a60a5fda97a4

See more details on using hashes here.

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