Skip to main content

Here’s a project I’ve been working on for a while under lockdown. After years of controlling my switches from TMCC or Legacy remotes, I decided to implement a physical control panel.

I had a few design objectives for the project:

  • Control 10 switches controlled by DZ-2500s, and 1 controlled by a DZ-1000/DZ-2000.
  • Switch position should be toggled by one press of a momentary button.
  • Indicate switch status with bicolor LEDs.
  • Provide an indication when any yards were open (to guard against trains on the mainline running into the yard)
  • Provide one-touch control to open or close all the yard switches.

 

At least the DZ-2500s might be done with discrete logic, but I had plenty of Arduino parts on hand (and time) so I decided the project would be based on an Arduino Pro Mini. The Arduino reads and controls the switches directly, and controls the LEDs with two MCP23017 expander chips over I2c. Power is supplied by a half-wave rectified supply with a Pololu 5V buck regulator.

I designed a PCB in Diptrace, sent it off to OSH Park, and got back my boards a little over a week later.  Here is the assembled board:

p1

The switches with DZ-2500s were easy: the DZ-2500 drives the white wire to 5V when the switch is curved, and to 1.1V when through. So the Arduino reads the switch state directly from the white wire, and pulls the white wire low to toggle the switch position.

The switch with a DZ-1000 was more of a challenge, since it was never designed for single wire control like the DZ-2500. The DZ-2000 controller also has a white wire that is supposed to indicate switch position, but I discovered it only indicate the last commanded position of the switch. If the switch was thrown manually or by the non-derailing connections it would not be correct.

However, experimentation showed that while connected to the DZ-2000, one of the DZ-1000 control wires is low when curved, and has a sine wave ranging from +3V to +18V when through. I’ve no idea why that voltage appears, but I could feed it to an Arduino input and get a high signal. Because the signal is up to 18V, I used a 47k series resistor to keep the current to about 0.25 mA – supposedly within the safe zone for the input pin’s clamping diodes.

To control the DZ-1000, I used triacs connected to each control wire. The Arduino reads the current state of the switch and fires the appropriate triac to toggle the switch.

I built an enclosure from some plywood and Masonite, and painted it with Rustoleum silver hammered spray:

p2

Toggles and LEDs installed. The wiring is unusually neat for me:

p3

Neatness didn’t last.  After much stringing of wires under the layout and cursing of terminal blocks:

p5

p4

And the panel installed and running!

 

p6

The “YARDS” LED is green when the yards are closed, and blinking when any yard is open. Pressing the associated toggle closes any yard switches that are open, or, if all the yards are closed off, opens them all.

Maybe over-engineered to implement basic switch functionality, but it was a fun project, and will make running trains (especially under DCS) a lot smoother than when switching was only with the remote.

 

Attachments

Images (6)
  • p1
  • p2
  • p3
  • p4
  • p5
  • p6
Last edited by Professor Chaos
Original Post

Replies sorted oldest to newest

Thanks Erik - I've attached the schematic and Arduino code.

The code isn't documented very thoroughly, so ask away if you have questions.  It should be pretty straightforward - besides monitoring the switch positions, the code can initiate three timed running processes (pulsing the triacs, pulsing the DZ-2500s, and blinking the yard light) which are monitored using the millis() timer.

The terminal block is  3.5mm.

Attachments

Images (1)
  • turnouts
Files (1)
Last edited by Professor Chaos

What an amazing job, Professor Chaos!

Thank you for releasing the schematic and the program, I really appreciate that.

A few questions I have:

1. What is the value of the 2 resistor networks R3 and r4?

2. You initialize the MCP23017 as outputs for pins 0 to 11, why wiring them for all 16 pins?

3. The MCP23017 outputs work in pairs (LED & turnout) I presume?

4. You mention 47k values for resistors for DZ-1000 control, where are those?

5. Why not use a 7805 for voltage control?

6. Why not use screwconnectors for the outputs, as used for the inputs?

7. The Pro Mini is soldered to the PCB? Or otherwise? With pins up- and downward?

Again, this is fantastic work, congratulations!

Erik

 

 

@Erik84750 posted:

What an amazing job, Professor Chaos!

Thank you for releasing the schematic and the program, I really appreciate that.

Hi Erik - glad you find it of interest!

A few questions I have:

1. What is the value of the 2 resistor networks R3 and r4?

For the LEDs I'm using, I chose 200 ohms which provides about 10mA to the LEDs.  They're a little bright so at some point I might go a little higher.

2. You initialize the MCP23017 as outputs for pins 0 to 11, why wiring them for all 16 pins?

Pins are cheap .  If I find some other applications for the board I might want to use all the MCP pins.

3. The MCP23017 outputs work in pairs (LED & turnout) I presume?

The MCPs control the LEDs only (they are 2-wire bicolor LEDs).  The toggle switches and sensing wires from the switches are attached directly to the Arduino inputs. For the DZ-2500s, the pins are set to input to read the switch state from the DZ-2500 "white wire" , but driven low as outputs for 0.25 seconds to change the switch position. The toggles also ground the white wire, so pressing the toggle changes the DZ-2500 switch position.

4. You mention 47k values for resistors for DZ-1000 control, where are those?

The DZ-1000 (at least when connected to a DZ-2000 switch controller) shows an offset AC signal of +3V to +18V on one of its control wires when the switch is through. That's what I use to sense the DZ-1000 position, since the DZ-2000 "white wire" only indicates the last commanded position of the switch. Since 18V is too high for the Arduino input, the 47k resistor limits the current through the Ardunio's internal clamping diodes to about 0.25mA.  According to the Atmel application note (here), the clamping diodes are good for about 1mA.

5. Why not use a 7805 for voltage control?

A 7805 would probably be fine, but the buck regulator is more efficient.  I had some of these Pololu modules sitting around and they were only a couple of bucks. Note that you need a half-wave supply if you're using the triacs.

6. Why not use screwconnectors for the outputs, as used for the inputs?

If you heard how much I was cursing as I was working the wires into the screw terminals, you'd know!  I put a two-wire Dupont-type connector on each LED, so it's very easy to plug the LEDis into the pin header.

7. The Pro Mini is soldered to the PCB? Or otherwise? With pins up- and downward?

Yes I soldered the Pro Mini to the PCB. I used longish pin headers so I could attach additional wires (Dupont connectors again) directly to the Pro Mini. The two toggles that are not connected to DZ-2500s (the DZ-1000 toggle and the yard toggle) are connected this way, as is the ground for all the toggles.

Again, this is fantastic work, congratulations!

Thank you!  I've also attached a diagram for the triac daughterboard that controls the DZ-1000.  The Arduino drives these high to actuate the DZ-1000.

Erik

 

 

 

Attachments

Images (1)
  • triac daughterboard

Add Reply

Post
×
×
×
×
Link copied to your clipboard.
×
×