Arduino Library support for the NCE Cab Bus

Development Throttle Prototype

A new MRRwA Library (NceCabBus) for developing NCE Cab Bus devices is available and supports developing:

  • Throttles (with or without a Display)
  • Auxiliary Input Units (AIU)
  • FastClock Displays

The library is hosted on GitHub here: https://github.com/mrrwa/NceCabBus and is also available directly in the Arduino IDE Library Manager – search for NceCabBus.

Currently there are 3 examples included with the library:

  • Throttle-OLED-SSD1306-M32U4. This example is the code for the “Development Throttle Prototype” shown in the picture to the right, which has a 4×4 keypad, a potentiometer to set the speed and a 128 x 32 pixel OLED display to display the 2×16 lines of text that would usually be displayed on a NCE Throttles’s LCD display. The example code runs on an Arduino Pro Micro, which has a AVR Mega32U4 chip, but should be able to work on other chips with a few tweaks.
  • AIU-M32U4. This example enables an Arduino to emulate a Auxiliary Input Unit (AIU) using 14 Arduino input pins and an RS485 interface. The pictures below give you an idea of how you could build such a device.
  • FastClock-M32U4. This example decodes the FactClock information on the Cab Bus and writes it out as Text on the Arduino Serial port, to demonstrate the minimal capability, however it would be far more useful to connect it up to one of the many large LED / OLED display modules readily available on eBay.

Wiring up a RS485 Chip to the NCE Cab Bus

There are a number of options for wiring up a RS485 chip to an Arduino and below is a simple ASCII Art schematic of how to connect an Arduino to the NCE Cab Bus.

----+      
    |      
AVR |                 /|             
    |                / | A           
    |               /  +-------+    
    |          RO  /   |       |    
 RX +-------------+    |       |    
    |              \   | B     |     
    |           /RE o  o---+   *-------------- RS485 A/+ Cab Bus Pin 3
    |               |\ |   |   |     
    |               | \|   |   |     
 TE +---------------*      |   |    
    |               |      |   |    
    |             |\|      |   |    
    |             | + TE   |   |    
    |             |  \   B |   |    
    |          DI |   o----*---|-------------- RS485 B/- Cab Bus Pin 4
 TX +-------------+    \       |     
    |             |     +      |    
    |             |    / A     |    
    |             |   +--------+    
    |             |  /               
    |             |/
    |
GND +--------------------------------------------------- Cab Bus Pin 2
    |               
----+                                                
      

You can build a simple Arduino project with NCE Cab Bus RS485 interface chip using a bit of StripBoard and an RS485 interface chip. I happened to have some SN75176AP chips but the pinout of these 8-pin DIPs are pretty much the same, so the pictures below should give you a good start.

Underside of StripBoard
Minimal Arduino Pro Micro (Mega32U4 Based) and DIY RS485 Interface