Microcontrollers & Model Railways

Basic electrical and electronics, such as DC/Analog control.
User avatar
mmmbeeer
Posts: 32
Joined: Mon Oct 29, 2012 11:14 am
Location: Dorset

Microcontrollers & Model Railways

Postby mmmbeeer » Thu Nov 06, 2014 5:15 pm

Don't know if anyone has done this. I have used a cheap microcontroller and other electronics so I can use cheap servo motors (£1.30 each on eBay) for slow acting point motors. I have got 48 servos run from 48 switches at a cost of around £150. I plan to add signalling control next, either servo controlled semaphore signals or light signals. The signals and points will be locked as appropriate. Signal activation will be by reed relay and a small magnet under each train. Besides the cost of the signals this will add about £5 to the project. The electronics has involved making vero board pcbs with a couple of chips and other discrete components. Programming the microcontroller lead to 68 pages of code for just 48 points servos, so far.

I am very keen to share this knowledge and software with other model rail enthusiasts so they can save a lot of money, but I'm wondering if it's far too technical. Reading the mags gives the impression that lots of modellers are afraid of using a soldering iron, let alone making a pcb. Any views on whether there is interest in this type of project, and how to go about it would be welcome. I don't want to make any money out of this but I will want to cover any costs involved in publicising this thing.

I read that someone had used servos to run level crossing gates, that's something that could be added, locked to signals. Any other suggestions?

dan8400
Posts: 867
Joined: Sun Nov 01, 2009 6:02 pm
Location: Midville, Lincolnshire
Contact:

Re: Microcontrollers & Model Railways

Postby dan8400 » Fri Nov 07, 2014 7:06 am

Hi,

for those that are not afraid of the soldering iron I would imagine it could be a nice project. Just a couple of thoughts...

How flexible is the system? Not many will want to run 48 points / servo's.

How easy (or not) is the system to assemble? Maybe a step by step guide or a list of components needed would be a place to start.

Also, the modellers this is being aimed at would need to be either in the planning stage or very early in their build. I doubt I would rip out all of my point motors for another system. However, I would consider this a worthwhile project if, a: I didn't have point motors etc already and b: if there was an easy to follow guide.

If the making of PCB's / soldering doesn't put me off then maybe the programming of the chip might.

The biggest thing in favour of what you are doing is that you can save people money. I would persevere with a slightly complex project if it was going to make me a considerable saving.

Just some thoughts for you. I can kind of see both sides of this

Good Luck and I hope others take a view to help your research

Thanks
Dan
My Layout Thread: viewtopic.php?f=22&t=30117

User avatar
mmmbeeer
Posts: 32
Joined: Mon Oct 29, 2012 11:14 am
Location: Dorset

Re: Microcontrollers & Model Railways

Postby mmmbeeer » Fri Nov 07, 2014 9:46 am

Hi Dan,
Thanks for your reply and some answers...

The system is very flexible, it can run between 1 and over 900 servos, just a matter of changing the programming and adding extra hardware as required.
The assembly I think is not beyond anyone who is handy with a soldering iron, I'm quite clumsy with my hands and managed to assemble all the electronics and get it working first time. I agree step by step guides with photos and diagrams with parts lists would be a start, but how to publish it? A website, booklet, youtube? Don't know, and I don't want to shell out a lot of money to do it.

I wish I had thought of this before I fitted solenoid motors and discovered I hated them. So now I've got to retro fit the servos, a job I keep putting off.

The programming I aim to upload to a software sharing site or share somehow. At the moment the chip is programmed for 48 servos, you can use less with no problem. If more are wanted it's a simple cut and paste job with a few amendments. As I said, I aim to add interlocking signalling later, so that will be shared too.

I've also thought of contacting a mag to see if there was any interest in an article, but that's down the line a bit; I want to get the retro fitting completed first. I've tested the concept on a small scale - one point and one signal, but need to test it on a large scale as a production model.

Thanks for your comments,

mmmbeeer

User avatar
Bufferstop
Posts: 12719
Joined: Thu Mar 11, 2010 12:06 pm
Location: Bottom end of N. Warks line

Re: Microcontrollers & Model Railways

Postby Bufferstop » Fri Nov 07, 2014 10:11 am

Can I point you or anyone else interested in this to the Model Electronic Rail Group (MERG) at http://www.merg.org.uk/. That's assuming that you aren't already aware of them.
Growing old, can't avoid it. Growing up, forget it!
My Layout, My Workbench Blog and My Opinions

User avatar
Roger (RJ)
Posts: 1488
Joined: Tue May 29, 2007 2:59 pm
Location: Nottingham, UK.

Re: Microcontrollers & Model Railways

Postby Roger (RJ) » Fri Nov 07, 2014 10:21 am

Are you aware of the servo system from Peco - Smartswitch? Rather more expensive than your system though. The Peco system is, I believe, based on a system from ESU. There is also the MERG kit available which is fairly inexpensive, though you need to be a MERG member to buy it.

Suzie
Posts: 364
Joined: Tue Dec 17, 2013 11:46 pm

Re: Microcontrollers & Model Railways

Postby Suzie » Fri Nov 07, 2014 4:19 pm

Roger (RJ) wrote:...The Peco system is, I believe, based on a system from ESU...


The Peco PLS100 system is just a rebadged ANE product but it is similar to the ESU in that you have to add bits on to get the full functionality. There are quite a few systems around for controlling points using servos already so this is reinventing the wheel a bit but my favourite is the all in one unit Signalist SC2.

Using servos is the cheapest ready made way to motorise your points if you are DCC so it is well worth considering. Figures here based on controlling four points including DCC decoder, frog switching and motors

Solenoids:-
Peco PL10 + PL15 + Lenz LS100 ~ £27 per live frog point

Slow Motion:-
Tortoise + Digitrax DS64 ~ £25 per live frog point

Servos:-
ANE/Peco PLS100 + decoder + frog switch ~ £22 per live frog point
ESU Switchpilot Servo + extension + SG92R servo ~ £16 per live frog point
Signalist SC2 + SG92R servo ~ £15 per live frog point

When you add it all up it can be quite an eye opener. Prices (except for Peco) all taken from Coastal DCC.

DIY should come out cheaper still, but will be a lot of work.

User avatar
mmmbeeer
Posts: 32
Joined: Mon Oct 29, 2012 11:14 am
Location: Dorset

Re: Microcontrollers & Model Railways

Postby mmmbeeer » Fri Nov 07, 2014 7:07 pm

I am aware of MERG and the Peco system. Looking at the numbers above the cheapest works out at £15 a pop. My system around £3 a pop and that's the whole point. Plus is it far more flexible than those others in that you can also interlock signals, level crossing gates and any other devices that can be driven by servos, motors, stepper motors, LEDs.

The servos I have bought on eBay from the far east cost £1.30 each and they are the same as the ones in the Peco kit.

My set up has 40 points, with the cheapest offering above that works out 40x15, £600. I've spent around £150 for 48.

Suzie
Posts: 364
Joined: Tue Dec 17, 2013 11:46 pm

Re: Microcontrollers & Model Railways

Postby Suzie » Fri Nov 07, 2014 8:14 pm

That is a good saving. Make it work with software like JMRI and you might have a few people take it up.

Probably best to post your work on a forum somewhere rather than hope that a magazine will publish it. The last bit of meaningful electronics I saw published in a model magazine was a circuit for a CDU in the November 1973 Railway Modeller. UK magazines do not even review DCC equipment anymore because it is considered a minority appeal (presumably because it does not have a funnel on it).

User avatar
ElDavo
Posts: 547
Joined: Thu Oct 18, 2007 1:52 pm
Location: Winchester, UK
Contact:

Re: Microcontrollers & Model Railways

Postby ElDavo » Sat Nov 08, 2014 9:52 pm

IMHO share what you've got on here and/or RMweb. There are bound to be some folks who understand and are interested. Personally I have been using Arduinos to control servos, signals and route setting on my layout Waton. Great fun and pretty cheap.

Cheers
Dave

cowjam
Posts: 84
Joined: Fri Nov 07, 2014 11:56 am

Re: Microcontrollers & Model Railways

Postby cowjam » Mon Nov 10, 2014 12:15 pm

i've just started with my model railway and have been investigating the use of microcontrollers. i bought a hornby 'blue rapier' set a few years ago when i was really into arduino but never did anything with it. for a recent birthday my wife got me a few tressle tables to use with the railway so i've started looking at it again.

with my arduino background i've been looking at what i can do cheaply (ie. with stuff i already own, or with stuff that's very cheap) and a points controller is one of them.

what microcontroller are you using, and more importantly what are those £1.30 servos?

Gordon H
Posts: 214
Joined: Tue Mar 14, 2006 1:08 pm
Location: UK
Contact:

Re: Microcontrollers & Model Railways

Postby Gordon H » Mon Nov 10, 2014 12:42 pm

mmmbeeer wrote:I am aware of MERG and the Peco system. Looking at the numbers above the cheapest works out at £15 a pop. My system around £3 a pop and that's the whole point. Plus is it far more flexible than those others in that you can also interlock signals, level crossing gates and any other devices that can be driven by servos, motors, stepper motors, LEDs.

How do you define your layout arrangement to the microcontroller? Is it hard coded or do you have a set-up facility?
Are you using a single microcontroller for the whole lot?
You are far more likely to find a similarly minded audience within MERG than by trying to publish through conventional magazines. There are many of us within the group working on such things in a variety of ways already, so a lot of experience can be drawn on.

User avatar
mmmbeeer
Posts: 32
Joined: Mon Oct 29, 2012 11:14 am
Location: Dorset

Re: Microcontrollers & Model Railways

Postby mmmbeeer » Wed Nov 12, 2014 11:33 am

I'm using a single Arduino ATMEGA 2560 plus 3 x Adafruit 16 channel servo controllers running on an i2c bus. To preserve Arduino I/O pins I'm using 3 x 16 bit input latches for the switches which control the servos, hence the need for vero board PCBs. When I add light signals I will again use latches to preserve Arduino I/O pins. I'll see about adding a diagram later. Power is from an old PC PSU. The railway layout is only defined as 48 points or switches and servos at present, 40 of which I use. Later when I add signalling and lock them to the relevant points the layout will be defined by the logic of the programming, such as for a particular signal a particular servo position is checked and relationships with other close signals are checked plus state of a read relay.

The servos I get on eBay, normally from the Far East bought in lots of ten. Just had a quick look on Ebay, searched for servo 9g, buy it now, price + p&p lowest first - £1.28 for Tower Pro 9g servo from Hong Kong, more than capable for indoor 00 gauge. For outdoor 0 gauge you'd probably want something beefier and therefore more expensive. If anyone is worried about buying from the Far East, don't be. I've ordered loads of stuff with no problems.

An interface to JMRI would be nice but software interfaces are way beyond my capability. I'll use JMRI to drive trains and a seperate switch/mimic panel for points and signals, which was what I was after anyway.

Gordon H
Posts: 214
Joined: Tue Mar 14, 2006 1:08 pm
Location: UK
Contact:

Re: Microcontrollers & Model Railways

Postby Gordon H » Wed Nov 12, 2014 12:35 pm

mmmbeeer wrote:I'm using a single Arduino ATMEGA 2560 plus 3 x Adafruit 16 channel servo controllers running on an i2c bus. To preserve Arduino I/O pins I'm using 3 x 16 bit input latches for the switches which control the servos, hence the need for vero board PCBs. When I add light signals I will again use latches to preserve Arduino I/O pins. I'll see about adding a diagram later. Power is from an old PC PSU. The railway layout is only defined as 48 points or switches and servos at present, 40 of which I use. Later when I add signalling and lock them to the relevant points the layout will be defined by the logic of the programming, such as for a particular signal a particular servo position is checked and relationships with other close signals are checked plus state of a read relay.

I must admit that from the wording of your first message I gained the impression that you had built it all yourself from scratch at component level, rather than using mostly off-the-shelf ready-made modules, hence my original line of questioning. It's all down to the terminology you are used to, I guess.
Anyway, it sounds as if you are in the realms of hard coding for each specific layout at the moment.
There are lots of tricks that can be played to preserve I/O pins, with one of the most commonly used being shift registers. With these you only need four I/O pins to read (and control) almost limitless quantities of inputs and outputs.

cowjam
Posts: 84
Joined: Fri Nov 07, 2014 11:56 am

Re: Microcontrollers & Model Railways

Postby cowjam » Wed Nov 12, 2014 3:11 pm

Interesting stuff, thanks. I hadn't heard of JMRI before.

It's nice to see someone else already using an arduino for their railway :)

User avatar
TimberSurf
Posts: 2493
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Microcontrollers & Model Railways

Postby TimberSurf » Sun Nov 30, 2014 2:49 pm

See my thread http://www.newrailwaymodellers.co.uk/Forums/viewtopic.php?f=8&t=46938

and an example of a superb railway and Arduino nano's in use http://www.newrailwaymodellers.co.uk/Forums/viewtopic.php?f=22&t=27778&start=375 read on for Arduino programmed routing!

For me (40+ points and 12 way marshal/storage yard) £4 per control and £1.25 per servo and £1.25 per relay (electrofrog/signal) is the cheapest without programming
The arduino route is even cheaper but does involve some soldering and programming but may be worthwhile if £50 price tag for 12 is OTT for 2-3 points.
(also, Megapoints Controller can be DCC for another £25)
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!


Return to “Electrical & Electronics”

Who is online

Users browsing this forum: No registered users and 5 guests