Control Systems on Rowandale

A Raspberry-Pi 3B is used to control the routes for the layout. It is mounted inside the control panel. This is an amazing little computer, designed and built in the UK, which uses an ARM 4 core processor and costing just £30. It has numerous interfaces, especially the I2C data bus through which a very large number of remote digital I/O can be controlled. The view of the inside of the control panel, at right, shows the R-Pi near the centre. It is partly masked by a prototyping board fitted with a 5v-3.3v level shifter,  a booster for the remote I2C interfaces out on the layout and various connectors. At the top left is the display panel with keypad connector. The push-buttons are wired as an X-Y matrix driven directly from I/O on the Raspberry Pi. To the right of the R-Pi is a 16 channel I2C interface which drives the LEDs on the control panel. Several small I2C digital boards (costing just a few pounds) connect 8 digital I/O to the I2C data bus out on the layout. All the remote I2C interfaces are wired in daisy chain fashion with just four wires, clock, data & two for DC power.
The only direct connection between the control panel and the layout points servos and track sensors, is a single 6 way cable, two for power in to the Control panel and four for the I2C data bus ( 5v, 0v, data & clock ), thus saving an enormous amount of wiring. If other sensors or relays, etc. are required on the layout then all that is required is to add another cheap I2C interface board and connect its four wires to the daisy chain of the other interfaces. There is no need for a monitor, keypad or mouse once the Raspberry-Pi has been programmed. Even if program changes are required to the Rapberry-Pi Route Setting control software, a keyboard & monitor are still not needed, as full control of the Raspberry-Pi can be done via a desktop computer running a Virtual Network Server on your domestic Wi-Fi network. Free versions of VNC are available.
The Pololu Servo Controller still implements the actual route settings, getting a digital track number from the Raspberry-Pi, via the I2C data bus. The sensors for the loco indicators on the control panel are tiny opto-reflective devices fitted between sleepers in the track; reflective tape on the underside of the locos is seen by the sensors. As well as relaying the status of the loco sensors to the control panel LEDs the R-Pi controller is programmed so that it can, if required by the operator, automatically hold a train in the hidden sidings, and later release it, by switching the points.
Control of the speed of the locos is using the  free open-source software JMRI DeCoder-Pro. The interface to the track is via a USB connection to a SPROG 3, which in turn generates the DCC signals for the track. Decoder-Pro is available for both Desktop PCs, or laptops, and also for Linux - which of course will run on a Raspberry-Pi. This software allows the DCC parameters for the loco decoders to be adjusted very easily, with full in-line help for the various settings.  Initially I ran the Decoder_Pro software on a Windows laptop but now use a second Raspberry-Pi 3B. I did try using the R-Pi in the control panel to run both my Route Setting software and DeCoder-Pro, but there was sometimes a slight delay in response to commands, as my Route Setting software does quite a lot apart from setting the routes.
If you already have a laptop, or desktop PC, on which to run the DeCoder-Pro software then you only need to buy the SPROG 3. This costs  £60, with 3 Amp drive capacity,  plus £20 if you don’t have a suitable 12V dc power supply.  This is much cheaper than buying a standard DCC control system, and gives you easier control of the CVs settings. I decided to use a Raspberry-Pi 3B instead, as I found it more convenient, and at £35 still much cheaper than a dedicated DCC system. The DeCoder-Pro software does have throttles you can use on the R-Pi; however this would require a monitor, keyboard & mouse to be used with the R-Pi, or Wi-Fi connection to a desktop or laptop computer. I use a Wi-Fi connection to an Android mobile phone and a tablet. The free software  Engine Driver can be downloaded to phones and tablets for extremely convenient wireless throttle control of the locos.
Control of the Turntable
The Raspberry Pi Organisation also produce a minimal version, the Raspberry Pi-Zero; see photo at right. On Rowandale, one is used to drive a stepper motor to operate the turntable. Programmed with the sequences for energising the stepper motor coils ( via a driver interface ), a single push on the control panel button, causes the stepper motor to turn  the table exactly one half revolution; with acceleration & deceleration.
The Control & Mimic Panel
The control & mimic panel is shown below. It is a shallow wooden box with a rigid plastic front. The overlay is printed onto gloss photo paper; A3 size. Route selection push buttons are mounted on the mimic, together with tiny LEDs which indicated the position of locos in the hidden holding bays. To set a route, pressing just the one push-button which lies on the desired route, will set all the points that are required to establish that complete route.
There is also a four line by 20 character display screen which indicates the previous routes that have been set. The associated keypad, can be used to perform a number of functions, such as setting the default routes, initiating train lap timing functions, and train holding features. It is also used to perform various system tests, such as checking all the LEDs on the control panel.
DCC Control of the Locos
The Route Setting software  is described and listed here:  The page also lists the Pololu Servo Control software  and the Turntable software.
Track Loco-Sensors
The sensors for the loco indicators on the control panel are small surface-mount opto-reflective ICs, which fit between adjacent sleepers in the track. They are the same depth as the sleepers and just need a small shaving taken off the edges of the sleepers so that they are snug fit. A very fine tip on the soldering iron, and a steady hand, is needed to solder the fine wires to the small pads on the underside of the sensors. The four wires are terminated in a small 4 pin header, which plugs into a circuit board which limits the current though the sensor and uses a transistor to boost the switching capability of the sensor. The output can then be used to either directly light an LED on a control panel or, as in Rowandale, connect to an input on an I2C interface for onward transmission to the control panel via the I2C data bus.
The sensors are fitted on each hidden track as a pair, separated by 50mm, just before the associated exit points. The first sets a yellow LED on the control panel, and the second a red LED. A section of self adhesive reflective tape is fitted on the underside of the locos, as far forward as possible. The operating principal is that a loco is stopped when the yellow LED is lit; if the red LED is lit then the loco is too close to the points and could be hit be a train exiting the adjacent merging track.
The opto-reflective sensor used is the Kingbright KRC011. Available from RS Components and other electronic suppliers, costing about 32p. Note that the sensors will respond to bright sunlight and to very bright overhead lights; not a problem with hidden covered tracks, or normal room light levels, but it is best to perform tests with your layout. Adjusting the values of R1 & RS may be necessary.
Click here for PDF files of: The KRC011 Data Sheet  and for: Circuit Diagrams and Vero Board Layouts
Home Home
Layouts Layouts
Archie's Yard Archie's Yard
Rowandale Rowandale
History History
Locomotives Locomotives
Control Control
RPM Meter RPM Meter
Rolling Stock Rolling Stock
Weathering Weathering
Buildings Buildings
Archie's Yard Archie's Yard
Rowandale Rowandale
Software Software