JMRI Two Arduino control with CMRI

In this article I will be showing how we can connect more than one Arduino to JMRI PanlePro with the CMRI library. To be able to do this we will need a USB to 485 converter and a RS485 module for each Arduino which can easily be picked up from eBay. Below is the diagram showing how to connect up the Arduinos to the RS485’s.

For the Arduino code both are pritty much the same with only the CMRI address being different.

#include <CMRI.h>

#include <Auto485.h>

#define CMRI_ADDR 1

#define LED 13

#define DE_PIN 2

Auto485 bus(DE_PIN); 

CMRI cmri(CMRI_ADDR, 24, 48, bus);

void setup() {
    pinMode(LED, OUTPUT);

void loop() {

    digitalWrite(LED, cmri.get_bit(0));


The part of the code below will need to be a different address for each Arduino as shown in my video blog below.

#define CMRI_ADDR 1

Once you have this uploaded to your Arduinos and all connected up it is time to start PanelPro. When you start PanelPro you should notice that the com port has been lost and will be red as shown below. This is because we are now using the USB to 485 converter.


We need to click on Edit > preferences to bring up the setup page we did on my first blog. In the drop down menu for serial port select the USB with the port you have it connected to. Then we need to add the nodes, so click on confiugure nodes to bring up the nodes page.


In the node address put 1 in for the first Arduino and click Add Node, then click on configure nodes again so we can add the second Arduino which will be node 2. Each Arduino you add in this way will need a seperate node addresss. Once this has all been done make sure you save the settings and restart PanelPro so that all the settings are implemented.

Once PanelPro has restarted click on tools > tables > lights so we can add a light control for each Arduino.


For the first Arduino the address will be 1001 and for the second Arduino the address will be 2001. Once you have added both these addresses to your table you are done. Click on the light buttons for each address and the on board LED on the corresponding Arduino should come on/off. You now have two Arduino's with 48 outputs and 24 inputs each. You can add more this way but I have not tested more than two at the moment.



Cookie Policy

About Us

Privacy Policy

This site was created and designed by S Brackstone