Friday, January 19, 2018

Entering the world of Tiny model trains: T-Gauge

Playing around with a new model train. I got my hands on a few pieces of track and a motorized chassis from Eishindo. The scale is 1:450 (T-Gauge) which is, well, tiny. The tracks are 3.3mm apart and is with bed just 12.5 mm wide. The train is just 52mm long (and it's the largest one available) and the radius of the smallest circle is 120mm.

Anyway, I didn't order any control box or whatever, just the track and a train. From what I've read the train needs about 4-4.5V to run and the official control box is just a PWM controller. Since I have plenty of Arduino's and a bunch of H-bridges in my parts collection I thought "why not make my own?"

So here we are:
100Hz PWM, 32% duty cycle seems to result in a velocity of 80mm/sec, which is about 130 km/h in full scale.

My goal is to embed all the electronics within the train itself. As you can see there is a bit of space available inside the chassis. Power is transferred to the train through the tracks. One rail is positive, the other is ground. By switching polarity the train changes direction. Power is picked up from the track by all wheels and transferred through some springs to the bus bars which runs through the top of the train. The springs also keep the bogeys attached to the train. The motor is connected to the bus bars through two springy connectors that just press against the bars.

This opens up some opportunities for a plug and play controller. Sliding a PCB between the motor connectors and the bus bars makes it easy to pick up power from one side and provide power to the motor on the other side while doing some controlling in between. So I'm going to need an H-bridge to control the motor and a micro controller to handle some logic and control the H-bridge.
Since there's no way to tell which of the bus bars is positive and which is ground I'm also going to need a few diodes. The ATtiny85 seems like a good choice: fairly small form factor (8 pin soic) 5 IO pins (1 for picking up an input signal, 2 for the H-bridge and the remaining 2 for some lights).  For the H-bridge I found the L9110 (which is the cheapest H-bridge in 8 pin SOIC on E-bay...)

There's a few ways to set up communications with the controller. Wirelessly (radio waves (BT, 2.4GHz, etc), infrared) or through the tracks. Since I'm trying to fit this in a space that measures about 5mm in width and ~15mm length there's just no space for wireless (and it's lame). So I'm gonna go with what most digital train systems use: communications through the tracks. The most popular existing system is DCC which communicates to decoders by switching the polarity of the tracks at a certain frequency (high frequency for a 1, low for a 0).
Decoders will have to rectify the incoming AC power to DC and should also detect the frequency of the AC signal; nothing a few diodes can't handle. I'll also need a capacitor to smooth out the power and deal with the noise the motor generates.

Parts list:
1x ATtiny85-20SU
1x L9110 H-Bridge
1x 1K resistor (pull up for reset line)
4x Diode to form a full bridge rectifier
Few capacitors

Sounds like a plan, but after measuring the available space I realize that there's not enough vertical space available to accommodate a populated double sided board...
So back to the drawing board it is...