CBUS Arduino

A rather new (compared to Selectrix or DCC) digital control system is "CBUS", developed by members of the Model Electronic Railway Group (MERG) in UK - this is a comprehensive layout control system, using a CAN based bus, see MERG - CBUS - Layout Control System for more info (it includes even firmware updates of the modules via the CAN bus).

The MERG CBUS (CAN-Bus) modules are using PIC controllers with an integrated CAN controller (like the PIC18F2480 from microchip).

But of course the CAN bus can also be listened to with the popular Arduino! A little bit additional hardware is needed to connect to the bus (connector, transceiver and CAN controller MCP2515). You can order Arduino CAN bus shields for example from Watterott or Sparkfun.

CBUS Test Setup

CANdiy Shield I'm using the CANdiy Arduino shield (Watterott), with its CAN transceiver and MCP 2515 CAN controller this is all what is needed as CBUS hardware. The following connection scheme is used with 8-pin modular connectors:
1 = CAN-H
2 = CAN-L
3 = CAN-Shield (=GND)
7 = GND
8 = 12V
I set jumper JP3 on the CANdiy shield (connects 3-shield and 7-GND), and I use the 5V from the USB for the Arduino. I also added a button, connected to PIN4, to be able to trigger the transmit of the message.

CBUS Arduino Software

Below you find the Arduino code to receive the CBUS CAN messages and print them on the serial console of the Arduino. When you press the button on PIN4 (to GND), a short event is sent on the CBUS to demonstrate that sending of messages is working as well - DN_H/DN_L are the device number, and it is toggled between ASON and ASOF.

Your Browser cannot display the code text! Please send me an email, then I will send you the file - or download the whole lib below.

Here your can download the complete "CBUS" Arduino software, it is based on Fabian Greifs CAN-Lib and in part (queuing the received CAN Messages) also on Railuino by Jörg Pleumann. Pure polling of the CAN messages in the main loop is NOT FAST enough to receive all CBUS messages!

By the way: CBUS uses a completely different protocol than Maerklin! The messages have nothing in common but the use of the same CAN hardware.

Download: CBUS-0.8.zip

Please unzip in the libraries folder of the Arduino SW and have a look at the example code.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer