My problem, with so many train layouts and all of Zorba's whole catastrophe as well, is that I do not get a chance to run them often enough. The answer, I figure is automation. I teach a course on Mechatronics at UoW. I figure I am supposed to know all about this automation stuff, so if anyone is qualified for the job it's me.
While contemplating this idea, I found myself in need of a new bookcase for my new office. Since the "bookshelf" layout was such a popular idea in the land of MicroLayouts this seemed the right vehicle for the first design. I have always observed that bookcases leave a certain amount of unused shelf space because some books are inevitably less deep than the shelf upon which they rest. This space collects trinkets or dust. Why not use that space as fiddle yard, by pulling the books forward?
In searching for a name both AlexaNdria and BodeliaN popped up as appropriate, but neither sounds like the name of a respectable railway station, as my fledgeling design required. I had just read The Time Traveler's Wife, book and soon-to-be film, and Newberry sounded good as a library name, though I have spelt it as the English place of "Newbury" since that is more closely associated with trains as it lies on BR's Reading to Plymouth Line.
This is me in my new study with the bookcase containing Newbury.
The layout is equipped with sonar to detect someone moving in front of it.
When this happens, it starts operating one or two trains.
The trains are DCC locos, and the layout has a PIC12F684 embedded
microcontroller that generates all control instructions and sends
them out to the trains. Block detection is achieved using a
series of infrared sensors each containing a smaller PIC
controller. The sonar uses a final embedded controller.
The whole cycle of operation after a single activation is shown in this brief video:
This picture of the layout shelf under contruction in the workshop best shows the mechanical layout. Together with the trackplan below it explains the topology.
The scene is a station situated just before the route merges from
two to single line format. Two lines emerge from one tunnel,
pass between platforms, come together and disappear into a
This is the layout shelf installed in the bookcase. The wood is macrocarpa, finished in Danish oil. I made the bookcase from this wood as it is a "typical" New Zealand lumber and I wanted a piece of furniture made out of something local. I started with rough-hewn but seasoned timber. That was more hard work than I would recommend.
The track is Fleischmann N-scale pre-ballasted. I used this because the Fleischmann points (turnouts) are sprung so that a train arriving from the incorrect direction momentarily pushes the frogs aside and does not derail. This function is vital during the boot procedure, and makes operation easier as I then would not need motors on the points.
The layout automatically scans locomotive addresses during its
boot procedure, looking for block signals to discover if a
locomotive is present at any given address. It will automatically
find and store loco addresses, but does not know which way a loco
is running until it hits a second block.
This is a rear image of the layout during debugging.
Here you can see the finished electronics.
From the top is a commercial SMPS to provide 15V DC,
the main controller board with DCC drive and a PIC16F684,
below that is the sonar board, and slightly to the left
one of the Infra-Red (IR) block detectors.
Here is the view from below the shelf, showing the ultrasonic transducers for the observer-detecting sonar:
Here is the "observer's-eye view" of the layout in the bookcase:
At right you see a picture of "Merinda looking at Newbury and Newbury looking at Merinda". Below she points to one of the sonar transducers that sense when you are there looking.
Some of the tedious technical details:
All the buildings, stations sections, and the footbridge come from the outrageously-cute Hornby "Lyddle End" range, purchased from Hattons of Liverpool, UK. The trees are either made with Woodland Scenics supplies or purchased from a well-known e-bay tree vendor. The signal is home-constructed with LEDs. The figures are home painted from the Preiser range. The rolling stock visible are railcars from Fleischmann (an 87400) and Minitrix (Trix 12313), both DCC-enabled from Reynaulds. All the intelligent modules are based on Microchip's PIC line of embedded microcontrollers, programmed in Hitech PIC C.
Close-up of the station showing the Minitrix 12313.
View of the merge and small tunnel at the end of the station.
To initialise, place 1 or 2 trains on top of the station sensors, with forward directions of the two locomotives aligned in opposing directions, apply power (boot) and trigger. Booting with any station sensor tripped causes initialisation. Signal flash sequence identifies number of station blocks seen as occupied. Unit searches addresses 1--16, if the address causes a train to leave a station, it is registered.
Powerup without a train on a block in a station causes recall of last stopped state when triggered. This allows power to be turned off, provided no trains are running at the time, and power reapplied provided the trains have not changed position. Location and addresses of trains will be remembered.
When either the controller button is pressed or the sonar detects a person closer than 500mm to the station, trains are alternatiely moved one block along. When they arrive at a station they wait for a preset period. That period is 12 seconds by default, and is set by pressing button for >5 secs and adjusting the preset knob. The preset knob (pot) otherwise adjusts default cruise speed of train that is moving when the pot is adjusted.
Errors or status are signalled by flashing of the station signal green light
BADNTRAINS 0x00FF // continuous slow flashing; triggered past COLDBOOT with a number of trains that cannot be handled (not 1 or 2 in this layout)
STARTLOSTTRAIN 0x5555 // continuous fast flashing; a train address was found but it never reached a fiddle yard (stuck?)
COASTLOSTTRAIN 0x5551 // fast flashing, missing 1 flash in the cycle; a train was slowing in the station but never cleared the block detector (stuck?)
ROLLLOSTTRAIN 0x5550 // fast flashing, missing 2 flashes in the cycle; a train was proceeding to a terminus but never reached the block detector (stuck?)
BADSTART 0x5500 // four flashes, pause; failed to locate a train or failed to find its address during boot up.
NEVERHAPPEN 0xFFF5 // long flash, two dark blinks; coding error, this should never happen.
COLDBOOT 0x0F0F // continuous medium-speed flashing; boot with no locos in station (awaiting trigger)
ONETRAIN 0x0001 // single-blip flashing; COLDBOOT and a loco is in the station (awaiting trigger)
TWOTRAIN 0x0005 // double-blip flashing; COLDBOOT and two locos are in the station (awaiting trigger)
LOSTRAIN errors with a missing flash can be cancelled and the computer will retry the operation, started by a button push lasting >10 seconds. Requires that trains be where they were, just unstuck. Use hazardous, in case computer becomes confused as to train location.
Having gone through the process of learning how DCC worked from scratch, then building hardware that could control trains, take in block occupancy signals, and schedule individual locomotive activity, I have discovered a few wrinkles in the DCC paradigm.