- Home
- Learn Linux
- Learn Electronics
- Raspberry Pi
- Programming
- Projects
- LPI certification
- News & Reviews
As part of my Pi Signalbox model railway controller project I created Python code for use with VLCB and CBUS. This provides a simple interface to the CANUSB4 module with the ability to control locos and accessories.
I’ve split the project so that pyvlcb remains the powerful underlying Python library for CBUS communication, while Pi SignalBox becomes the dedicated graphical application you see running on the Raspberry Pi today. The PyVLCB library is now available through the normal Python libraries through PyPi and the pip install command.
The library includes the following core classes:
For more details see the PyVLCB library reference site.
Demonstration examples are included in the demo folder of the PyVLCB Github page. This includes the following demonstration.
In the video below I explain the steps taken to create the Python library and to publish it on PyPi.
For more details see the guide to creating a Python library for PyPi.
In this video I explain about the steps I took to understand the CBUS protocol. This involved some reverse engineering through reading source code files, capturing traffic with Wireshark (see: using wireshark to monitor USB packet data), and finding useful documentation that explained the protocols.
Based on this I was able to create a GUI application that can send and receive messages to CBUS and can switch points and control a DCC locomotive. See below for the source code.
I've provided a copy of the document mentioned in the video: CBUS Developer Guide Version 6B
Whilst this is currently work in progress I've made all the current source code available on GitHub.
The following information is from my MERG / CBUS model railway page.
This video explains about the CBUS DCC model railway controller kit from MERG. In the video I look at three kits, including a DCC command station, handset controller and a RJ22 connector kit. This provides a way of controlling model railway DCC locomotives and accessories, using CBUS and a home made controller. Generally the kits are fairly straight forward, but the hand-held controller is significantly more challenging to solder. I’m fairly proficient with a soldering iron and I found some of it difficult, although it shouldn’t be beyond the abilities of most.There is an alternative if you are interested in computer control.
See the following link to understand more about rotary encoders.
Find out more about MERG or about my other model railway projects.
Also see:
For the latest updates please:
Subscribe to the PenguinTutor YouTube Channel
and
Follow @penguintutor on Twitter
Please view the copyright information regarding use of the circuits.