Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

How to add partial computer control

4297 views
28 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    March 2014
  • 121 posts
How to add partial computer control
Posted by FowlmereRR on Wednesday, April 12, 2017 5:07 AM

Hi - My layout, which is in the planning stage, will be double decked, with a motorised elevator between levels. I would like to make provision for this to automated at some point, and so am looking how to take over control of a train on approach to the elevator.

My thoughts so far run like this: 

1. Equip each loco with an RFID chip, and have readers on the approaches to the elevator.

2. A microcontroller will be monitoring loco speed commands on the DCC bus, so will know what any given loco was last commanded to do.

3. When a loco enters the elevator approach, it will be detected by RFID. The controller will then isolate the approach track from the main DCC bus and control the speed of the loco itself.

4. Via a sequence of opto sensors, the train will be stopped on the elevator with the loco at the "out" end.

5. The elevator will be moved to its new level. When the system tells the controller that the elevator is properly positioned, the train is accelerated off the elevator, onto another isolated section of track.

6. On leaving that section, the loco is now back on the main DCC bus, and should again be under control of the original throttle.

I'd be interested to hear comments from any of you who know DCC way better than I do (not difficult!) as to whether this is workable. I'd especially like some pointers towards the appropriate technology (keywords to research) for creating the localised DCC control "district" around the elevator (i.e. what sort of interface to generate the power and DCC output).

There may be some fundamental things I have missed about how DCC works that would sink this idea, so better I find out now! For example, I have assumed that speed commands are only sent when the throttle setting changes, and so the loco would continue on to my isolated section in the absence of commands providing it had power.

All contributions welcomed. Thanks,

Bob

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Wednesday, April 12, 2017 6:40 AM

 You don't need to isolate the elevator section from the DCC system, you really just want the microcontroller to take over as a throttle for whatever loco ID enters the area and is detected by the RFID. Code for throttle commands for most common systems is available for a few different microcontrollers, so the actual communications protocol part is done. There are also RFID libraries for Arduino that can read the RFID sensor. Depending on the DCC system, you would have to force the 'robot throttle' to take over from the user throottle controlling it up to that point. Usually not too difficult. Handing it BACK to the throttle when it gets to the other level though is going to be much harder.

 The one possible problem I see is what if there are more then 1 loco in a consist, the RFID tag will identify the lead loco as 1234 and the trainling loco as 4567 but actually they are in consist 30. You have no way of knowing that from the RFID. You MIGHT be able to determine that by querying the command station, but you'd have to do that every time and be able to handle a 'fail' from the command station for when the loco ISN'T in a consist to drop through and control it directly by the number referenced by the RFID tag.

                                    --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Wednesday, April 12, 2017 6:50 AM

Hi Randy - thanks for your input. I'll look into throttle commands - something I didn't know about. The main reason that I thought in terms of isolating the elevator section was so that the original throttle could be left where it was set at, and the elevator controller would get the loco back to that speed before it left the isolation zone. That way, the operator (me) wouldn't need to do anything to take back control.

Obviously ALL STOP and similar global commands would need to be taken care of, but the general idea would be that the elevator was made "invisible" as far as possible.

But I'll consider any approach. btw - I have an ECos 50200 command station, and will be adding a mobile throttle.

I'll consider the consist issue, but i have never planned to run multiple locos like that.

 

Bob

  • Member since
    December 2004
  • From: Pa.
  • 3,361 posts
Posted by DigitalGriffin on Wednesday, April 12, 2017 9:31 AM

you have your hands full with this one. You need one of the following:
1) Lenz Asymetrical DCC which will invoke a stop command when there is a power difference between left and right rails. This limits you to Lenz decoders

2) Bi-directional communication (Transponding). This limits you to Digitrax decoders and digitrax systems and sensors. The above two will have to be combined with an IR or photo sensor to detect when the train is in the block.

You could theorhetically cut the power once a photo cell is covered, the restore it once the elevator has moved. But if it's DCC, you need to switch direction for the train unless it's going on the same direction once it unloads.

To be honest, I never seen a real reliable elevator system that was automated.  Lining up the tracks so it doesn't derail is an epic pain in the tuckuss.

Don - Specializing in layout DC->DCC conversions

Modeling C&O transition era and steel industries There's Nothing Like Big Steam!

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Wednesday, April 12, 2017 9:55 AM

Don - Thanks. Yes, it will be a challenge, and if the challenge is way too big it won't get done, hence me asking.

I am puzzled by your point 1 - why would I need such a thing? My plan would be to not switch the approach section to the local controller till the loco was fully on that track, so why would there be a power difference between left and right?

 

Bob

  • Member since
    May 2004
  • 7,500 posts
Posted by 7j43k on Wednesday, April 12, 2017 11:38 AM

The word "automated" is used.  That may mean a fully hands-off running of trains indefinitely or it may mean having a certain operation take place with minimal attention.

If it's the latter, I suggest modifying the operation in this way:

An arrival track where you deliver a train.  When your delivery is complete, you "throw a switch" that activates the transfer sequence.  It disconnects the arrival track from the rest of the layout and takes over operation of the train.  The train is delivered to a departure track by the sequence, and left not moving.  You may then "throw a switch" re-connecting to the layout and leave at your leisure.

The idea being that the transfer mechanism doesn't care which locomotives you deliver.

So that would leave the problem of how to output from the transfer mechanism speed control for ALL locomotive numbers.  ALL would include the locomotives delivered by you.  IF this can be done, you will not have to deal with recognition.

 

 

Ed

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Wednesday, April 12, 2017 1:26 PM

Hi Ed. Thanks for your thoughts. That's an interesting hybrid approach that I shall give some consideration to. I must admit I was aiming for the "fire and forget" approach, but manually driving on and off the elevator may well be a much simpler option, and therefore much more likely to get built! On the other hand, what would life be without a few challenges?!

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Wednesday, April 12, 2017 3:26 PM

why not detect that the train has entered the elevator and when it reaches the far end, cut power to the elevator track.   Optical sensors can be used at each end.

(or cut power after the train clears the detector at the end it entered from).

after the elevator has moved, restore power.

greg - Philadelphia & Reading / Reading

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Thursday, April 13, 2017 4:54 AM

gregc - I think the main issue I'd have with that is having no control over the loco speed. Cutting power may bring it to a stop, but what if it was equipped with keep-alive capacitors? And on restoring power, it would probably take off rather suddenly, depending on the throttle setting, which is not good either. I think I'd rather spend a bit more effort and get a smoother transition in and out.

Something I didn't mention before is that the elevator also serves as a lift gate over a doorway. It will have three positions - Park, Level 1 and Level 2. I would not want a train on the elevator if i move it to Park (i.e. above the doorway) so the isolation sections either side play an important role in protecting trains and the open doorway.

But I appreciate all comments - it helps to focus on the important issues.

Bob

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Thursday, April 13, 2017 7:03 AM

the isoaltion sections sound like stopping blocks which drop power, preventing trains from running stop signals.   

how do you intend to account for any momentum in an automated system?

greg - Philadelphia & Reading / Reading

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Thursday, April 13, 2017 7:14 AM

Greg - my idea is that the approach sections will be long enough (3-4 feet, say) to allow for a controlled slow down. If I place the entry detector just within the approach, then when the loco has been identified the system will switch the approach track onto local control and issue low speed commands to the loco with the aim of bringing it to a crawl as it enters the elevator. Optical sensors on the elevator will then cause a STOP command to be issued when the loco is at the far end.

Trains will always leave in the same direction as they arrived, so when the elevator has got to its new level, the system will start the loco slowly, and increase its speed to that which it was being run at prior to arrival at the approach track. 

Well, that's the plan so far, anyway!

Bob

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Thursday, April 13, 2017 7:19 AM

One further point - with the elevator in the Park position (allowing access to the train room) or when the elevator is not aligned with the approach, the approach sections will be continuously fed with global STOP commands, to arrest any train that was foolish enough to enter. That ought to stop them making the deep plunge, though I also intend to have a physical barrier, too, when the elevator is not in line with the track.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Thursday, April 13, 2017 7:23 AM

sound like the isolation section will be driven by a separate command station that can issue different command than on the main track?

greg - Philadelphia & Reading / Reading

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Thursday, April 13, 2017 8:09 AM

That's the idea - the control unit for the elevator will put DCC commands on the approach tracks (and the elevator track itself) as required.

Bob

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Thursday, April 13, 2017 8:12 AM

There will also be a mode of operation, where the elevator can be locked in its lowest position to facilitate continuous running round the entire lower level if required. Under that mode, the approaches and the elevator will be connected to the main layout DCC bus so that the master command station controls the whole thing to achieve "run-through" operation.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Thursday, April 13, 2017 8:15 AM

a command station generates the DCC signal to be applied to the track.   This is applied to the track thru some power supply.   Multiple boosters may be used, all driven by the one command station and DCC signal

not sure it's possible to have two separate command stations generating different signals to adjacent tracks that can be bridged by metal wheels

i can see how a global stop can be used to command all trains to stop in an emergency.

if you want to command a particular engine to stop in a particular section of track, you need to identify the decoder number, as you've suggested.

greg - Philadelphia & Reading / Reading

  • Member since
    May 2004
  • 7,500 posts
Posted by 7j43k on Thursday, April 13, 2017 11:21 AM

FowlmereRR

One further point - with the elevator in the Park position (allowing access to the train room) or when the elevator is not aligned with the approach, the approach sections will be continuously fed with global STOP commands, to arrest any train that was foolish enough to enter. That ought to stop them making the deep plunge, though I also intend to have a physical barrier, too, when the elevator is not in line with the track.

 

 

Rather than global STOP, I think it might be safer to disconnect all power from the approach tracks when the elevator is not aligned.  That's even more "global".

Of course, neither precludes BACKING a long train over the precipice.  But there are an assortment of solutions for that.  Including the barrier.

 

Ed 

  • Member since
    May 2004
  • 7,500 posts
Posted by 7j43k on Thursday, April 13, 2017 11:27 AM

gregc

 

not sure it's possible to have two separate command stations generating different signals to adjacent tracks that can be bridged by metal wheels

 

I suspect it cannot.  Among other things, if you are feeding two separate command sources onto one system, I think you would run the risk of the command pulses occasionally overlapping.  Which might well cause a wee bit of trouble.

My earlier suggestion would solve this problem.

 

Ed

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Thursday, April 13, 2017 12:00 PM

 No, you do not want two command stations in a situation where the two could eb bridged together. If there is a train-length section on either side of the bridge, it could be that those sections be switched from one command station to the other ONLY after a train has fully crossed the gaps. However, I don't think the 2 command station approach is needed.

 Power off is not the solution any more - a loco with a keep alive will keep chugging right along at the last commanded speed until the capacitor is discharged. A global stop though - DOES stop a loco with keep alive.

                         --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Thursday, April 13, 2017 6:49 PM

rrinker
 No, you do not want two command stations in a situation where the two could eb bridged together. If there is a train-length section on either side of the bridge, it could be that those sections be switched from one command station to the other ONLY after a train has fully crossed the gaps.

i didn't think it was an issue of corrupting the DCC signal.   Isn't the problem that you have two power supplies powering the same wires and creating a short when they have opposite polarities.

sometimes you need to consider the fail-safes during developement, not just while in mature operation.   I think you need to consider physical barriers to deal with keep-alive and momentum when the elevator is absent.

i use a nail.   You may want a gate controlled by a servo.

curious what you design is for moving the elevator?   mine weighs 10 lbs

greg - Philadelphia & Reading / Reading

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, April 14, 2017 6:49 AM

 Yes, you can get shorts, if the signals aren't in phase. No different that a booster being out of phase and crossing the gaps although without a solid common reference the potentially double voltage can go right across the decoder.

 With counterweights your elevator can weigh about as much as whatever train is on it, not much power needed to move it up and down.

                                            --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Friday, April 14, 2017 7:14 AM

rrinker
Yes, you can get shorts, if the signals aren't in phase.

won't they be out of phase if they are sending different commands.

yes, that's the plan

greg - Philadelphia & Reading / Reading

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, April 14, 2017 8:07 AM

 It would be somewhat random. A booster out of phase is worst case - 180 degrees out so +15 on one side of the gap and -15 on the other. Two command statiosn sending out different commands, you will have continuous phase shift and even during idle times there's no guarantee they are 180 out, they could be anywhere from in sync to 180 out since there's no link between them.

 Diagonally across gaps with out of phase boosters, you have an accurate DCC signal, just at double the voltage. Same thing with 2 command stations, you have a junk signal that liktely is varying in amplitude as certain bit patterns line up and others don't.

                            --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Friday, April 14, 2017 9:07 AM

I have been giving this further thought - I can see the problem with having adjacent track segments being driven by different controllers if they can be bridged by a wheel.

So, the next iteration of the plan goes like this: 

In between the approach track and the rest of the layout, I have a separately switchable section that is just longer than the longest bit of rolling stock, so maybe a foot ish. Let's call it the isolation track.

Remember that my elevator controller will be able to individually switch any approach, isolator or elevator track to be either completely disconnected, or to be connected to either the main bus or the elevator controller.

As a train arrives, the approach track and the isolation track are both connected to the main DCC bus. With an appropriately placed opto detector, I can tell when the loco is now completely on the approach track. At this point, I fully isolate the isolator track, and switch the approach track to local control. 

That removes any bridging issues that may arise from rolling stock behind the loco. There will be a rule that says all traffic must run loco first - I am not going to be backing trains onto the elevator. If that were to happen, I can think of a number of ways to just shut the whole thing down as a safety feature.

So, assuming you agree that this solves any bridging problems and the potential for shorts, can anybody foresee any problems with the decoders in the locos suddenly receiving different track power and signalling? I would hope that any packets that happened to be interrupted by the switchover would just be ignored as corrupt data, and when the new data stream was detected, it would carry on OK.

Anybody got any contrary views on this?

Thanks for all input so far.

Bob

  • Member since
    March 2014
  • 121 posts
Posted by FowlmereRR on Friday, April 14, 2017 9:19 AM

Greg - in answer to your question about mechanics - I intend to use a leadscrew & stepper motor on either side of the doorway, most likely using something like Openbuilds C-Beam actuator. By driving both motors in step, the elevator is lifted and lowered evenly. Openbuilds quote accuracy and repeatablity figures for C-Beam that are plenty good enough to guarantee vertical alignment (better than 0.1mm) and the gantry plates can be adjusted to take out horizontal play. The fixed track sections will be part of the overall mechanism which will allow me to have minimal gaps between the fixed and moving parts, with suitable allowances for expansion, of course. I have calculated that to be less than 0.5mm over the intended width of the elevator (1.5m).

I am pretty confident that I can achieve track alignment at least as good as most people's swing or lift gates.

Actually, the programming of the microcontroller will be the fun bit of all this - I have been in software for far longer than I care to remember so it will be an interesting change from all the stuff that I have been doing lately to earn the rent!

Lots of sensors and a good deal of logic diagrams will be needed for this, I feel!

Bob

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Friday, April 14, 2017 11:58 AM

rrinker
 It would be somewhat random. A booster out of phase is worst case - 180 degrees out so +15 on one side of the gap and -15 on the other. Two command statiosn sending out different commands, you will have continuous phase shift and even during idle times there's no guarantee they are 180 out, they could be anywhere from in sync to 180 out since there's no link between them.

Randy

I don't see how there isn't a short when they are out of phase 1-180 degree.

in phase is like two batteries in parrallel

out of phase is like two batteries in series or connected plus to minus on both ends (a flashlight with a short across the lamp connection.

greg - Philadelphia & Reading / Reading

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, April 14, 2017 1:22 PM

 I didn't say it isn't a short, well it isn't until something low impedence bridges the gap. You can put a meter across it and measure 2x track voltage. 90 degrees out it would be something less, since the time of peak voltage difference would only be part of the cycle instead of a full cycle. Still a short when bridged.

 It's the second aprt I had wrong, diagonally opposite sides of the gap with IN PHASE boosters you have 2x the track voltage, if there is no common reference. That is akin to wiring 2 batteries + to -, and then across the free + of one battery and the free - of the other battery, you get 2x the voltage. But reference to the common terminal, from the free + to common you have + battery voltage, and from the free - to common you get - battery voltage, which is what you have on a plain piece of track powered by a single booster. 

 This is why Digitrax at least wants a heavy (track bus size) common between the command station and all boosters. Withotu it, there IS a common - in the Loconet cable. Which can be quite long - the voltage drop in a long length of #26 telephone wire is goign to be such that what SHOULD be 5 amps flowing is actually much less so nothing trips and a worse case short, a split pickup steam loco across the gap, ends up with 2x track voltage at something less than 5 amps. That's MORE power than a full 5 amp short at normal track voltage. Something will definitely melt. 

                        --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Friday, April 14, 2017 1:29 PM

FowlmereRR
Anybody got any contrary views on this?

when your system works correctly, won't you be able to control the specific locomotive approaching the elevator and there won't be a need for any isolation system nor 2nd command station.

if there's a problem, such as a loco crossing some minimum distance from the elevator, you can

  • issues a global stop
  • cut power to the entire layout after a short delay
  • have a gate physically stopping the loco

as i said before, the gate is a failsafe during mature operation and save some grief while debugging

greg - Philadelphia & Reading / Reading

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, April 14, 2017 1:49 PM

 I still say the easiest way to do this is to have the control system emulate a throttle and take over control, no multiple command stations or anything needed. Digitrax Transponding or Railcom could be used to ID the loco. The only issue with rfid tags is being in close proximity to the loco motor may cause issues with reading, but Railcom would work, with a receiver zone on either side that would feed the controller the decoder address that needs to be take over. Most system have their command protocol, or at least enough of it, published so you can figure out what commands need to be issues to the CS to take control of the decoder fromt eh throttle that drives it into position. And likely give control back to the same throttle it previously was on when it reaches the other deck. It all becomes mostly a software exercise dealing with whatever system you are using and its throttle bus protocol.

                                --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!