Third party cookies may be stored when visiting this site. Please see the cookie information.

PenguinTutor YouTube Channel

PyVLCB / CBUS GUI Application

I'm currently working on a GUI Application to use a Raspberry Pi to control a model railway using CBUS / VLCB.

This is currently in early development and I hope to update this with more information in the future. I have created one video showing some of the challenges I faced due to the software architecture.

Software Engineering / Software Architecture / Programming Language

In this video I explain some of the challenges that I faced in developing the program. This was down to some limitations of the programming languages and the architecture.

I first tried to have this all controlled from within the GUI. As the GUI was programmed in Python I was already aware of issues with Python Global Interpreter Lock (GIL) when using QThreadPool. Normally this can be avoided by using full multi-processing but due to the number of different processes and interprocesss communication this was too slow to be usable. I therefore looked at different client-server models. My first attempt used Zero Message Queue (0MQ), which worked initially but was too slow for the level of response I was hoping for. I had better success using client-server software using a Web API and a simplified server model. I tried using both C and Python code for the server. I'm likely to continue development if the Python version in future.

Source Code for PyVLCB

Whilst this is currently work in progress I've made all the current source code available on GitHub.

About CBUS

The following information is from my MERG / CBUS model railway page.

DCC Digital Command and Control for Model Railways with Raspberry Pi

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.

3D printed holder for DCC controller

I also designed a holder for the DCC controller so that it could be mounted on the back of the baseboard. I had to make some adjustments, but I'm happy with the current version. See the video below for more details.

You can download the STL files and the latest version of the FreeCAD design from Thingiverse. See the link below.

More Information

Find out more about MERG or about my other model railway projects.

Related projects

Also see:

Future projects

For the latest updates please:
Subscribe to the PenguinTutor YouTube Channel
and
Follow @penguintutor on Twitter

Previous Using Raspberry Pi with JMRI
Using Raspberry Pi with JMRI
Next 3D / 2D Design and 3D printing
3D / 2D Design and 3D printing