Jump to content
 

Control Panels for DCC-EX - anyone Used EX-IOExpander for this?


Recommended Posts

I'm getting to the stage where I need to look at how I will control points and routes for my planned layout - where if construction was a bit faster progress would be glacial. Given that my planned DCC command station will be an Arduino Mega running DCC-EX, I thought I'd venture into the world of using DX-IOExpander to drive this. Anybody got experience of doing this?

 

Essentially I'm looking to have one or more additional Arduinos (also likely to be Megas) running EX_IOExpander where the pins on the Mega are connected to push buttons to drive the point motors- I plan to use DCC Concepts Cobalts to switch points as it includes the frog-switching option directly. Using EX-IO Expander also opens up the possibility of using one or more PCA9685 boards to control LEDs to give route indication on the panel. I intend to use three PIN LEDs (common cathode) which switch between red and green to indicate the active routes - the green PIN going to one PCA 9685 servo slot and the red pin going to the next. 

 

In the DCC-EX command station, you can set up a route such that it gets triggered by a button on  the EX-IOExpander being pushed so with one button push you can control multiple points and set a route, such as throwing all the points to release a fiddle yard line to the layout main line, or setting a route to the destination on the scenic boards.

 

Since DCC-EX uses the I2C protocol to communicate between Arduinos and other boards (e.g. the PCA9685s), there is the challenge of the length of the cable run. I plan to get past this by using Cat 5 cable with Sparkfun's Qwiic bus (https://www.sparkfun.com/qwiic) which converts the I2C signal into a differential signal to give a much longer cable run for the I2C bus.

 

So far, I have ordered various components such as the LEDs and buttons, but once I get to construction I will update you all with progress. 

 

I believe this technology offers some really exciting possibilities and I'm looking forward to sharing my adventures.

Link to post
Share on other sites

  • RMweb Premium

I built a panel with momentary toggle switches and push buttons to activate anything from individual points (DCC), routes, semaphore signals, cranes and to provide light outputs and servo outputs on DCC-EX with IO boards on the I2C bus - I didn’t need the IO-expander (i don’t think it was available then). But a mix of the MCP23017 (16 pins), PCA9685 (16 pins) and PCF8574 (8 pins) using all of the available addresses gave me loads of pins to use. I can’t recall if they are all addressed in the 0x20-0x27 range (I recall looking at some that used a different address range) but that’s at least 8 boards giving 128 pins.

Link to post
Share on other sites

Thanks for the reply. It's very encouraging. Did you have any issues with the length of the cable run on the I2C bus and if so, what did you do to address it?

 

At the moment, I'm just waiting for various components to arrive from Ali Express before embarking on a 'proof of concept' build.

Link to post
Share on other sites

I'm not familiar with the circuits you are using but basic i2c was originally for short distances (on the same or adjacent pcb). If converted to differential signals, terminated correctly and going over a twisted pair it could be good for 10's of meters (ymmv).

 

Some discussion at:

https://electronics.stackexchange.com/questions/106265/maximum-i2c-bus-length

From the above it looks like you can increase reliability by reducing the data rate, if that is possible?

 

 

Link to post
Share on other sites

On 27/07/2024 at 17:29, H2O said:

I'm not familiar with the circuits you are using but basic i2c was originally for short distances (on the same or adjacent pcb). If converted to differential signals, terminated correctly and going over a twisted pair it could be good for 10's of meters (ymmv).

 

Some discussion at:

https://electronics.stackexchange.com/questions/106265/maximum-i2c-bus-length

From the above it looks like you can increase reliability by reducing the data rate, if that is possible?

 

 

 

Yes - basic I2C is intended for short distances, but by converting to differential, you can get over 100 foot cable runs. I'm planning to make use of these pieces of kit - Sparkfun qwiic bus end points:

spacer.png

 

https://www.sparkfun.com/products/16988

 

It's a really nice little piece of kit - basically the two small four PIN plugs are the I2C bus - the VCC, GND, SCA and SCL. The circuitry converts the I2C signal into a differential one and that can be transmitted down CAT 5 network cable via the network port.

 

This other bit of kit is also really useful:

 

spacer.png

https://www.sparkfun.com/products/18012

 

Basically you can plug in four I2C devices to this little board and they are then all on the same bus. I'm looking to use one of these to hook up an Arduino Mega, and two PCA9685 boards similar to this:

 

image.png.7f027a659a9b880b4d57fdcf50b596a6.png

 

The PCA 9685s will control the LEDs - you can connect up to 16 on one board using the GND and PWM pins and then the other end of the multi port will connect to the qwiic bus end point to provide a CAT 5 cable out of the control panel box to an I2C bus that can run underneath the layout to hook up with the DCC-EX command station. It solves the I2C limited cable run problem in a rather neat way. I should have the components I need for a proof of concept this weekend. 

 

It won't look much initially, but it offers a really powerful way to control a layout with DCC-EX.

 

 

 

  • Like 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...