Skip to main content

It's been a long time since I posted something cool but I've been working on some new stuff. If anyone isn't aware GRJ is(or was?) selling some nice legacy-boosters. These don't really amplify the voltage of the base but they drastically decrease it's output impedance so that the 455 KHz signal can drive the big capacitance of large layouts.

It actually works super well. In fact it works so well that if you crank it to maximum it swamps out the DCS packets for layouts running both control systems. This is discussed to death in the (old post) with lots of analytical details and even a video I did if you scroll down far enough. On our particular layout, combined with the sad 100 year old wiring in our 100 year old building that doesn't even have a good earth ground (all the plugs are 2 prong!) we can't find a setting on the booster where we simultaneous have solid Legacy and DCS at the same time. If we crank it above 3V swing, we lose the DCS, and when we go below about 5V we start to have flickering headlights everywhere and need to put ugly groundplane wires we would rather not have. The SD3R guys had similar issues even without the booster last year.

 

Originally working on this idea, we thought about having a switch that turns off the legacy carrier when the DCS packet is present on the track. We even built a test module and did some (measurements) in the club.  We found it sucks because when you cut the legacy carrier out completely (even for a few ms), it totally halts all the legacy trains. An even bigger problem is in our club we have 5 TIUs spaced 100s of feet apart, so we would have to monitor a total of 5X4 =20 TIU ports for DCS packet activity and relay those indications from all over to a central module controlling the legacy signal. Not really a solution.

 

So after more experimenting I found that anywhere we stand in the AGHR club with the remote, the TIU can see the RF signal provided you do an external antenna mod on the TIU. So we came up with a new idea to capture the RF packets from the remotes using the 900 MHz radio link and use that as early warning to turn down (not off the legacy signal). First let me add the constraint that.... yes we know this RF approach won't work with the app, but none of us at AGHR use it anyways. The system seems to work for us and the point of this post is to chronicle all the engineering work so others can duplicate and refine what was done so far.

***************************

STEP 1: Understanding the Latency Requirements

***************************

This began with some basic latency measurements to determine the delay from the time the 900 MHz wireless packet is received to the time the TIU actually puts signal packets on the track. Depending on which TIU port (VAR1,VAR2,FIX1,FIX2) the delay varies as the TIU talks to 1 port at a time. So the key design objective is to build a device that can detect RF 900 MHz DCS packets and then respond by turning down the legacy carrier in this time frame.

Latency

***************************

STEP 2: Capturing the RF packet

***************************

Originally I was using a super expensive $400 custom radio stack (mini-circuits ultra-low-noise LNAs, detectors and stuff to capture the 900 MHz DCS signal packets) but I just figured out a few weeks ago that all that isn't necessary and you can tap the RSSI port of the radio chip on the board inside the TIU itself. If you look on the block diagram of the radio chip the RSSI is actually a side output from the IF limiting stage, so it does carry the same modulation as the output port, although there is DC offset from the carrier since it's an non-biphase modulation.

RSSI

So you can actually tap into it to get a copy of the same signals that (all the TIUs in the club are receiving). Note at the speed of light with a 500ft club house the whole place is only a few microseconds away, so you can consider the whole thing instantaneous on the TIU packet timescales (milliseconds so 1000s of times slower). If you trace the PCB lines you can figure out the tap goes here:

RSSI_ACCESS

So that gets you basically the yellow traces in the above oscilloscope plots. Okay so there's a few things.... first when the signal is super far away the amplitude gets a bit small, so we found we need some amplification. We went with a simple BC547 stage, and then a LM358 comparator to get rid of the pesky DC offset (also a function of range) and boost gain a bit. Schematic goes like this:

RSSI_STAGE

The BC547 is just a common emitter stage with a 10K load, then off into the comparator. The trim on the inverting input sets the threshold voltage where it toggles and then the shunt capacitor calms everything down.

***************************

STEP 3: Decoding for turn-down time context

***************************

 

Okay so here's the next issue we found.... while some common commands like the whistle and speed and bell and such are super short (a few ms), other commands like adding engines, or doing a TIU read can be a lot longer, so it's hard to just assign a fixed time for which the Legacy signal will be turned down for all DCS packets. If we make the turn down too long like 20 seconds each, then in our club where someone is always doing something the Legacy will basically just be turned down all the time and we might as well drop the booster.

 

To solve this we came up with the idea that long commands like adding engines are done very infrequently, while things like whistles and speed/direction/couplers ... are done often. So if we could somehow know what kind of command we were receiving we could react accordingly and assign the proper delay. We already know SanDiegoMark did a lot of work decoding the RS232 protocol on the tether to make his awesome train control program, and it turns out after experimentation that the RSSI signal is actually just an ASK-encoded version of exactly the same code (9600 baud, 1 start bit, 8 data, no handshake). We proved it by capturing lots of sequences (see the attached DCS_ASCII_testing.txt file where we explored different functions and captured the ASCII sequences).

Once the LM358 pre-conditions the RSSI signal all nice we feed the signal into a cheapo arduino/atmel microcontroller (on amazon) and run something like the attached .ino program to decode the packets and set the appropriate delay for the legacy turn-down time. This one just has the add engine, but adding others is easy. It's still a work in progress to capture and add everything we need.

***************************

STEP 4: Controlling the legacy amplitude

***************************

GRJ's booster already has all the complex gain stages and stuff, so we just need to place a simple circuit in between that and the legacy base to modulate the input amplitude. We went simple on this and just used a BJT switched resistor ladder driven by one of the arduino processor outputs. So the stage has a gain of R7/(R9+R7) when the BJT is off, and R8/(R9+R8) when the BJT is on with the condition that R8<< R7. I made all of these trimpots so that if we didn't like how they sit in the club, we could just adjust them in real-time.

control_stage

Anyways it works pretty well. Here's an example of the DCS whistle packet (yellow) with the Legacy carrier plotted on top (blue):

pic_356_1

Because the DCS packet is so short compared to the window timescale it just looks sort of like a vertical line. Similarly the Legacy signal is under-sampled by the scope in order to get a long enough trace time to see the whole sequence so it Nyquist folds and looks like it's a lot lower frequency.

***************************

STEP 5: Clean Up

***************************

Last step  of the design, we polished it up and made a nice PCB that mounts on top of the TIU with the little microcontroller daugher board inside, which is tapped into the RSSI and feeds the Legacy booster. The diptrace files are attached if anyone wants to play with them. I don't like soldering SMDs so I kept it hole thru, and I kept lots of space for afterthoughts and mods, so I'm sure the grown ups can do better on the layout.

IMG_1806[1]

 

***************************

STEP 6: Demo

***************************

What kind of project would it be if I didn't post a one-shot demo video? So here it is:

 

***************************

Acknowledgements!

***************************

This wouldn't make sense without Dale (Who I never interacted with) and GRJ's work on the booster, and without SanDiegoMark's Train control program we wouldn't have been able to decode the thing.

 

 

Attachments

Last edited by Adrian!
Original Post

Replies sorted oldest to newest

gunrunnerjohn posted:

WOW, that's super cool Adrian!  You've been busy!  It appears to work well.

One question.  What effect does the 10 second dropout of the Legacy signal have on the layout?  I'd think that might be long enough to stop a locomotive,  In my tests, at about 4-5 seconds, the Legacy locomotive stops with a blinking headlight.

Yeah that's the whole key to the thing. You can't take it away or the legacy engines stop. You have to just *turn it down*. The booster is 10V swing normal, and we set it to like 3V in the turned down mode.

 

There is one rare situation flaw we're still working out with this when you have a brand new DCS engine that's out of the box and hasn't been given an address yet.  If you put the brand new engine on the layout there is an exchange with the TIU that doesn't involve the remote to tell the engine it's on a DCS layout and do not go into conventional mode... if the engine already has a number (like not 01) it won't go into the conventional mode at power up with or without this packet, but if it's brand new and doesn't see the TIU at the first power up it will. Since there's no RF from the remote to trigger off, this idea doesn't solve that. People don't bring brand new trains that often, so I'm thinking just an override switch in parallel with the microcontroller to manually lower the legacy level for just this situation.

 

 

 

 

Adrian! posted:
gunrunnerjohn posted:

WOW, that's super cool Adrian!  You've been busy!  It appears to work well.

One question.  What effect does the 10 second dropout of the Legacy signal have on the layout?  I'd think that might be long enough to stop a locomotive,  In my tests, at about 4-5 seconds, the Legacy locomotive stops with a blinking headlight.

Yeah that's the whole key to the thing. You can't take it away or the legacy engines stop. You have to just *turn it down*. The booster is 10V swing normal, and we set it to like 3V in the turned down mode.

It'll be interesting to see if the 3V is sufficient all over the layout.  I knew you were adjusting the amplitude, just figured you might be adjusting it a bit too much.

Adrian! posted:
 There is one rare situation flaw we're still working out with this when you have a brand new DCS engine that's out of the box and hasn't been given an address yet.  If you put the brand new engine on the layout there is an exchange with the TIU that doesn't involve the remote to tell the engine it's on a DCS layout and do not go into conventional mode... if the engine already has a number (like not 01) it won't go into the conventional mode at power up with or without this packet, but if it's brand new and doesn't see the TIU at the first power up it will. Since there's no RF from the remote to trigger off, this idea doesn't solve that. People don't bring brand new trains that often, so I'm thinking just an override switch in parallel with the microcontroller to manually lower the legacy level for just this situation.

I'd think a programming track would solve that issue.  Have a track that just connects directly to a TIU channel to program new locomotives, or any that somehow refuse to program on the main layout.  I know the NJ-HR guys program the MTH stuff in the back room before placing them on the main layout.

Add Reply

Post
The DCS Forum is sponsored by

OGR Publishing, Inc., 1310 Eastside Centre Ct, Ste 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

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