Wimborne Model Railway
By Russell Barnes. Posted

A model town in Wimborne has a separate model railway attraction. When it came time to upgrade parts of it, a Raspberry Pi was the natural choice
Advertisement
Introducing the smarter desktop: use cloud apps, thin clients, and get real work done on a Raspberry Pi. Also in the magazine we’re building a digital jukebox, controlling a robot arm, storing…
In the beautiful town of Wimborne, very close to where The MagPi is made, is a superb model town that has existed for almost 70 years. It’s a lovely tourist spot and a wonderful attraction, of a type that’s fairly rare these days. As part of the model town, there’s also a great little model railway. During the off season just past, the lights that make up part of this miniature railway were upgraded using a Raspberry Pi, by a team led by Terry Coles, an engineering manager who helps out at Wimborne Model Town.
“The fundamental requirement for the lighting is simple,” Terry tells us. “Simulate daylight, dim the lighting to simulate night-time, and then bring on lights in the trackside houses and streets. However, these were not the difficult goals; a bit more work was necessary because the finished system needed to be reliable, easy to use and maintain, and capable of being upgraded readily in the future.”
After a lot of discussion, the team settled on a Raspberry Pi Zero for the task: “This allowed for future upgrades and was considered more accessible to the average volunteer than, say, using an Arduino.”
The system isn’t just made up of a Raspberry Pi, though: there’s much more to it. The lights being used weren’t just a few LEDs stuck to a breadboard, as Terry explains:
“The WiringPi2 library was used to allow programming of a pulse width modulation (PWM) signal. This dims and brightens a 48W LED strip on GPIO pin 18 (the hardware PWM pin) to simulate the ‘Day’ lights. A MOSFET driver was used to carry the current needed. The lighting in the houses and elsewhere was switched by four other GPIO pins via a relay board.”
The system itself was developed on a Raspberry Pi with Raspbian, to make sure it was all working. Originally written in Python with the RPi.GPIO library, it doesn’t quite support hardware PWM so was then changed to the aforementioned WiringPi2. The final code was then moved over to a piCore image for actual deployment. Terry says that as the volunteers will just turn the Pi on/off rather than do a software shutdown – it’s a bit tricky with the way the system is built – piCore was the obvious choice, as the OS is loaded into memory and so there’s no reading or writing going on from/to the SD card.
All the software written for the project is also open-source, with Terry maintaining very thorough documentation and sources that you can find online. If you ever find yourself on the south coast in or near Dorset, go give the model town and railway a look!

Russell runs Raspberry Pi Press, which includes The MagPi, Hello World, HackSpace magazine, and book projects. He’s a massive sci-fi bore.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles

Picocomputer 6502
The Picocomputer 6502 is truly open-source hardware.
Read more →

CrowPi 3 review
An electronics playground with added AI lessons for Raspberry Pi, Pico, and more.
Read more →

Network mapper
It’s not as efficient as reading a table of figures, but we love this display anyway.
Read more →
Sign up to the newsletter
Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.