bitbangrelay
A simple tool for controlling USB relay boards based around an FTDI FT232R/FT245R chip in bitbang mode, for example SainSmart 4 or 8 channel USB relay modules.
NOTE: This project is a work in progress, documentation and testing are currently very limited. If this project is useful to you, please let us know how it can be improved.
Install
There has not yet been a packaged release of bitbangrelay, so the best way to install is via git:
pip install git+https://github.com/SanCloudLtd/bitbangrelay.git
Dependencies
bitbangrelay relies on the following Python modules:
-
PyYAML for config file parsing.
-
pylibftdi for interacting with FTDI devices.
- Note that the C library libftdi must be installed separately for pylibftdi to import correctly.
Usage
usage: bitbangrelay [-h] [--version] [-c CONFIG_FILE] [-d DEVICE] channel action
USB BitBang Relay Controller
positional arguments:
channel Relay channel to control
action Action to perform: 'on', 'off' or 'cycle'
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
-c CONFIG_FILE, --config-file CONFIG_FILE
Config file to load, defaults to ~/.config/bitbangrelay.yml
-d DEVICE, --device DEVICE
Relay device to control, defaults to 'default'
Example usage
-
To turn on a channel:
bitbangrelay bbe on -
To turn off a channel:
bitbangrelay bbe off -
To power cycle a channel:
bitbangrelay bbe cycle- The connected device will be powered off and then 5 seconds later it will be powered back on.
-
To turn off all channels of a relay:
bitbangrelay all off
Configuration
The bitbangrelay library parses a configuration file in yaml syntax to determine the available relay devices and channels.
Example configuration:
# Top level keys give names for the available relay devices. A relay device
# named "default" will be the default if no other device name is given.
default:
# The id is required for each relay device. This is passed to pylibftdi
# to select the appropriate USB device and is typically the device's
# serial number.
id: AAAAAAAA
# The number of channels supported by the relay device. If this is not
# provided then it is assumed that 8 channels are available.
channels: 4
# Channels can be selected by index or by alias. A dictionary mapping
# alises to channel numbers may be provided for convenience.
aliases:
bbe: 0
bbe-lite: 1
beaglebone-black: 2
raspberrypi4: 3
Maintainers
- Paul Barker :envelope:
License
Copyright (c) 2021-2022 SanCloud Ltd.
-
Code files are distributed under the Apache 2.0 License.
-
Documentation files are distributed under the CC BY 4.0 License.
-
Trivial data files are distributed under the CC0 1.0 License.
Metadata
Release files for bitbangrelay 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bitbangrelay-0.1.0.tar.gz | 15.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bitbangrelay-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.0 kB
Release files / bitbangrelay-0.1.0.tar.gz
| Download URL | bitbangrelay-0.1.0.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47cefda164b02ad2089b2f2893a731ba807cf940ca9add0125ce78f6b8cee06c
|
|
BLAKE2b-256 checksum How to use checksums |
e9da046707bab4757081cec968545d7882bc31c4fc07acecd2db105068d5925c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Release files / bitbangrelay-0.1.0-py3-none-any.whl
| Download URL | bitbangrelay-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc5c1fdd3ac080d4da3496eb06c6d76226e0cb6a425a9e63527ad1f85ca1e065
|
|
BLAKE2b-256 checksum How to use checksums |
ddf87b3e709f73006242b2e291871d82fa0f6bd8a82ce9b49fcfe2e720d550f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Security for bitbangrelay 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.