Skip to content

Proxy between JMRI and a serial C/MRI connection

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

sciguy16/pi-cmri-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-cmri-proxy

Rewrite to use the cmri library is in progress

Userland service that runs on a Raspberry Pi and acts as a proxy between JMRI on TCP and a C/MRI network running over RS485. The need for this came about because half-duplex RS485 requires a control signal to toggle the transceiver between transmit and receive mode, which was proving difficult to achieve otherwise.

Usage

Starting the program with cargo run --release will start a TCP listener on localhost port 4000

Installation and removal

There are two handy scripts - install.sh and uninstall.sh. The installation script checks that Cargo is installed and then compiles the binary and copies it to /usr/local/bin. It then installs ip_to_485 as a SystemD service to run at boot and starts it off.

Similarly, uninstall.sh stops and deregisters the SystemD service and removes the program from /usr/local/bin.

Test setup

During development, a Pi 4 was connected to a MAX485 (with level shift divider on the RX side) and two arduino nano clones running a simple program based on ArduinoCMRI that provides a single sensor and single light.

The transceiver was wired to UART4, corresponding to GPIO pins 8 and 9, with the direction toggle connected to RTS4 on GPIO 11.

The following photos show the test setup:

Raspberry Pi 4 with MAX485 transceiver

Two Arduinos running as CMRI nodes

Finally, here is a scope trace showing an incoming CMRI packet followed by the next CMRI poll. The top trace is RS485-A and the bottom is RTS:

CMRI packets over RS485

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Proxy between JMRI and a serial C/MRI connection

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Languages