Skip to main content

TC420 LED Controller library and command line interface

Project description

TC420 LED Controller Python Library and Command Line Interface

TC420 is a LED dimmer/controller mainly used for aquarium lightning. There is an attached software, PLED, you can use for programming it, but it is not very well written, and not good for automation tasks. Also it is Windows only. You can found more information on its fun (not official) site: https://www.tc420.net/.

I reverse engineered the USB protocol the device uses and wrote this library and CLI tool for making endless possibilities from this device. I successfully implemented all the functions PLED.exe have.

The library is cross platform, works everywhere where libusb works. But because it is a HID device, and MacOS does not allow to detach kernel drivers of HID devices, on MacOS it is extremely hard to make it work in current form. But I tested on Windows and Linux, and works fine there. It works on (all kinds of) Raspberry Pi. (Actually there is a python library for HID devices, so theoretically it is possible to rewrite the lib using hidapi, and then it could work on MacOS as well, pull requests are welcome...)

It has a full featured CLI, which can act as a reference for the libray. Also you can use it for automation, or just for fun.

Possibilities / ideas

  • You can program your device in shell scripts / batch files, or with Python programs
  • You can run immediate scenes, e.g. a sunset or sunrise by a click to attract your guests
  • It is possible to access the device remotely by e.g. a Raspberry Pi Zero W
  • A web / mobile application can be written to start scenes, or modify program of device (not yet written by myself)
  • Different color themes on sunny/rainy/cloudy days, by using online weather sources
  • Real sunset and sunrise program every day by using sunset/sunrise database.
  • ...

Install

Linux

  • Install the library:
pip3 install tc420
  • Install libusb if not installed. On Raspberry pi it is installed by default.
  • Create a plugdev group if not exists, it exists by default in all Debian based distros.
  • Enable the access of the device by users in plugdev group with an udev rule found here: 99-tc420.rules. Put that (by root user) in /etc/udev/rules.d/, then replug your device.
  • Put yourself into the plugdev group then relogin:
sudo adduser your_user_name plugdev

Windows

pip install tc420

From source

This description works without modification on Linux, on Windows, you may need to use pip instead of pip3 and python instead of python3. And the activate.bat is in the Scripts folder inside venv.

  • Clone package from GitHub:
git clone https://github.com/wallneradam/tc420.git
  • Install virtualenv (globally) if not yet installed:
sudo -H pip3 install virtualenv
  • Create a VirtualEnv inside the cloned directory:
virtualenv -p python3 venv
  • Activate it:
./venv/bin/activate
  • Install package with requirements:
pip install -e .

Now you have tc420 command in your virtual environment.

Usage

Both the library and the CLI tool is documented and the source code is commented, so you can find all information inside them.

CLI

You can have the help of tc420 command by running:

tc420 --help

This will only give you brief information about all commands. You can have full description of every commands by running: tc420 [command] --help e.g.:

tc420 mode --help

Getting started

For checking if everything is working you can sync the clock:

tc420 time-sync

Or you can run the demo which randomly fades in-out all channels:

tc420 demo

If something is not working, you probably not installed libusb well, or you need to check if you have permissions to access the device.

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

tc420-0.2.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

tc420-0.2.1-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file tc420-0.2.1.tar.gz.

File metadata

  • Download URL: tc420-0.2.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for tc420-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d20e5618978f53e99d2e9f4172e906acb9f4e14da64c4620c9747034d2d830e5
MD5 55a5703a69812286c1e692ec3db4457e
BLAKE2b-256 9404f4d3f81afa928e8dde6fa9468880adb3cdc2d1da392d5a1cb9778ff53449

See more details on using hashes here.

File details

Details for the file tc420-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: tc420-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for tc420-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82d873c32d9b93bb386c3ae3ae36295c18c8c2e21b8521e91f707a89dbc864c7
MD5 67c964d61d80eecab7e57123062d0b01
BLAKE2b-256 488c11f6790f86dacdff331f5dc70d187943f30f190164f771ec014d53145a6c

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