A-C/MRI

A custom J/MRI+C/MRI Ardino Module

Creating a custom C/MRI module with an Arduino

With a background in electronics and programming, it seems like a natural decision to create a custom automation module for my layout. There are plenty of code libraries to build upon, but using an Arduino Uno or Mega with stacking boards and loose wires isn't my idea of a solution. I also wanted something that could use standard plug-in modules that were inexpensive and easily available through eBay, Amazon, and other resources.

Step one is to prototype something on a breadboard with an Arduino Nano, an RS-485 module, and a 16-channel I2C I/O module. I used a commonly available USB to RS-485 module on the PC and had this communicating with J/MRI pretty quickly. 

I put a sketch together (drawing, not Arduino app) to illustrate the PC board layout and general communication links. The board holds the Arduino Nano, RS-485 Max module, and up to 4 MCP23017 I/O modules. There are a minimum of other components - a few jumper headers for addressing and I2C connections, a 5V regulator, and a few resistors and capacitors for filtering and holding the RESET line during power-on for a clean startup. The I2C connector can connect to 4 additional I2C modules. By using the PCA-9685 16-port PWM drivers, you can controlup to 64 servos per module. That's 128 controls - 64 digital I/O and 64 PWM ports on a 3x4" PCB!

Overview Diagram

This is the basic plan of how this module is laid out and connects to other devices.

A-C/MRI Overview

I suppose that you could employ more than 4 external devices on the I2C bus, but the code I wrote supports 3 address bits or 8 devices max - 4 already on-board. A larger design supports 8 on-board I/O modules and 8 external modules on I2C, but that seemed excessive. The idea is to have more of these to distribute the automation around the layout rather than to have one "mega" controller controlling the whole layout.

Comments