Skip to main content

Provides hardware device integrations for bussdcc.

Project description

BussDCC Hardware

bussdcc-hardware provides hardware device integrations for bussdcc.

It includes drivers for common buses and devices and exposes them through the BussDCC device system so they can be managed, monitored, and orchestrated by the runtime.

Architecture

Hardware in BussDCC is modeled using devices attached to buses.

Runtime
  ├── Bus Devices
  │     ├── I2C Bus
  │     └── 1-Wire Bus
  │
  └── Hardware Devices
        ├── Sensors
        ├── ADCs
        ├── Cameras
        └── Actuators

Each hardware component is represented as a BussDCC Device with a managed lifecycle:

connect → operate → disconnect

The runtime handles:

  • device initialization
  • dependency ordering
  • failure detection
  • online/offline status

Features

Bus Drivers

Hardware buses are modeled as devices themselves.

Currently supported:

I²C

bussdcc_hardware.bus.i2c

Features:

  • bus discovery
  • device address scanning
  • register bus interface

1-Wire

bussdcc_hardware.bus.w1

Features:

  • device discovery
  • filesystem-based device access

Hardware Devices

NAU7802 Load Cell ADC

High precision load cell amplifier.

bussdcc_hardware.device.nau7802

Features:

  • dual channel support
  • calibration parameters
  • automatic channel switching
  • failure detection

DS18B20 Temperature Sensor

1-Wire temperature sensor.

bussdcc_hardware.device.ds18b20

Features:

  • filesystem-based reading
  • automatic offline detection

USB Camera

OpenCV-based camera integration.

bussdcc_hardware.device.usb_camera

Features:

  • configurable resolution and FPS
  • exposure control
  • focus control
  • white balance control
  • automatic failure recovery

GPIO Pump

Simple actuator using Raspberry Pi GPIO.

bussdcc_hardware.device.pump

Features:

  • on/off control
  • safe shutdown

Device Configuration

All devices use typed dataclass configurations.

Example:

from bussdcc_hardware.device.nau7802 import NAU7802Config

config = NAU7802Config(
    bus_id="i2c0",
    addr=0x2A,
)

Configuration metadata includes UI hints:

  • labels
  • groups
  • ranges
  • control types

This allows configuration systems or web interfaces to automatically generate forms.

Example metadata:

{
  "label": "Frame Width",
  "group": "Video",
  "ui": "number",
  "min": 160,
  "max": 3840
}

Device Discovery

Hardware integrations are registered using Python entry points.

bussdcc.bus
bussdcc.device

The registry loads available devices automatically:

from bussdcc_hardware.registry import registry

registry.buses
registry.devices

Unavailable drivers (missing optional dependencies) are detected and reported.

Optional Dependencies

Some hardware drivers require additional libraries.

Install them using extras:

pip install bussdcc-hardware[nau7802]
pip install bussdcc-hardware[pump]
pip install bussdcc-hardware[usb_camera]

Example

Example hardware configuration:

runtime.add_device(
    "i2c0",
    "i2c",
    {
        "bus": 1
    }
)

runtime.add_device(
    "scale_adc",
    "nau7802",
    {
        "bus_id": "i2c0",
        "addr": 0x2A
    }
)

The runtime ensures buses are initialized before devices that depend on them.

Design Goals

Hardware as first-class devices

Buses and sensors are modeled the same way as any other BussDCC device.

Runtime-managed lifecycle

Devices automatically:

  • connect
  • report failures
  • recover when possible

Strong typing

All configurations are statically typed dataclasses.

Composable integrations

Hardware modules can be distributed as independent packages and discovered through entry points.

Installation

pip install bussdcc-hardware

Optional drivers:

pip install bussdcc-hardware[nau7802]
pip install bussdcc-hardware[pump]
pip install bussdcc-hardware[usb_camera]

Related Projects

  • bussdcc — cybernetic runtime kernel
  • bussdcc-framework — runtime utilities and web interface

License

MIT License

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

bussdcc_hardware-0.17.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

bussdcc_hardware-0.17.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file bussdcc_hardware-0.17.0.tar.gz.

File metadata

  • Download URL: bussdcc_hardware-0.17.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for bussdcc_hardware-0.17.0.tar.gz
Algorithm Hash digest
SHA256 f7b1b82f78e355163d65711892b3b0b2170ec37ace99368624aa546ac8c5903b
MD5 9c413cb443cf4f75134a11fd89578e22
BLAKE2b-256 99b68d15a4fdc99e3b1d6999cff94094c6aef87771cfc907ef43dc7d587996c4

See more details on using hashes here.

File details

Details for the file bussdcc_hardware-0.17.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bussdcc_hardware-0.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74f5438f3c1aa84937820213ec378eb8ea7430206365c4fdac6e86325f5bd7d6
MD5 13de3cc6252232fd2761a48864c88c98
BLAKE2b-256 0a6e171cac3e8bdb3c04a740745c5d9ef818e1c57a22289f0ea4ea2785269471

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