Shelf Layout

Post details of your T gauge layouts and the progress you are making.
Post Reply
oliverwhorwood
Posts: 7
Joined: Sat Apr 04, 2020 5:49 pm

Shelf Layout

Post by oliverwhorwood »

Bits ordered up for my first T-Gauge layout, the imaginary station of Sellyhurst on the line of Woodham-Barnford to be assembled on a 120cm x 25cm shelf.
This will initially include a 3 unit Southern class 377 on 20m chassis with DCC control including white and red switchable lights. Oneway points at either end so train travels back on left track and an electric point for the siding. This will all be connected up to a motor shield and Arduino Uno including DCC, points control and magnetic positioning sensing. Stickers will be printed off for the body shells using texture pictures from a 3d model found online (attached for interest).

The extention to the track will use all existing sections of track exluding one 6mm straight. This will have a loop circuit round the back of the shelf using flexitrack at a 10cm radius (will have to experiement and see if this is too tight). Plus an extra siding, and two extra platforms with electric points and another 3 unit 377.

First implementation:
shelf v1.jpg
Extension for later date:
shelf ext.jpg
Southern class 377 livery
C377_d.png

gbtrains
Posts: 300
Joined: Sat Jul 02, 2016 6:21 pm

Re: Shelf Layout

Post by gbtrains »

HI

that will look very cool on as a shelf display whilst running the 377's around.

Have fun in building.
Let us know how it goes for DCC control's :D

Regards
Graham

oliverwhorwood
Posts: 7
Joined: Sat Apr 04, 2020 5:49 pm

Re: Shelf Layout

Post by oliverwhorwood »

Changed the design slightly to try and replicate the real station of Sittingbourne in Kent. This has a service from Swale - Sittingbourne on Class 375/3 Southeastern. Three platforms and one siding. Managed to get the motorised chassis up and running using Arduino PWM at 122.55 Hz.

Has anyone got any tips on how to make the one-way turnouts more reliable?

The new layout:
shelf ext.jpg
Sittingbourne:
Sittingbourne Map.png

mattd10
Posts: 205
Joined: Wed Nov 13, 2013 10:12 pm
Location: West Sussex, UK
Contact:

Re: Shelf Layout

Post by mattd10 »

Looking great! Are you just using the outputs from the arduino or going via a motor shield? Looks like its running well!

oliverwhorwood
Posts: 7
Joined: Sat Apr 04, 2020 5:49 pm

Re: Shelf Layout

Post by oliverwhorwood »

Thanks Mattd10! Just going straight from the Arduino for this test and making sure to keep the average output below 4.5V. It's running well on straights, however need to replace the one-way turnouts with motorised as they are no good when shunting unpowered (non-magnetic) chassis's through and follow the thrown direction instead of straight on so derails.

sidneylopsides
Posts: 10
Joined: Tue Apr 14, 2020 8:48 am

Re: Shelf Layout

Post by sidneylopsides »

Oh of course, I had only looked at DIY DCC for larger scales previously, and it hadn't clicked that you could run it directly. The voltages and current are low enough for the output pins, and I found an old Uno in a box the other day.

Your layout is looking great so far, the smoothness of the stop in that video is impressive.

oliverwhorwood
Posts: 7
Joined: Sat Apr 04, 2020 5:49 pm

Re: Shelf Layout

Post by oliverwhorwood »

Hi sidneylopsides, thanks! Straight from Arduino is fine for PWM direct control. For DCC you actually require a motor shield as the voltage for this is 13V ish. A board based on the L298N is perfect for this, available on eBay for around £4. A 15V power supply is needed as the board uses about 2V.
F93HPKMID2XEAO7.LARGE.jpg
F93HPKMID2XEAO7.LARGE.jpg (61.22 KiB) Viewed 2223 times
This has two inputs for direction control and the Arduino outputs the DCC PWM on one pin. Therefore a transistor in NOT gate configuration (one component) is needed to control the board.

For the sensors I am using Hall effect sensors which measure the magnetic field strength of the magnets under the chassis. These go through a comparator to send a signal when the threshold (set by potentiometer) is met.

For turnout control, two pins on the Arduino are used, one for each motor direction. With slight modification of the DCC++ code, this can trigger a pulse of 0.3s on either of these pins to throw and close.

sidneylopsides
Posts: 10
Joined: Tue Apr 14, 2020 8:48 am

Re: Shelf Layout

Post by sidneylopsides »

Any chance you could share what code you used for your Arduino?
Is it just a basic PWM control sketch?

I was thinking about DCC, couldn't we simplify things by removing the 13V stuff? We're using a 5V base station and a 5V motor, and the only reason to use higher voltage is because larger scales use it as standard. Attiny 85 function decoders can be made with basic boards, so something like an ATTiny could be used directly with PWM to the motor from a pin, like your Arduino demo above.

oliverwhorwood
Posts: 7
Joined: Sat Apr 04, 2020 5:49 pm

Re: Shelf Layout

Post by oliverwhorwood »

PWM and DCC are two seperate things.

DCC requires a decoder in the locomotive which decodes the 13V voltage on the rail and outputs 5V PWM to the motor. The voltage is actually AC but as a square wave - hence the seperate motor driver. Note the benefit of DCC is that multiple locos can be run on the same track whereas direct PWM will move all locos on that isolated section of rail.

PWM can be used to directly power the motor using a voltage of up to 4.5V. Note that most ATMega and Attiny controllers will output a max of 5V so care is needed not to supply the load (motor) with too much voltage.

oliverwhorwood
Posts: 7
Joined: Sat Apr 04, 2020 5:49 pm

Re: Shelf Layout

Post by oliverwhorwood »

void setup() {
// put your setup code here, to run once:
TCCR2B = TCCR2B & B11111000 | B00000110; // set timer 2 divisor to 128 for PWM frequency of 245.10 Hz
pinMode(11,OUTPUT);

}

void loop() {
// put your main code here, to run repeatedly:

int pot = analogRead(A0);
int pwm = map(pot,0,1023,0,255);
analogWrite(11,pwm);
}

Post Reply