Mark DiVecchio's O-Gauge Train Layouts

1992 Layout Page

2006 Layout Page

2009 Layout Page

P&LE Postcards by Howard Fogg 

Plasticville Buildings

Portable Layout Page

Train Clubs

Bing Track

Remote Train Control Program

YouTube Channel

OOK Radio Support

Technical Videos

3D Prints for my Layout

More RTC Videos

ADPCM - Playing clips from .mth sound files

P&LE McKees Rocks Locomotive Shop
3D Printer Project

White Tower Restaurant
3D Printer Project

RFID Train Detection

Engine and Car Operation
Hints and Tricks

RFID Tag Programmer using PN532

RTC Control Language - Scripting

RTC WiFi Support
Getting rid of (most of) the wires

More RFID Tag Videos

RTC Control Language - Signaling

ESP8266 Sketches : RTCAdapter
RTCRemote
RTCWTIU
RTCSignal



Signals

This Page last updated on .

I started developement of this web page in April 2026. It will be under construction for a while.

Introduction

For some time now, the RTC program has supported virtual signals on the Layout Window. In a lua script, you could programmatically create 1, 2 and 3 light signals. You could overlay them onto a bitmap image of your layout and you could set their aspects (eg: clear, approach, stop and proceed, etc).

Now you can build real physical signals, place them on your layout and have them respond to your scripts just as the virtual signals responded. This feature is available in RTC V5.0.4 and later.

Two developments made this possible:
    1. 3D printed signals that let you create signals very inexpensively and
    2. the ESP8266 SOC module with WiFi that let you control those signals

You can read about both of these on this web page.

For a quick overview ot the signaling system, you can watch the two videos in this playlist on Youtube: YouTube playlist:

This description is in three sections:
    Section 1 : The 3 head signals are described on this web page.
    Section 2 : The ESP8266 program which controls the signals is described on a separate web page. Click Here.
    Section 3 : The RTC program written in lua which sends the commands to the ESP8266 to control the signals is described on this web page.

Section 1 : Mike's 3D printed signals - The 3 Head Signals

Mike Hewett developed the 3D printed signals for his layout. Here are his notes and photos that he sent me. Mike created the 3D print files using Fusion 360. Click here for the STL files from Mike.

Mark,

I have files for a 3 light signal and pole and a different set for the 2 light pole. The three light pole and the 3 light signal head are shaped differently to accommodate 6 wires. When printed, the light pole requires no support. The signal head is printed on its side and requires support when it touches the build plate.

The 2 light pole is different because it only needs to pass 4 wires through it. The light pole is printed vertically with no support. The 2 light signal is printed on its side with support touching build plate only.

Mike

After printing, first slide wires and LED’s like this.


Once all are threaded through, position them carefully like this.

 Then carefully push the lower split clip of the signal head on enough to put LED’s in position keeping the top clip just above the pole top.

Once LED’s are in place, gently push the top clip over the pull and push down until flush with top. Push lower clip towards the pole until the clip is flush with back of pull. Do not push beyond that position Now gently push LED’s back toward signal head  until protruding evenly. Same method for 2 light signal head and pole

Final step push cap onto top of pole and glue if desired. My LED’s are pre-wired with a resistor and operable from 5v to 10v. After assembly, I buy a 58 cent bottle of flat acrylic art paint and pour some in the back of the signal head to blackout the LED from showing through the back.


Mike sent me a photo of two signals on his under construction layout. He connected them to the switch machine controlling switch tracks. The signal indicates the position of the switch.




RTC support


If you look on the web page:  RTC Control Language - Signaling you can see the commands available in the Program Control Window to set the operation of the signals.

As a simple example, the follow test script will blink every LED on every signal on the layout:

Here is the script CheckSignals Test.lua.


--[[
---------------------------------------------------------------------------
Remote Train Control Program for Windows

© Copyright 2026 by Mark DiVecchio

This file is part of Remote Train Control.

Remote Train Control is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Remote Train Control is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Remote Train Control. If not, see <http://www.gnu.org/licenses/>.

Home Page : http://www.silogic.com/trains/RTC_Running.html
---------------------------------------------------------------------------]]
-- Semicolons are not required in Lua code
title = "Check Signals Test"
require([[defines]]);
require([[functions]]);
--
-- flashes green/yellow/red on all available signals
--
local Layout = nil;

--[[---------------------------------------------------------------------------------------]]
function setup(Engine, TIU)
print("setup() Running");

-- Instrumented Layout 4
Layout = require([[Layout4]]); -- All of the details about the Layout

ShowLayout(); -- SetAspect() requires that a layout window be open

local NumSignals;
NumSignals = GetSignals();
print("Number of Signals = " .. NumSignals);

-- check that all signals were found
local SignalMissing = false;
for orig_key, orig_value in pairs(SignalNames) do
if (type(orig_key) == "number") then
local res = CheckSignal(orig_key);
print("Signal #" .. orig_key .. " - " .. orig_value .. " = " .. tostring(res));
if (res == false) then
SignalMissing = true;
end;
end;
end;

if (SignalMissing) then
return Stop("Did not find all signals");
else
print("All Signals found");
end;

return true; -- false=setup failed, true=setup succeeded
end
--[[---------------------------------------------------------------------------------------]]
function loop(Engine, TIU)
-- Always call Sleep(X) at least once in this function if it returns true;
print("loop() Running");

for orig_key, orig_value in pairs(SignalNames) do
if (type(orig_key) == "number") then
print("Signal #" .. orig_key .. " to red - " .. orig_value);
SetAspect(orig_key, AsStopSignal);
Sleep(1);
end
end

for orig_key, orig_value in pairs(SignalNames) do
if (type(orig_key) == "number") then
print("Signal #" .. orig_key .. " to yellow - " .. orig_value);
SetAspect(orig_key, AsApproach);
Sleep(1);
end
end

for orig_key, orig_value in pairs(SignalNames) do
if (type(orig_key) == "number") then
print("Signal #" .. orig_key .. " to green - " .. orig_value);
SetAspect(orig_key, AsClear);
Sleep(1);
end
end

Sleep(10);
return true;
end
--[[---------------------------------------------------------------------------------------]]
function cleanup(Engine, TIU)
-- this function is called once when the user presses the [STOP] button or the Stop() function is called
print("cleanup() Running");
return true; -- false=cleanup failed, true=cleanup succeeded
end
--[[---------------------------------------------------------------------------------------]]




RTC technical

The signals are controled by a lua script running in one of the Program Control windows in RTC. The algorithm was developed by Bruce Chubb (he wrote it in BASIC) which I rewrote in lua. The algorithm was based on the real-world relay logic contained in trackside buildings along the right-of-way.

One of the differences between the real-world and my layout is how train detection works. My layout is broken into blocks. There are signals, then, at the entrance and exit of every block. The algorithm needs to know which blocks are occupied so that it can set the correct signal aspects. In the real-world, the metal wheels of a railroad car short the two rails together electrically. Trackside relays detect this. On my layout, I don't have two rails to short together. Remember my layout is tinplate 3-rail. The outer two rails are always shorted together.

RTC detects trains only when they pass over one of my RFID train detectors. Each detector sends a signal to the RTC program whenever a car passes over the detector. RTC uses the engine and the caboose detection to determine block occupancy. Whenever an engine passes a detector, the next block is signaled as occupied. Whenever a caboose passes a detector, the last block is signaled as unoccupied.

When you use the RFID detectors, you must setup initial occupancy conditions. That is because if a train is sitting in a block, RTC does not know it even exists until it passes over a detector.

You can read about my RFID train detection here:  RFID Train Detection  .

My layout requires 30 signals controlled by 15 ESP8266. When finally installed, the ESP8266 are going to be well hidden and generally inaccessable. I'm a pretty good programmer but I'm not a great programmer so there are going to be changes to the RTCSignal progam. The developers of the ESP8266 already had a solution - its called Over The Air (OTA) updates. This lets you update the code over the WiFi network so you never need to touch the buried ESP8266.

Photos and description

Some images from the 3D printing of the signals


I printed 30 of these

Since many of my signal locations are on upper levels, there is no solid support for the pole base. I made up a base which will support two signal poles. You can see these in use in the next few photos.

Here are the parts that I ordered to assemble the signals:

ESP8266 SOC (System on Chip)

Note: As I mention in several other spots on this web site, do not buy the ESP8266 that use the CH340 USB chip. Stick with the the CP2102 which function much better with Windows 10 and 11 drivers. I bought these HiLetgo devices:

https://www.amazon.com/HiLetgo-Interface-Internet-Wireless-Development

Breakout Board

https://www.amazon.com/AEDIKO-ESP8266-Breakout-Development-Compatible


3-6 VDC Red LED 5mm
3-6 VDC Green LED 5mm
3-6 VDC Yellow LED 5mm

Many sources on Amazon and eBay. Here is an example of a red LED. I bought them in packages of 50 since I needed 30 signals. All three, red, green and yellow, look the same - wires are red and black and the body of the LED is clear.

https://www.amazon.com/PATIKIL-Lights-Light-Emitting-Indicator-Lighting






Here is an assembled signal. Powered by 3.3 VDC generated from the 15 VAC on my switch track buss.

Here are signals #9 and #10. Number 10 is an absolute signal as indicated by the 'A'.
Next to the signals are the ESP8266 and the power supply (AC to 3.3VDC). In this test setup, the power supply uses the 19VAC on the track.

Here are signals #13 and #14. These are on the upper level so I really need the base support.


Here is a video on my workbench of RTC lighting each signal LED in sequence:


Image loading....

First Test Program


Installing the Signals Permanently on the Layout

Once I completed the testing of the system on the bench, I moved the electronics under the train table. 


All of the electronics are now under the train table. For signals on the high line, there are still a few wires visible above the table. I'll be hiding those.

Signals on the lower level of the layout have their wires going directly down through the table top.

The signals are distributed in all corners of the layout so I wanted to distribute the ESP8266 as close to the signal as possible. I built up 5 breadboards which I mounted under the table. Each breadboard could hold up to 5 ESP8266 and 2 buck converters. I was able to keep the wires to the signals themselves fairly short.
There are no communications wires, of course, since WiFi is used.
I  powered the buck converters from my switch track buss which is set at 15 VAC.




Section 3 :  The RTC program written in lua which sends the commands to the ESP8266 to control the signals

Now that I have the signal lights, I need to control them. I've selected the Absolute Permissive Block (APB) system for my layout. Its operation has been described in detail by Bruce Chubb in his book series - "C/MRI USER'S MANUAL" and "RAILROADER'S HANDBOOK".  That set of books is available for free download at his web site: JLC Enterprises.net.

So you understand some of the basics:

1. APB is used for single track line with passing tracks.

2. My layout is based on the P&LE which was not single track but in my alternate universe, with the realities of an O gauge three rail layout and a finite size garage, the layout is single track with three passing tracks (J&L, College, and Struthers) between McKees Rocks and Youngstown.

3. An APB system will not let a train leave a passing track unless there is clear track all the way to the next passing track.

4, There are two types of signals in an APB:

Permissive signals show the status of the upcoming blocks:
    green - Clear - next two blocks are unoccupied
    yellow - Approach - next block is unoccupied but block after that is occupied
    red - Stop and Proceed - next block is occupied, stop but then you may proceed if safe to do so.

    Permissive signals are just suggestions. The engineer, with his knowledge of scheduled trains and extra trains (via train orders), can use his judgement to ignore those signals.

Absolute signals are on exits of passing tracks. The only absolute signal that is important is "Stop Signal":
    red - Stop Signal. Do not pass this signal. Stop and wait until the signal shows Approach or Clear.

5. Two additonal features are described by Bruce:

Headway - A train can follow a train into a block as long as they are both going in the same direction. Described as making headway. Otherwise, the second train must remain in the passing track until there is a clear path to the next passing track.

Approach Lighting - Signals are not lit unless there is a train in the block. That is, if there is no engineer present in the block to actually see the signal, there is no need to waste the electricity (quite often batteries) or shorten the life of the lamp.


The lua Program

In his books, Bruce showed a computer program written in BASIC which implemented an APB signalling system. I converted that program into lua which is the scripting language used by RTC.

Layout4 APB Master.lua - the lua code which controls the signals

I'm not going to show that here but it is included in the RTC download ZIP file.


RTC Signal Videos

I've created an 8 video series that shows the signals and their operation on my layout.

The playlist "RTC Signals" is on YouTube - Click here.


Layout Window

Here is my layout. Click on the thumb image to see the full size image. The background is a bitmap created by the RR-Track program. The signals are created by a lua script running in a Program Control Window.



Signals, Flags, Fixed Signals Display, and Cab Heads Up Display

Here is the page that talks about how the Signals are controlled using lua. Included are new lua functions to support signallng.Click here for that web page:  RTC Control Language - Signaling

You should read that web page before reading this page.






Downloads

You can download RTC from here:  Remote Train Control Program .  Includes all of the above features and many more.


This site prepared and maintained by Mark DiVecchio

email :  markd@silogic.com

SD&A HOME
 
 Mark's Home Page

The DiVecchio genealogy home page
The Frazzini genealogy home page

This site will be under construction for a while.