Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sciguy16/pi-cmri-proxy
Proxy between JMRI and a serial C/MRI connection
https://github.com/sciguy16/pi-cmri-proxy
cmri raspberry-pi
Last synced: 12 days ago
JSON representation
Proxy between JMRI and a serial C/MRI connection
- Host: GitHub
- URL: https://github.com/sciguy16/pi-cmri-proxy
- Owner: sciguy16
- License: apache-2.0
- Created: 2020-09-13T11:18:44.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-09-16T19:10:40.000Z (over 4 years ago)
- Last Synced: 2024-11-10T23:43:50.500Z (2 months ago)
- Topics: cmri, raspberry-pi
- Language: Rust
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# 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](https://github.com/madleech/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](images/pi.jpg)
![Two Arduinos running as CMRI nodes](images/arduino.jpg)
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](images/scope_trace.jpg)
## License
Licensed under either of
* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)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.