Thursday, May 27, 2010

Why IR Optical Sensors / Detectors?

Good question.  This is probably the most untried and untested part of the layout that I'm proposing to build. The conventional wisdom is that block detection (using current) is the preferred method.  Most websites I've gone to prefer it to IR or optical detection.  They may be right.

However, I have a bias toward the IR or Optical Detection.  Let me try and explain so I can better understand it myself. 

With Block Detection, you isolate a section of track and you can then, by using lots of off the shelf detection circuitry, detect things like locomotives, cars with lights, and cars with wheel resistors on them.  The detectors, as I understand them, sense the extra current that flows to power these things, and thus is able to tell when something like that has rolled onto that section of track. 

There are lots of different off the shelf components that do just that.  Both Digitrax and RR-Cirkits makes boards that will sense the current spike that happens.

For optical sensors, or IR detectors, off the shelf components are hard to find.  Most of the stuff I found on the Internet was a "roll your own" type of solution, often involving the soldering of components together to make your own detectors.  And optical sensors have many options - some are simple light sensitive resistors.  Others are IR (infrared).  The regular optical sensors can be fooled by bright sunlight, and don't function in the dark.  IR detectors are a step up from this.  They can operate in the dark, but the complaint online here is that they are often very hard to align. 

In my application, it is very important that I sense exactly when a train reaches a certain point, not just that it has reached a section of track. For instance, in my layout, the commuter train will have a locomotive at one end, and simple rolling stock on the other.  So using block detection, I'd have to make sure that either the last car had a light or similar resistor on it, or I'd have to position the block differently on both ends, and sense when the engine came into the detection block.  (on the West station, the engine will come into the station FIRST, in the East station, the engine will come into the station LAST).  It gets even more complicated with the Acela, because on that train, the "engine" is actually one of the cars, and the "engines" on each end are dummy cars.

IR detection avoids all these issues.  And there is a vendor that makes EXACTLY what I'm looking for.  Boulder Creek Engineering makes a product called the NightScope IR detector that comes as a single unit - both the IR illuminator and the sensor for it.  They are already aligned perfectly for this.  You just drill some holes and mount this under your tracks.  And I'd like to send a shout out to Jim, who quickly answered my questions about how this device would integrate with the Digitrax DS64.  He confirmed that it will work and then sent me a diagram on how to wire it up properly.  While I haven't tested their products yet, I fully intend to, and if they work as advertised, I'll be incorporating them into my layout.

I'm happy to hear from any folks who think I'm crazy for taking this approach.  I'm a noob, so I may be all wet.  Failing feedback, I'll see if I can blaze a trail for IR detection instead of block detection.

The Grand Layout

The picture above is a bitmap of the layout I've created in XTrackCAD.  Here is the link to the file if you have XTrackCAD installed on your computer.  I'll be blogging about this tool in another post, but for now, this is here to show the layout for my Grand Vision.

You'll notice that there are 3 sets of tracks (that is if you click on the image and get a larger copy of it).  The end points are each a station.  There are 3 other stations in between.  The center station will be between the middle set of switches.  The other two are in between the center station and the end points.

The tracks are labeled Track 1, Track 2, and Track 3 from top to bottom.  The extreme left of the diagram is "west" and the extreme right of the diagram is "east".  Tracks 1 and 3 are the "local" tracks... the ones that have station platforms next to them.  Track 2 is the "express" tracks, and these are the tracks that the express train will mostly run on.

The express train (Bachmann Amtrak Acela) will service the terminals on each end, and the center station.  It will skip the lesser stations between the center and terminal stations.  The local train will stop at every station.

The other components of the diagram are the pink dots and the green boxes.  The pink dots represent IR sensors.  The green boxes represent stationary decoders (Digitrax DS64).  The diagram needs to be updated, as I believe I can do with only 3 of these rather than 4, but that is for another post.

A typical starting position will be as follows... the local will be on Track 1 in the east terminal.  The express will be on Track 2 in the east terminal.  The trains will depart heading west (not sure which one goes first, this will be a variable that I will control programmatically).  The local will travel to the first station and stop.  The computer will sense the IR detector at that station and command the local to slow down and stop.  After some period of time, it will continue on moving west.

Meanwhile, the express will move west and stay on Track 2 bypassing the first station.  As the trains approach the center station, they will trigger the IR detectors in front of the turnouts.  If the local gets there first, the turnouts will be set to closed and it will be cleared into the center station.  If the express then triggers the detector on Track 2, then it will be commanded to stop and wait for the local.

If the express gets there first, the local will be commanded to stop after tripping the detector on Track 1.  Either way, the first train then moves onto Track 1 at the center station, and after a time, moves on.  The computer will know which train it allowed onto that track, so it will set the turnouts appropriately, to either allow the local to continue on Track 1, or move the express back to Track 2.

There is no contention at the next station and so the action begins as the trains begin to approach the west terminal.  In this case, I want to move the local from Track 1 to Track 3, crossing Track 2.  Right now, that is set up two pairs of turnouts, one to move it from Track 1 to Track 2, and then another to move it from Track 2 to Track 3.  This is to position the local onto Track 3 for it's eastward leg after stopping at the west terminal.

I could probably use a crossing and get away with 2 of the 4 turnouts.  I may consider doing this, as it would save some money, but it will lower the flexibility of the layout as there would be no way to get a train on Track 1 or 3 to Track 2, except at the center station.  I'll noodle that.

Anyway, I need sensors to make sure that the trains do not collide and right now that is drawn as detectors that operate similarly to the above - who ever gets there first has right of way.  Once the trains move into the west station, there are 2 more IR detectors to sense the end of the tracks and stop the train in the station.

The eastward operation functions as a mirror to the westward run.  I leave it as an exercise to the reader to see how that run would work, given how long this post is already.

Any comments on what I'm doing here in terms of detection and control are certainly welcome.  Expect future posts on the questions of IR detectors vs. Block detection (and why I'm planning on going the IR route) and for the relative merits of turnout position sensing and whether or not I really need that.  One thing is for sure, it gets complicated really fast, even on a fairly straightforward and simple layout like this!

How I Got Here

Okay, so I just finished the first post, and I know it's not Cricket to just blog again right away, but I've got some catching up to do.

How did I get here?  Well, when I was a kid, I played with model trains.  Back then it was an HO set.  I had a pretty big layout - 4x8 - in my basement.  I would integrate the train with my slot car set (Aurora) as well as Girder & Panel sets that I had as kid.  I would try and make them go up hill and downhill, and almost always used a grade that was too steep.  Over time, I'd burn out transformers, and wang up new ones with parts from all the kits I had (one was an old Aurora car controller that looked like a tiny dashboard, hooked up in series with a newer car set transformer).  Eventually, newer things (notably girls) distracted me, and I gave up modeling for about 30 years.

Since then, I've held elected office locally and am in my 9th and final year.  I wanted a "hobby" that could occupy some time (now that I'll have some!), challenge me on several levels, and would keep me closer to home.  I wanted something my girls might get interested in themselves, and one that would allow me to leverage skills I already had (programmer by trade, woodworker hobbyist, etc.)

The NMRA convention was held in the city I work in last year (Hartford, CT) and I took an "extended" lunch to check it out.  I was amazed to see the improvements that had taken place over the last 30 years, most notably DCC.  The ability to control multiple trains on the same tracks, and to have computer command was intriguing... This was a hobby I understand.

I told my wife that I was interested in getting started in this hobby, and put some things on my Christmas list last year.  One was a Bachmann Acela set... that was too rich for everyone's blood.  But the Zephyr command/booster/throttle from Digitrax seemed to fit the bill for the type of layout I was creating.  My wife also got me a gift certificate at a local train store, and have now used that to purchase a couple of turnouts and some flex track.  I also spent too much on a DCC locomotive... but I just had to do it.  I had the Zephyr, and the track laying around.  All I needed was something to run on it!  Last weekend I bought an Atlas GP-35 engine with the DCC already installed.  Paid list price but I don't care!  I got to move the train around.  It was my first test, and now I know I have a good throttle, and I've already learned some good lessons... including the fact that my younger daughter enjoys moving the train back and forth on the flex track.

Anyway, I have a long way to go, and I'll put some more posts on the research I've done to date, and my plans, including the parts that I've purchased or plan to purchase.  I'm also planning on giving my 2¢ on the various tools that I use for this project.  JMRI will be one, and XTrackCad is another.

Anyway, it was a long road here, and along road ahead, but the journey is already well started.

Cheers!

First Post - My Vision

Hello... So I'm starting this blog to serve as a journal of my progress in creating a fully automated, computer controlled, N scale commuter rail layout.  Wow... that's a mouthful!  Anyway, I figured I'd describe my vision first, and my next post will be about how I got here.  After that I'll start posting my design details and eventually my project plans. 

So here is the vision... I have a small amount of space for a train layout.  I share my house with a wife, two daughters, and a brother-in-law.  Needless to say, there isn't much "me" space left in the house.  (And what I started with has slowly eroded away over the years)  So I need a layout that can be mostly "out of the way".  I have (or had) a Rec Room in the basement.  It has a pool table and bar, an exercise machine, poker table, along with a couch and an old recliner.  There just isn't much to work with.

But I came to realize that I didn't need a big 4x8 foot layout to have fun.  In fact, a friend suggested a "switching" layout... Out and Back.  So I decided that I DID have room for a layout that would sit along the window sill.  This gives me a whopping 24 feet of length!  The downside?  16 inches in width...

Anyway, that is what I'm working with.  Ultimately what I wanted was a set of tracks (3 right now but more on that later) and 5 "stations" including the ends.  I plan on having sensors and switches to allow 2 trains to share these tracks.  That is where the computer comes in handy.  It will be able to leverage DCC to sense those inputs, and throw switches, and provide the "smarts" to make sure that the $500 or more in locomotives and rolling stock that this layout will have don't pull a Gomez Adams and crash into each other.  He had money to burn... but I don't!

At the end of the day, I should be able to set the turnouts into known starting positions, and move the trains via the throttle to known starting positions, and then just push a button called "Run" on the computer that will make the trains move through their programmed routes.  They will sense when they are going to get into each others way, and will resolve such situations. 

I can then sit back and watch it run.  I can play with schedules, and speeds to watch these conditions happen more or less frequently.  I may even put a third train on the tracks and see if I can keep it out of these fellows way. 

Oh yeah... and the whole thing is going to have a Simpsons theme!

More to come...