Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:26 11 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Model Railway DCC...

     Page 1 of 2    
Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 02:20am 13 May 2018
Copy link to clipboard 
Print this post

Hello folks.

One of the things I wanted to rekindle, was my interest in model railways. I had a layout years and years ago when I was a young teenager, but thought this might be something I could start up again.

I was interested in the idea of DCC and wondered if this would be within the capabilities of the Micromite. If it was, then an E100 with a 5" or 7" LCD and touch controls could be used to drive all the locomotives.

We should also be able to design a tiny DCC decoder for the locos.

Do-able do you think? I expect that the MM2/MM+ chips are fast enough for the 58uS and 100uS pulse widths of the DCC data format, although, a Cfunction/CSub might be needed here. Some additional reading on how DCC works can be found here, although, they don't discuss the actual protocol - that is what I am looking for now.

If the DCC spec cannot be achieved(trade secret perhaps), we could always invent our own simple slower protocol. You really don't need super speed to issue a few command bytes for a system like this. If we invented our own 'MMTC'(MicroMite Train Control!), it would be nice to incorporate feedback to the main controller as the Railcom protocol does, so the controller can get basic information about the train back if requested. This is optional, but would be nice to have.

EDIT: The other option is simple 'Cab Control', where isolated sections of track are wired back to a heap of toggle switches and a master controller. That works OK, but the wiring is massive if you layout is of any size.

Thoughts?
Comments?
Suggestions?Edited by Grogster 2018-05-14
Smoke makes things work. When the smoke gets out, it stops!
 
Lou

Senior Member

Joined: 01/02/2014
Location: United States
Posts: 229
Posted: 03:35am 13 May 2018
Copy link to clipboard 
Print this post

Grogs,

I have always been interested in model railroad, over the years I have seen some fantastic setups.

It be interested seeing a uMite control the whole thing, especially how you modulate the track voltage and receive to get the signal across.

I will be watching your progress, please keep us posted.

Lou

Microcontrollers - the other white meat
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 03:44am 13 May 2018
Copy link to clipboard 
Print this post

Something else I was thinking, was using cheap RF modules instead of modulating the track voltage. This would then form your two-way link to the loco(if needed), and could use any of the cheap RF modules such as the HC-12. Even with a tiny helical on one of those, you would EASILY get the range needed to control even huge layouts.

The track voltage would PROBABLY be 20v AC or so, and never changes. The receiver nodes in the loco can rectify that AC to make the train go forward or reverse.

Then the control commands can just be a simple serial link.

But if it is easier to modulate serial onto an AC voltage for the track, that would also work and you wouldn't then need RF modules. I'm not sure exactly how I would do that though. Perhaps DC and blocking diodes would be a better idea. Anyone got any ideas as to how you would easily modulate data onto an AC or DC track voltage?

EDIT: I have found this circuit. This seems to be perfect, as it is designed to hop onto an existing low-voltage line, and squirt serial data to the other end. Reading......Edited by Grogster 2018-05-14
Smoke makes things work. When the smoke gets out, it stops!
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1116
Posted: 06:59am 13 May 2018
Copy link to clipboard 
Print this post

G,

The following site may also be of interest - OpenDCC - not a trainee myself but an interested observer.

panky

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
pjmart
Newbie

Joined: 13/11/2016
Location: Australia
Posts: 9
Posted: 01:35pm 13 May 2018
Copy link to clipboard 
Print this post

Grogs,
I have some experience with DCC systems on model railways so perhaps can offer some further explanation. I believe the original design was based on a multidrop RS485 system. The control signal is a square wave which swings between a nominal +/-14v to minimise noise. The decoder extracts the control information and then rectifies the square wave to give a nominal 12v DC power supply for the main drive, lights, etc. There is a small microcontroller which decodes and distributes power as required. The drive motor is powered using pulse width control via a h-bridge circuit and the micro. The original design was developed by the Lenz company in Europe and then released into the public domain. The AMRA subsequently has developed hardware standards based on this work.

The original development was done some time ago (about 20 years) and does not take full advantage of recent advances in electronics. There are many different avenues currently being investigated and a good source is the free on-line magazine "Model Railway Hobbyist". A similar idea to yours of using the HC-12 /MM2 combination with power taken from the track is discussed / reviewed in a recent edition (Feb 2018 I think). Among the advantages is the ability to get full two way communication which is not possible with standard DCC. The difficulty is to get sufficient miniaturisation to allow it all to fit inside a standard loco.

A less ambitious approach may be to utilize the existing decoders (which can include Sounds) and develop a MM based back end control which generates the DCC output to the tracks, signals, point control, scenery lighting, special effects, etc, all of which are individually addressable. It is even possible to connect back to a pc network and control the whole thing using the open source Java based system known as JMRA and its various derivatives.

Peter
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 435
Posted: 03:49pm 13 May 2018
Copy link to clipboard 
Print this post

I am also very interested in this project. I am a former enthusiast of electric trains. Being French, I only know the German standards, but I think it must be easily adaptable
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 11:01pm 13 May 2018
Copy link to clipboard 
Print this post

@ panky - thanks for that link. Lots of extra technical info on the original DCC idea over there.

@ pjmart - Welcome aboard!(the forums) Thanks for that information. Yes, the main problem is going to be keeping it simple enough so that any decoder can be small enough to fit inside the model. The biggest challenge will be N-scale. I don't think there is much Z-scale around(6mm gauge!), and I think it would just be physically impossible to cater to that gauge. OO/HO is my preferred gauge, but N has the advantage that you can model more railway in the same space.

@ goc30 -

At the moment, SSOP MM2 and an L9110 H-bridge is the plan for the motor control at the loco, as this will be nice and small, and the 9110 H-bridge is cheap and easy to get. It is relatively low-power compared to some H-bridges(800mA), but most locos should draw less then that, even when pulling a train. My original controllers were 1A 12v rheostat speed control, and I used to drive long-ish trains with that. Each loco is separate, so you could have multiple locos drawing more then 800mA total, and that would still work if you see what I am getting at.

The first step, will be to see if I can get the concept working on the bench. I am still very much liking the HC-12 approach, cos then it is all wireless, and cuts down on the electronics even more - no need for the UART-over-power-wires idea at all.

Put 12v @ whatever amps you like on the track(with protection!), and then just control the locos wirelessly. The HC-12 is a nice small transceiver module, and I don't see any problems getting it to fit. Even the cheap HC-12 fakes would work fine in that kind of setup. It should be small enough to fit in an N-scale loco. I could then have wireless 'Walk-around' type controllers, perhaps built more on another MM2 and SPI LCD with touch(to save money) if you see what I am getting at.

Smoke makes things work. When the smoke gets out, it stops!
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 01:38am 14 May 2018
Copy link to clipboard 
Print this post

G'Day Grogster et al.
My only train had a key. No EFI there.
My boys had electric trains and with a well worn loco and a few short circuit turns, they behaved much like an industrial arc welder. Lots of EFI.
My question is, are modern locos brushless or is EFI going to be a problem with wireless?
I did think about this when the boys were young but you can't fit many OC71s into a model train.
Peter
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 02:02am 14 May 2018
Copy link to clipboard 
Print this post

It is floating around in my mind - dealing with EFI. Most model railway motors would still be brushed I think. You might be able to get some really exotic(read: expensive!) models with brushless. There will need to be some kind of basic noise suppression on the motor. The 9110 bridge has built-in back-EMF diode snubbers, so that SHOULD take care of most of it.

It is something that has passed through my head though. I don't THINK the RF modules will care, but this is one of the things that will be getting tested when I build the prototype and a short stretch of track to play with the idea.
Smoke makes things work. When the smoke gets out, it stops!
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 435
Posted: 03:26am 14 May 2018
Copy link to clipboard 
Print this post

Hi Grogster
One other bridge is L298N Here

another driver TLE9201SG It is a HBridge with spi interface


in (very) old time, I made a card that can work in H bridge mode (with mosfet transitors), and drive cc motors or stepper motors. May be now with ssop, its possible to make same module smaller.

For communication, HC12 is a very good idea

Edited by goc30 2018-05-15
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 03:50am 14 May 2018
Copy link to clipboard 
Print this post

Hiya.

L298 is a good H-bridge for bigger motors. It's too big physically though for what I am thinking. Even the PowerSO is to big. Thanks anyway. I do like the TLE9201 though! It is nice and small, but still powerful, so I will read that datasheet some more.
Smoke makes things work. When the smoke gets out, it stops!
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 2006
Posted: 05:48am 14 May 2018
Copy link to clipboard 
Print this post

Hi Grogs,
I have a model railway setup but it is packed away, has not been used for 50 years but still in good condition. I doubt I will ever set it up again as they take up too much room. I was just surfing around and some new model engines come DCC ready. Here is a couple of sites I looked at.
Here
and Here
Paul.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 979
Posted: 07:00am 14 May 2018
Copy link to clipboard 
Print this post

Hi Grogster,

with your assumption about "Z" you're not quite right. On this (German) page you will find some information about Z-decoders.

...I use"Z" but without DCC... (My goal would be to make the system itself "intelligent" and to control the track sections with Micromites...)

Frank
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 07:07am 14 May 2018
Copy link to clipboard 
Print this post

Danke.

Well, blow me. Who would have thought. That is REALLY small. I did not think you could get any DCC into Z scale!
Smoke makes things work. When the smoke gets out, it stops!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 12:14pm 14 May 2018
Copy link to clipboard 
Print this post

Time for some sleep, but this is what I have so far:





This board contains a MM2 and an SOIC H-bridge to drive the motor. Input can be AC or DC. Current PCB size is 31mm x 13mm - same width as an HC-12 module, and a little shorter. PWM 1A connects to the P pad(for engine lights, perhaps?), and PWM 2A/2B are the motor control PWM channels. The 2x4 pin-header holes are for the ICSP and console connections, although, you would not install the pin-header, as it would make the module to thick. We need to keep a low-profile.

I am thinking about making that 2x4 header into an edge-connector rather then pin-header. This will allow me to shave a few more mm off the length of the PCB, and then you just plug the PCB into an edge-connector socket for programming.

To be continued. Right now, I need sleep.
Smoke makes things work. When the smoke gets out, it stops!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 12:54am 15 May 2018
Copy link to clipboard 
Print this post

Have changed the 2.54mm pin header, for a 1.27mm female header. These are half the size(obviously), and are only 4mm tall, so they should not get in the way, and this allows easy mounting on a matching jig for programming and testing.







Size is now 27mm x 13mm, so I have shaved 4mm off the length.
Passives are 0805, regulators are SOT-89, MM2 is SSOP, H-bridge is SOIC.
12v power can be supplied via the header, really just to make programming easy, as that allows the on-board regulators to do their thing without any kind of back-feeding issues. I will keep looking for ways to optimize this layout, as I want to get it as small as possible. I think this is pretty close to as small as we can get it though, without going to four-layer. I'm not prepared to go four-layer just to shave a couple more mm off the size, as four-layer boards are four times the price of double-layer.
Smoke makes things work. When the smoke gets out, it stops!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 02:14am 15 May 2018
Copy link to clipboard 
Print this post

If you put the cap (100n next to the mm) to the other side you might be able to shave off another millimeter or two. :)

Microblocks. Build with logic.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 03:24am 15 May 2018
Copy link to clipboard 
Print this post

Nice one, thanks.
Smoke makes things work. When the smoke gets out, it stops!
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 435
Posted: 12:14am 18 May 2018
Copy link to clipboard 
Print this post

i have seen this
esp32 + L298N
http://mail.ruisantos.me//l/VG075pY6dV4S1RmWyqb2Ow/jWduL1q4eulbERaJ6r763Arw/krxy06MpuSagC5CYou8Baw

it seem that it is too big for DCC
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 01:16am 18 May 2018
Copy link to clipboard 
Print this post

Clickable link.

Too big. Agreed. I don't know how they plan to get all THAT into a model! I suppose if you were using a large-gauge scale or something. But they show it all hooked to one of those small 3v motors, so.....
Smoke makes things work. When the smoke gets out, it stops!
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025