Hardware Support: CAN Network
There's an emerging trend to develop model-railroad control systems that are based on standard CAN network technology. JMRI provides support for the development and use of these. Two initial efforts are described below.
OpenLCB is a group of hobbyists and manufacturers who have
come together to produce a future-oriented layout control
bus, also called OpenLCB.
JMRI includes basic support for OpenLCB, and more is being developed along with OpenLCB itself.
A group of hobbyists, under the umbrella of the Model
Electronic Railway Group (MERG), are developing a layout
control bus called CBUS. They are creating extensive
JMRI includes basic support for CBUS, and more is being developed along with CBUS itself.
Various CAN-USB adapters are available:
- TCH Technology
- TCH Technology CAN/USB which provides a high-speed connection for model railroad use
- grid connect
- GridConnect CAN_RS, which is also the protocol used by the MERG CAN_RS board
- LAWICEL AB CANUSB and CAN232 adapters.
JMRI can connect to CAN networks in several ways:
To use any of the above Adapters, select the appropriate
device/connection type in the JMRI Preferences. If using a
GridConnect or Lawicel device, be sure to set the appropriate
baud rate under Advanced Preferences.
The TCH Technology adapter does this automatically, so no setting is required.
It's also possible to attach via a TCP/IP connection (EtherNet or WiFi). This can either go to another JMRI instance running e.g. an OpenLCB hub, or directly to an IP-CAN adapter. To configure one of these, open the Connections tab in the JMRI Preferences and:
- Select as System Manufacturer "OpenLCB"
- For System Connection, select "CAN via GridConnect Network Interface"
- Under settings, enter the IP address and TCP/UDP port
for the destination.
OpenLCB CAN Adapters advertise under mDNS/Bonjour, so you can use that to specify the IP address if JMRI is on the same network segment as your adapter. In that case, put "openlcbcan.local." (note trailing period!) in the IP address field.
The port number for OpenLCB adapters is 23 by default.
- Set the connection protocol as desired, e.g. "OpenLCB", the Connection Prefix (usually "M") and Connection Name as needed.
- Click Save, and restart.
JMRI CAN Tools
- JMRI provides a basic Monitor tool for watching traffic on a CAN bus.
- There's also a Send Frame tool for sending CAN frames manually and in sequences.
- For development, there are CAN Scripting tools for sending and receiving CAN frames. These can be very useful in testing hardware, etc.