Model Train-related Notes (a.k.a. “blog”)

These are personal notes and musings on the subject of model train control or automation or whatever I find interesting.


[2016-04-09] Use an NCE AIU and IR sensors

I have IR reflective sensors, the idea would be to connect them to an NCE AIU to detect position in 2 or 3 spots for speed control.

(Also I got an NCE Q-Snap to control 4 twin-coils, This would cover the front cross-over (2 turnouts), the yard entrance Y1 and the Y1/Y2 yard turnout. Really the point is learning and see what it’s good for since I can already control these turnouts with the Arduino/DigiX).

One idea is for speed matching, using one NCE AIU and 2 sensors.

How do I connect my IR sensors to the NCE AIU?

This is how I use the IR sensors with an Arduino using the internal pull-up and next to it is the AIU input circuitry:

 

There's a good match here: connecting the IR receiver collector to the 5V/pull-up side of the AIU should do exactly what we want with the AIU input driven low when an IR reflection occurs.

I can get 5 V to drive the LEDs out of the DigiX.


[2016-08-04] Yard Design Links

Yard Design 10 Rules: http://www.housatonicrr.com/yard_des.html very good intro.

        Somewhat unrelated, very interesting read on Housatonic Railroad Design Philosophy.

Tips of Freight Yard design: http://www.featherrivertrains.com/documents/kal_12248.pdf

Yard Operations and Design: https://www.x2011west.org/handouts/ldBootcamp-YardOps.pdf

Many LayoutVision pages relevant: http://www.layoutvision.com/id18.html 

        Love for the yard: http://www.layoutvision.com/id19.html 

        How to classification yard: http://www.layoutvision.com/id20.html

        Ops on a classic 4x8: http://www.layoutvision.com/id39.html

        Beware of CAD: http://www.layoutvision.com/id40.html (agreed on the S curves!)

Interesting design. Note that according to LayoutVison, typical west yards don't have an A/D.


[2016-08-22] Home Control Panel

DigiX: 11 x 6 in

Q-Snap : 4 x 3 in (DCC bus)

AIU-01: 4 x 3 (2 RJ12, comes with one cable)

Oscillo + board: 2 x 3 // 3.5 x 3

UTP: 3 x 2 x 2 Deep

Notes:


[2016-08-25] NCE QSnap and EZTrack #6 Crossovers

Experiment from tonight: control the EZTrack #6 crossovers using the NCE QSnap. ⇒ Failed.

I have 2 EZTrack #6 turnouts mounted in cross-over configuration. The idea was to power them from a single QSnap output to save one output for each cross-over.

The QSnap has no problem driving a single #6. But ever the largest timing I tried does not make the crossover (2 turnouts in parallel) toggle properly. They either bounce or switch half-way.

I also tried using a 9V DC power brick instead of the DCC power. That didn't help. Supposedly that way the turnout should get 9x2-2 = 16 VDC. However from experience I remember I always failed to trigger them in DC, which is why I previously used the AC from the EZTrack ACC power brick.


[2016-09-26] Direct Access to NCE QSnap Mk2

From both the NCE USB v7 doc (see NCE web site) or from

http://jmri.sourceforge.net/help/en/package/jmri/jmrix/nce/packetgen/NcePacketGenFrame.shtml

Example: 0xAD is for switching an Accy/Signal. There is no provision to read the state.

Note: when trying in JMRI > NCE Command, "Binary" means hex without x, seriously \o/ ?

Lockout CV 556:

That means I can trivially command that from an Arduino and bypass JMRI if needed.


[2016-10-07] Started looking at the NCE Switch-8

I got an NCE Switch-8 to learn what I can (and cannot) do with it for Randall.

Looking at the electronics on the board… If there’s one thing I like about the NCE electronics, it is that they are not fancy. This is the tech I grew up with and I can look at the board and recognize the components and understand what they do. I hope it will stay like that.

Microproc: PIC16F1936

http://www.microchip.com/wwwproducts/en/PIC16F1936

http://ww1.microchip.com/downloads/en/DeviceDoc/41364E.pdf

Pin 1 = Vpp (programing voltage)

Pin 8 = Vss (-)

Pin 20 = Vdd (+)

Power: MCC 7805CT

http://www.mccsemi.com/up_pdf/MC7805CT(TO-220).pdf

Front Left to Right : Pin 1 / 2 / 3

Pin 1 = Input / Left

Pin 2 = GND

Pin 3 = Output / Right

On the Switch-8, the large programming header can be used to get the +5 from the 7805.

From top, #2 is the +5 and #3 is the Gnd from 7805 (shared with the GND headers).

NCE AIU-01: there's a similar 7805. A +5V can be soldered on the little through-hole just on top of the 7805 on the board. Measures 5V. For a single IR sensor, use a 220 Ω resistor.


[2016-10-08] NCE Limitations

https://ncedcc.zendesk.com/hc/en-us/articles/200933425-Common-Cab-Questions 

I’ll repeat this in case it’s useful for others:

Regarding the NCE cab bus and the NCE USB interface, I realized I have two of them at home (one straight, and one modified for the direct serial-to-Arduino). They are both on address 63. I just realized the other day they were on the same address and it’s somehow not a problem, although only one polls the NCE AIU, the other one just sends commands.

On the NCE Power Pro: highly recommended to ditch USB and use the RS232, otherwise will have limited functionality ⇒ it was OK for pure cab command as I was doing before at Randall but all indications say it is not suitable to get the AIU stuff. Oddly enough, AIU status works with the Twin but the pages all say it will probably not work with the higher end Power Pro.

Update: Tried it with the Power Pro and I can confirm.

Of course, now I remember that I read about this a while ago:

https://sites.google.com/site/markgurries/home/nce-info/nce-usb-limitations

Bottom line for Randall I'm going to have to switch to RS232 with a USB adapter.

All forums and sites point to the same Keyspan USA-19HS adapter: http://amzn.to/2dBYkNY  … $25

Cable: Straight (not null modem) RS232 cable. 50 ft one http://amzn.to/2zn4vfl … $8 from monoprice.

RS232 max length is 50 feet. That cable worked fine for me.

If the AIU had turned to be a dead end, the fallback plan B would have been to get an arduino with a wifi or ethernet shield, wire sensors directly to it and have a Go program generate NCE AIU status like at home. This is similar to the Translate project where I have a local program on the computer that simulates an NCE bus protocol and JMRI just thinks it’s connected to some NCE thingy over ethernet. Works like a charm.


[2016-10-11] JMRI Logix

Looking at JMRI Logix, this is a non-script click-o-drome if-this-then-that.

Conditions range from block, sensors. Actions are signals, turnouts, scripts or warrants.

Conditions can act when set or on change.

No direct throttle control, maybe indirectly via warrant scripts to run "auto trains".

One possibility is starting a script when some condition happen.

Seems interesting for people who don't want to write scripts. Tons of clicking to get things done.

Seems ideally suited for simple linear decision trees, not for free-form scripting.

Examples would be signals or turnouts set depending on block usage.

For my automation purposes, it seems fairly weak and I’ll design my own software that uses a text file for configuration. Somehow it makes non-tech people very nervous and Windows users especially seem to enjoy clicking ad nauseum in poorly designed modal dialog boxes instead of having a single text file script they can look at quickly.


[2016-12-01] IR Sensors

The IR reflective TCRT5000 sensors (specs) are being somewhat obnoxious. Original planning was to mount them under track, pointing upwards, in reflective mode.

Pros:

In practice, I found the following issues:

Possible solutions to try:

Note:

20%-38% discrepancy in the resistance value? I'm not trusting the resistors (some random 5% thingy) nor the no-name meter and a single data point for each, but still that’s quite a range.

Other solutions to try:


[2017-04-10] Layout #3 "Test Track"

I tore down my previous layout #2 since it didn’t have a purpose anymore -- originally it was for the kids to play with and for me to play with cameras recognition of trains and automation. I’ve done my part, and the kids didn’t show interest anymore. Being a 4x9”, it was still taking valuable space in my small room. Time to update.

What I cared for is having a workbench and a simple test track on top of it. I came up with a very simple L-shaped workbench design. The workbench is designed to not have any legs in the way and lots of storage space underneath. For the test track, I have a bunch of EZ-Track around so I just used that. It’s suitable for minor switching. I won’t add any scenery, it does not look like a shelf layout since it’s a workbench.

I find EZ-Track really sturdy and easy to work with. The electrical connections are really good so the whole thing can be powered by a single rerailer terminal.

Although I do like the EZ-Track for the ease of snapping and the good contact they make, the turnouts are frankly quite so-so. Using two #4 head-to-head is guaranteed to make an S-curve issue that will derail a lot of rolling stock, for example. On all of them the point isn’t always flush with the rail and lacks a spring to keep it in place once the twin-coil has pushed it in one direction.

A few of my EZ-Track #6 turnouts started creating shorts over time. The frog can be either powered or unpowered. I like it powered but on some of them the frog can make contact with the inside rails -- there’s an insulating gap and it’s not very consistent in size. When installing the turnout, it’s easy to push the inside rails enough to close the gap and create shorts. This is easily fixed by using an Atlas Model Railroad Super Saw to recreate the gap:


[2017-04-12] Powering a LED off DCC

Very interesting discussion here: http://cs.trains.com/mrr/f/744/t/230553.aspx

Summary, TL/DR: We can power a LED directly from DCC, just add a resistor to limit to about 10 mA (or less if too bright).

Suggestion is "nice to have" a reverse parallel diode to limit the reverse voltage on the LED:

However another comment indicates it's enough to compute R to be within the specs of the reverse voltage of the LED (assuming I have the specs).

From [richg1998]: "The NCE Power Cab uses a red led and a 1k resistor to monitor the AC out of the Cab. … No reverse diode…"

That's a good point. SGTM.

This is nice and could apply to Randall on the reversing loops:

[Mark R.] "I have four signals on my DCC layout that give polarity indication going into reverse sections. The green LED is attached to opposite rails on either side of the gap, and the red LED is attached to the same rail on either side of the gap. These LEDs have been running straight off of DCC track power with no inverse protection for over 15 years and have not damaged any of them."

Let's think on how that works electrically by taking an example. Let’s say we’re looking at the “end” of a reversing loop that uses a manual toggle to reverse the polarity.

And if the rails polarity is A/B, we have across the gap:

Since it's a sort-of-AC signal, the 2 LEDs can be on either side:

Now imagine the 2 LEDs are assembled to look like a dwarf signal placed next to the reversing loop turnout. It would make a visual indication on whether the power toggle is in the right direction. Even when using an automatic reverser module, this would be a nice display to have.

We can use the exact same principle to power a green/red mast to indicate alignment of a turnout, e.g. in the case of Sonora at Randall when we have 2 tracks going into one by using the polarity of the frog as a common to both LEDs.


[2017-10-31] NCE AIU and short trigger events

This is for Randall but I might just enjoy it myself too… The NCE AIU suffers from an obvious polling refresh rate issue: if an input doesn't trigger long enough, it will be easily missed.

Question is what would be the simplest circuitry possible to make an input trigger longer?

From the NCE AIU pdf:

There's a grounded common and a 5V pull up on each input.

The obvious way is to use an NE555 to generate e.g. a 1-second pulse. It can be powered by the 5V from the NCE AIU to make sure they share the same ground and power (both 5V need to match to be a closed circuit). This requires at least one RC circuit on the 555, and we need one per input to deal with. Potentially an NCE AIU has 14 inputs, even using a 558 (a quad 555) would still require 4 chips and some wiring or a PCB.

At the other extreme, the “simplest” circuit would be to not have any extra circuitry at all. One option I do not have is reprogram the NCE AIU. I don't think NCE would give me the source, which is too bad because I could just trivially do the 1-second delay in software -- or more exactly, sample and latch any trigger input till the next read from the NCE bus.

A more "modern" solution would be to stick an Arduino in between, e.g. an Arduino Nano is fairly cheap. How many would I need for 14 inputs? 18 pins usable per Nano e.g. 9 inputs and 9 outputs. The Nano can be powered from the 5V from the NCE AIU and would basically simulate the inputs for the AIU. Although at that point, I’d basically add an RS485 shield to the Arduino and consider getting rid of the NCE AIU to begin with.

The cheapest and simpler solution (as in "less wiring") would be to put a condenser on the input, it should lower it slowing and then raise it slowly. That would introduce a delay into the trigger and the release so it might be good enough. The time constant to reach 63% is τ = R x C. Say the condenser is fully discharged. We have R=10 kΩ, 1s ⇒ τ=C=100 µF or τ=0.5s ⇒ C=50 µF. That's not unreasonable. There should be some resistance in series with the button to not fully short the condenser, say something like 1 kΩ.

~~

[Back to main page]

~~