Monday, January 2, 2017

beginning

Since more than two years, I am now working on a model railroad for me and my two sons. It all started with just some old tracks (back from the days of my own model railroad), some used engines and carriages bought from ebay set up on the living room table.
Over time, this evolved into a full blown model railroad on wooden fiberboard, sized ~1,5m x 1m in scale 1/120 (TT). At the moment, the whole layout is still analogue; as that only allows one motorized train at the same time, most trains currently are push-trains :-D.

So for quite a while already, I was looking for a solution to let both my sons drive one train at the same time.
All my solutions evolve around a raspberry pi, since I can easily program that, it provides electrical input and output (gpio pins) and was available right away.
My first idea was a layout, heavily split into subsections, and a good mechanism to enable separate subsections using relais. One single DC source was supposed to support two trains using two PWM modulated outputs. The different sections would then be fed with one of the two modulated outputs and thus let the trains go ahead. I bought two L293D H-bridges and did my first tests. This worked in a small proof of concept for half a minute, but when I tried it out for several minutes, the H-bridge overheated (and likely died) due to no installed cooling, melted parts of the breadboard it was installed on and grilled the first rpi.
This made me give up on the project for nearly a year, and then made me reconsider my choices.

So I decided to modify some of the given things:
* instead of the weak L293D use some more powerful motordriver. In the end, I decided to buy two (one spare) LMD18200 motor driver boards ready set up on ebay.
* instead of using PWM and having to manage a complicated track, I would switch to full digital control and use DCC instead.
* using DCC means that I need to buy new DCC-decoders for all my engines, and also that I might need to solder the decoders into my old engines.
* instead of writing the DCC protocol myself, I decided to reuse an existing solution, in this case dccpi by Hector Sanjuan. For testing purposes I also used gpiodcc

Some weeks ago, I managed to drive my first engine digitally using dccpi, the hardware seems to be ok with that, and after some thoughts I realized that I have one issue left: All decoders seem to have address 3 as default engine address. To have at least two trains going, I would have to program the decoders. This is not implemented in dccpi atm, so I am now trying to get a solution for that. In case I manage to find one (and I hope so), I will of course make them available on github.

So far the reasons for this blog, hopefully more documentation to come in the coming months.