Turntables |

This project shows how to use an Arduino UNO R3 or Arduino Mega 2560 to create a button controlled indexing turntable for DCC or analogue layouts.
In this example the Peco turntable has been used but the code can be used on any turntable.
Stepper Motor Driver
Although the A4988 is used in the example the 2208 was used on the finished turntable and was quieter and had more torque so is recommended.
|
Download the code for this project
Useful resources
Stepper motor Lessons 30-32
24LC256 External EEPROM
|

This project shows how to use an Arduino UNO R3 or Arduino Nano v3 (Original style Nano with ATmega328 chip) to create a DCC controlled indexing turntable.
In this example the Peco turntable has been used but the code can be used on any turntable.
Stepper Motor Driver
Although the A4988 is used in the example the 2208 was used on the finished turntable and was quieter and had more torque so is recommended.
DCC Decoder circuit Diode is a 1N4148
|
Download the code for this project
DCC Decoder circuit Diode is a 1N4148
Useful resources
Stepper motor Lessons 30-32
24LC256 External EEPROM
DCC Decoder Circuit
|
Model Railway Indexing DCC Turntable 26/12/2021
This covers the physical build as well as the turntable control sketch. |
 |
Traverser / Transfer Tables |

After many years of service it was time to upgrade the traverser with a differerent type of indexing system and updated Arduino Sketch.
The updated traverser uses a limit switch for indexing and the updated sketch also usues non blocking code so that other features can run on the same Arduino. |
Download the code for this project
Other resources
Arduino Indexing DCC Traverser - Original build
ESP32 or Arduino DCC Accessory Decoder Circuit 03/04/2024
DCC Decoder projects for Arduino and ESP32


|
Arduino Indexing DCC Traverser 24/12/23 |
 |
Arduino Indexing DCC Model Railway Traverser 20/03/23 |
 |
Servos |
How to set up the movement of servos for turnout control of Kadee uncoupler.
This project allows the movement of the servo to be set using the potentiometer with the position displayed in the Serial Monitor and the optional LCD screen.
This lesson uses code from
the Arduino C++ Course
Lesson 6 AnalogRead()
Lesson 10 Servos
Lesson 17 1602A I2C LCD Screen
STL files for download
Turnout Servo Mount
Kadee Uncoupler |
Download the code for Lesson
Click image for larger version
 |
PCA9685 Servo Setter Project 29/12/23 |
 |
NOTE: An extra sketch servoMove7 has been added to the zip file.
This sketch has 2 extra lines in the setup() that preset the servo position to the 90 degrees position.
This prevents the servo jumping to zero at the start of the first movement.
Check the READ_ME file for details.
This lesson covers servo speed control using millis() and micros() for timing and sero.write() and servo.writeMicroseconds() for position.
This lesson allows the movement of multiple servos at the same time moving in sync or own their own.
This lesson uses code from
the Arduino C++ Course
Lesson 3 Controlling Timings with millis()
Lesson 10 Servos
STL files for download
Turnout Servo Mount
Kadee Uncoupler |
Download the code for Lesson
Click image for larger version
 |
This lesson shows how to use single or multiple PCA9685 servo driver boards.
The sample sketches show how to use control speed individually or together.
This lesson allows the movement of multiple servos at the same time moving in sync or own their own.
Issues covered include power supply and the limits of the I2C data bus.
This lesson uses code from
the Arduino C++ Course
Lesson 3 Controlling Timings with millis()
GS-1502 Linear servo
STL files for download
Turnout Servo Mount
Kadee Uncoupler |
Download the code for Lesson
Click image for larger version
 |
Track Control Panels |
This lesson shows how to create a function that will read multiple momentary switches.
The sketch is then combined with the previous servo control sketches to create different ways to control servos connected directly to the Arduino or via a PCA9685 servo driver board.
Servos Part 2 Servo Speed Control
Servos Part 3 PCA9685 servo driver board
Lesson 3 Controlling Timings with millis()
Lesson 4 DigitalRead(), debouncing buttons and pull down resistors
STL files for download
Turnout Servo Mount
Kadee Uncoupler |
Download the code for Lesson
Click image for larger version
 |
This lesson shows how to create a function that will read multiple latching switches often known as toggle switches.
The sketch is then combined with the previous servo control sketches to create different ways to control servos connected directly to the Arduino or via a PCA9685 servo driver board.
Servos Part 2 Servo Speed Control
Servos Part 3 PCA9685 servo driver board
Lesson 3 Controlling Timings with millis()
Lesson 4 DigitalRead(), debouncing buttons and pull down resistors
STL files for download
Turnout Servo Mount
Kadee Uncoupler |
Download the code for Lesson
Click image for larger version
 |
This lesson adds leds to the control panel using 74HC595N shift registers to create the extra pins required.
Servos are controlled via PCA9685 Servo driver board with buttons used for control.
Sketch uses code from switches Part 1 as a basis to get started.
Switches Part 1
Servos Part 3 PCA9685 servo driver board
Lesson 22 74HC595N Shift registers and shiftOut()
Lesson 3 Controlling Timings with millis()
Lesson 4 DigitalRead(), debouncing buttons and pull down resistors
|
Download the code for Lesson
Click image for larger version

IMPORTANT: As more servos and LED's are added the circuit starts to draw more power. If the power supply is not capable of providong enough power the shift registers can trigger incorrectly.
On the breadboard I used a breadboard power supply but it was very close to it's maximum.
For model railway layouts I would supply this circuit with at least 1.5Amps 5v supply and if multiple servos are moving at the same time 2.5amps. |
This lesson covers a couple of old simple to implement turnout control systems using wire in tube and stud and probe.
|
These methods are tried and tested over the years and may well be suited to your project.
The advantage of these systems is that they do not require any programming and can be built using very basic tools and are effective in use as well as being very durable.
The Stud and Probe control panel used in this lessin will be expanded in future lessons to include led panel lights as well as outputting servo and solenoid turnout control.
|
This lesson uses a stud and probe control panel that controls solenoid turnouts via and Arduino and relays.
The lesson shows some of the issues around using relays as well as using exandable code to allow multiple relays to be added very easily.
Due to the number of buttons in the project the project uses CD4021 shift registers based on the code from Lesson 21 CD4021BE Shift register
|
Download the project code for this lesson
Click on the diagram for a larger version
 |
This lesson uses a stud and probe control panel that controls solenoid turnouts via and Arduino and Mosfets instead of relays.
The lesson shows some of the issues around using mosfets, especially the issues regarding some of the mosfet modules.
The code and circuit are easily expanded to allow multiple mosfets to be added very easily.
Due to the number of buttons in the project the project uses CD4021 shift registers based on the code from Lesson 21 CD4021BE Shift register
|
Download the project code for this lesson
Click on the diagram for a larger version
 |
This lesson builds on the previous lesson using stud and probe or momentary switches to control turnouts with Mosfets and solenoids.
In this video the leds are added to the control panel and the code is also changed to allow servo control as well.
As the code is exandable adding extra servos, buttons or leds is very simple.
Due to the number of buttons in the project the project uses CD4021 shift registers based on the code from Lesson 21 CD4021BE Shift register and for the LED's it uses 74HC595N Shift registers from Lesson 22 74HC595N
|
Download the project code for this lesson
Click on the diagram for a larger version
 |
PCA9685 Servo Control with buttons, point/turnout control for model railways 01/01/2024 |
 |
Capacitive Touch Screen |

This lesson shows how to use a GT911 Capacitive Touch screen as a control panel.
The sketch shows how to use the GT911 for a single touch point.
The final sketch will use the touch points to control servo positions.
The code works with the Arduino Uno (via a level shifter) or ESP32 Dev module.
It will also run on the Mega 2560 (Level lifters required) or the 3.3v Arduino Due although The SDA pins will be in different positions on the boards.
|
Download the code for Lesson
Component Links
Touch Screen must be GT911 6 Pin I2C
Ribbon Cable Connector
I2C Safe Level Shifter (UK)
I2C Safe Level Shifter (USA)
Connections
WARNING WARNING WARNING WARNING
GT911 Capacitive touch screens are 3.3v. To use with an Arduino Uno Level lifters must be used on all communication pins.
| GT911 |
Arduino Uno |
ESP32 Dev Module |
| RST |
Via Level Shifter Pin 8 |
5 |
| INT |
Via Level Shifter Pin 2 |
2 |
| SDA |
Via Level Shifter A4 |
21 |
| SCL |
Via Level Shifter A5 |
22 |
| GND |
GND |
GND |
| VDD |
3.3V |
3.3v |
|
Speedometer |
In this lesson I will go through the steps and considerations when choosing sensors for a project, in this case a speedometer for a model railway.
The project will use the LCD screen from lesson 17, a debounced button from Lesson 5 and the IR sensors from Lesson 7. |
Download the code for Lesson 18
Click image for larger version
 |
DCC Decoders |
ESP32 or Arduino DCC Accessory Decoder Circuit 03/04/2024 |
 |
ESP32 DCC Accessory Decoder 27/10/2021 |
 |
#62 DCC decoder controlling servos and LED's 23/01/2024 |
 |
DCC Accessory Decoder, sounds and lights Arduino UNO 12/10/2021 |
 |
Led Effects |
Model Railway Light Effects using PCA685 and LED's with Arduino or ESP32 09/05/2022 |
 |
#63 Arduino C++ Gas Light effects using an Arduino and PCA9685 servo driver board 26/01/2024 |
 |
Crossings |
#58 Model railway crossing with Servo Barriers, LED lighting and sound 08/01/2024 |
 |
Isle of Mudd Modular layout |
Isle of Mudd Model Railway 27/12/2023 |
 |
DCC Modular Layouts and Control Panels 02/02/2022 |
 |