Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Python-based control library and examples for the Lumitec Poco CAN bus protocol.

Notifications You must be signed in to change notification settings

lumiteclighting/poco_can_py

Repository files navigation

Poco CAN Python Examples

Python library and examples for controlling the Lumitec Poco Digital Lighting Control Module using a CAN bus proprietary protocol. This repository provides a cross-platform reference implementation for third-party integration and testing.

Installation

Prerequisites

  1. OS: Linux (tested with Ubuntu 24.04)

    Windows should be capable, but not tested.

  2. Python 3.7+ (tested with Python 3.8+)

  3. CAN Hardware and Driver

Linux + SocketCAN Setup

  1. Find the CAN interface:

    # Show kernel messages. (Ctrl-C to quit)
    sudo dmesg -w

    Now plug-in the CAN adapter and look for a new line to appear like this:

    [...] peak_usb 1-2.3:1.0 can0: attached to PCAN-USB channel 0 (device 0x000000FF)
    

    This shows the driver has added the can0 interface. You may see can1, can2, etc. If you don't see a can interface, you may need to load the driver for your hardware. See troubleshooting section below.

  2. Configure CAN interface (250 kbps baud):

    sudo ip link set can0 type can bitrate 250000
    sudo ip link set can0 up
  3. Verify interface:

    # Show can0 link status, should say "UP".
    ip link show can0
    # Monitor some CAN traffic, should see some frames. Ctrl-C to exit.
    candump can0  

Windows Setup

TODO. (See Windows section of: https://python-can.readthedocs.io/en/stable/installation.html)

Quick Start

Clone this repository

git clone https://github.com/lumiteclighting/poco_can_py.git
cd poco_can_py

Run Example GUI Launcher

This script should install the necessary requirements into a python virtual environment and run a launcher GUI to demonstrate the examples.

./start_example.sh

Troubleshooting

No can0 interface

You may need to load kernel modules:

sudo modprobe can
sudo modprobe can_raw
# For USB-serial CAN adapters, you may need slcan
sudo modprobe slcan  

Python error: No module named 'can'

If you are using the python virtual environment, activate it by running the included script:

source sourceme.sh

Otherwise, install python-can:

pip install python-can

"RTNETLINK answers: Operation not permitted"

Run with sudo or add user to netdev group:

sudo usermod -a -G netdev $USER
# Log out and back in

No CAN communcations

  1. Bring up CAN interface. See steps above for SocketCan.
  2. Check bitrate matches (250 kbps for NMEA2000)
  3. Verify CAN termination (120Ω at both ends)
  4. Check cable connections (CAN-H, CAN-L, GND)
  5. Use candump can0 to verify CAN interface works

Protocol Details

The protocol is defined here:

TODO: add link to protocol document

Contributing

This is a reference implementation for third-party integration. For issues or suggestions:

  • Open a GitHub issue or Pull-Request on this repository
  • For professional support, contact [email protected]

License

Reference implementation provided for third-party integration with Lumitec Poco devices. This example code is in the public domain.

About

Python-based control library and examples for the Lumitec Poco CAN bus protocol.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •