A Guide to the Layout Control Operating System

The Layout Control Operating System (LCOS) is a microcontroller operating system for running model railroad layouts. LCOS takes advantage of ubiquitous, cheap microcontrollers (computers on a chip) to create highly standardized Layout Control Nodes (LCNs) linked together wirelessly in a Layout Control Mesh Network. A basic LCN consists of a microcontroller mounted on the LCN IO board, with LCOS preloaded and a low power radio for communications. LCOS is currently available for Atmel 328P microcontrollers.

LCOS is distributed as firmware loaded onto a compatible microprocessor device, and is ready run as soon as you power the device up up. Use the LCOS Configuration App (the Configurator) on a Windows PC connected to your MASTER node to find and configure other devices. The Configurator enables point and click configuration of your nodes, making LCOS a plug-and-play layout control solution. The Configurator also manages firmware updates.

Object Oriented OS

LCOS objects are abstractions of physical objects on your layout. The essential elements of your layout — turnouts, signals, track blocks, lighting, scenic elements, etc. — are represented by intelligent software objects.

Objects contain all the embedded intelligence they need to do their job. Each layout object functions independently, applying internal rules while communicating with other objects. For example, a configured turnout object knows:

  • how to run its motor — whether servo, stall motor or coil motor;
  • how and when to run a frog relay or reversing relay;
  • how to receive and respond to alignment requests
  • how to sense and change alignment;
  • how and when to announce state changes;
  • how to trigger other objects to act based on alignment.
  • how and when to participate in a route.

all without needing runtime instructions from a central source. The configuration process allows you to tell each node what objects you want it to control, which ports you used for which objects, and select functional options for each objects.

Although the Layout Control Mesh Network requires a MASTER node to direct communications, layout object functionality is decentralized. Decisions are made independently within each node. Those decisions may call for information (such as an object state) from an external node, but the decision process is localized and occurs whether or not external information is actually available. This facilitates true node functional independence, unleashing the inherent power of a multi-processor system.

The object oriented, decentralized design of LCOS changes how you think about virtually everything on your layout. In LCOS, each layout object is an independent thing with certain properties and behaviors. Once properties and behavior options are selected, the object seamlessly integrates itself into layout function. From a bunch of independent objects, complex group behaviors automatically emerge breathing life into your model railroad layout.

What Can an LCN Do?

A Client LCN can run block detection on up to 8 blocks, run up to 16 signal heads and up to 8 turnouts , manage buttons and switches, control relays, run other lighting and exchange data with other LCNs.

Any LCN can host a control panel, making it easy to set up local control panels around the layout. Since all communication occurs over the wireless mesh network, your control panels need only power and no other hard wire connections to the layout.

The MASTER NODE is optimized for creating a master control panel spanning the entire layout.

Layout Control Mesh Network

Mesh networking is a variation on ad-hoc local networking that lends itself to both symmetrical and asymmetrical network topologies. The Layout Control Mesh Network (LCMN) is a routed mesh network built from a set of Arduino libraries for nRF24L01+ radios. Routed mesh networks are efficient but fault tolerance is more limited because they can’t resort to flooding when an intermediate node is down. However, in the context of a model railroad layout, if a node is offline for modeling or repair reasons, the most important thing is that everything else continues to function until the node comes back. Adding or removing nodes is easy with the help of the Configurator.

Topology is generally hub-and-spoke, using a MASTER node as the top hub uniting all the branches beneath it. The MASTER can have up to 5 children, as can each child. The depth of the topology can be up to 5 levels (including the MASTER), which results in up to 781 addressable nodes on one radio channel. Really large networks can be achieved by running multiple parallel networks on different channels.

LCMN Structure and Addressing

The address of an LCN is a number in OCTAL format that describes the route from the MASTER to reach the node.

The MASTER Node is always 00.

The Master Node can have up to 5 children. The address of each child node is 1 through 5 with a leading 0 — 01, 02, 03 , 04 and 05. These are generally referred to as Level 1 addresses.

Each node can have 5 children of its own, whose addresses are Level 2. The address of each child is 01 through 05 preceding the address of its parent. So, the children of node 01 are 011, 021, 031, 041 and 051 respectively. The entire tree can have up to 4 levels below the Master. This can be illustrated as follows:

rRF24L01 Mesh Network Topology and Addressing

The last possible valid network address is 05555. LCOS uses addresses outside of the 00 – 05555 range to represent connections to objects outside the radio network.

Scaling

The greatest advantage of LCOS object-oriented design is automatic scaling up to the 781 node (per channel) limit. Scaling is the ability to grow your layout network while maintaining the same level of performance.

Because each node is logically and functionally independent, adding a node does not impose a burden on other nodes. Instead, each new node significantly increases the amount of simultaneous activity the system can support.

The MASTER is tasked with managing communications between the five spokes it manages and can get quite busy in a large network. To facilitate scaling, the MASTER is designed to prioritize communication over all other activities, and it is not allowed to run cycle-consuming hardware drivers.

Getting Started

First, See the Layout Planning Guide for detailed guidance on planning your LCOS installation.

Second, using the methods and considerations explained in the Layout Planning Guide, develop a plan for distributing nodes around your layout.

Third, buy the LC1 LCOS Layout Starter Kit, containing a MASTER NODE and one CLIENT NODE. You can buy more Clients if you need them, or later when you are ready to deploy them. If you are planning a big layout, get the LC2 Layout Foundation Kit instead.

Fourth: The Configurator App is automatically included in your Starter Kit purchase. Follow the downloading instructions and unzip the app in a convenient place. See the The LCOS Manual for step-by-step, detailed information on configuring and running LCOS.