Controlling model tram

Tram.pdf (314.8 KB)

Hi everyone, looking for general guidance on a project to control two trams that will have a passing loop with, as you can see, three stations. The trams will pass at the Northern station.

I'm thinking I'll need a Mega due to there being two points, six signals and four sensors, with four blocks.

I want to use a single 298N (or TB6612FNG) although I have four blocks. You see blocks 2 and 3 are always the same direction, with Block 2 being Westbound and Block 3 being Eastbound.

Blocks 1 and 4 will change direction depending on whether a train is running East or West. However, I want the power to be capable of being cut in any of the four platforms in order to stop a train at a sensor.

Any ideas?

I have no idea what any of this means .

You should make a specification of what inputs and outputs you need and what they need to do .

What voltage and what current do the trams need?
Do You have solutions for sensing the presence of a vehicle?
I run a fairly large modell railroad using commercial stuff, not needed for Your project...
There are ways to publish that picture here! Take a look into the first topic telling how to get the best from this forum.

Hi Railroader
Eventually my layout will be 30 feet by 20 feet with the tram lines being a small part of the overall layout. The tram is intended to extend in to the following:

Underground2.pdf (248.1 KB)

But that's for another day :grinning:

Once I get the small design working, I believe I can extend myself to the bigger one.

Let me outline the steps for the tram, and maybe you can give me some tips:

Step 1: Departure Signals at East (E1) and West (W2) go green
Step 2: Power direction is set for both trams to head north
Step 3: Points for approaches to North station are set so that Eastern tram goes to the outside (UND1 goes straight) , and the Western tram goes to the inside (UND2 diverges to left)
Step 4: Power is enabled so that Blocks one and three are on the same circuit, with Blocks two and four being on their own circuit
Step 5: Trams run from East to North and West to North
Step 6: When tram leaves sensor one, the signal W2 goes red, and when tram leaves sensor four, signal E1 goes red
Step 7: Both North signals N1 and N2 are set to red
Step 8: Whichever of Sensor two or three is tripped first by the arrival of a tram, causes the power to be cut in that block. Thus, if sensor two is triggered, then power is cut to block two, likewise if sensor three is triggered then the power is cut to block three
Step 9: Wait for the other tram to arrive and cut its power
Step 10: With both trams stopped, the second half of the journey can begin. Using a timer, wait 30 seconds then start from step 11
Step 11: Both signals at North (N1 and N2) go green
Step 12: Power direction is set for Blocks one and four for both trams to head south
Step 13: Points for departures from North station are set so that the Eastern tram goes to outside (UND2 goes straight), and the Western tram goes from inside (UND1 diverges to left)
Step 14: Power is enabled so that Blocks one and two are on the same circuit, with Blocks three and four being on their own circuit
Step 15: Trams run from North to East and North to West
Step 16: When tram leaves sensor two, signal N1 goes red, and when tram leaves sensor three, signal N2, goes red
Step 17: West Signal W1 and East Signal E2 are set to permanent red
Step 18: Whichever of Sensor one or four is tripped first by the arrival of a tram, causes the power to be cut in that block. Thus, if sensor one is triggered, then power is cut to block one, likewise if sensor four is triggered then the power is cut to block four
Step 19: Wait for the other tram to arrive and cut its power

Voltage will be 12 volts to the track as I'll be using Kato unitrack and Kato trams.

The problem I see is in the motor controller (289N). Ideally I only want to use one of these with two motor circuits, but I have four power blocks. I want blocks one and four to be directly controlled by the outputs from the 298N power controller, but I need to be able to turn the power on and off in all four blocks.

Blocks two and three always have the same direction but they need to be energized and connected to the power from blocks one and four at different times, such that for the first part of the run, blocks one and and three; and blocks two and four are connected to each other; then this switches such that blocks one and two, and blocks three and four are connected to each other.

How can I set this? Do I need another logic gate of some sort?

Pardon the lengthy explanation for what might end up being a simple solution.

Yes, too much information to analyze at this stage. Maybe later.

In my opinion You start at the wrong end of the road to go. Why one 298...?

As I think.....
Define what performance You want, what tram control. Soft start/stop, or the toy train type, bang start, bang stop, precise or random location stop positions...
Then take a close look at the needs for tram detection.

I guess the tram itself just contain a DC motor, no fancy digital stuff?

Depending on Your reply different roads would be useful.

Definitely not a toy train type. Did think about adding another sensor at the entrance to a station which would trigger a stepdown of the current with the power going to zero for a precise stop at the stop sensor.

And yes, this is DC, no digital stuff.

Reason for reducing 298N is that in my full loop model I might end up needing three of them in one circuit, with six sets of outputs, with 12 sensors and eight signals. I'm concerned I won't have enough pins even on a Mega!

Is there an advanced H-bridge, beyond a 298N, that can handle more than two motor outputs without the need for multiple 298N?

Daisy chained port extenders should be able to solve issues with pin count.

Hi, @michaelasc pdf.

Tom... :smiley: :+1: :coffee: :australia:

1 Like

You could just use some relays for that.

Got any links to these by chance? If you know of a YouTube video or a forum posting, that would help immensely

I could? I'd be lying if I said I was a relay expert. Happen to know if there is a forum posting on this?

I'm also still interested in and not given up on finding out if there is a motor controller that can handle more than two motors.

TomGeorge - how did you get my pdf to display like that? I like it

In Acrobat there is a snapshot facilty in the "edit" tab.
Use it to copy then paste into Paint.
Then save as jpg.

I would think the CAD you are using should be able to EXPORT image as jpg.

Tom.... :smiley: :+1: :coffee: :australia:

No, but I can make one. :slight_smile:

You can use one power bridge as long as everything has the same polarity. Relays can be used as simple switches to connect/disconnect the output from the bridge, to different blocks. The wiring is extremely simple, just use the relay as a switch. However, if you're using this to control train speed, you can't start or stop them with momentum (slowly).

In traditional model railway wiring terms, you are just making a DC cab control system, but with only one cab. The signalling is a different matter. It looks like you would need a hybrid system with inputs from the cab and track occupancy devices.

The way you've specified this, in a very unique way, you probably won't find any exact examples to copy. Most people now are just using off the shelf controls for such systems, because it's more straightforward and easier to find help.

There is a forum search box at the upper right hand corner of the page.

If you want to do so ( and not with a hard start/stop ), you need a separate H-Bridge for each of the trams. So each of the trams has is own power source which is regulated (with PWM) to control the speed of the trams. You can use relais to connect the according power source to the block(s) where the tram is running.

P.S. what kind of sensor do you plan to recognize when the tram has reached or left a block?

To refine that a little bit, you need an H-bridge for each tram that is running. So for example, you could have 2 bridges (throttles), and multiple blocks. You could have 6 trams, but 4 of them parked on dead blocks, 2 each connected to one throttle (H bridge).

Again, you don't have to look far for the wiring, as it was common between about 1960 and 1990 on almost all layouts - before DCC came along.

Thank you for the clarification, that is of course what I meant.

And there are still layouts without DCC :wink:

1 Like

I have one DC layout. N scale. You can also have a hybrid DC/DCC layout, in fact I'm building my DCC layout that way.

1 Like

I'm planning on IR sensors. Can't use power detection as only running DC.

Regarding relays and a bridge, would the following understanding be correct?

  1. Arduino controls an H-bridge (298N) with two motor outputs
  2. The 298N controls separate momentum and direction for each tram, one going CW (Clockwise) and one going CCW (Counter Clockwise)
  3. If I now take the output from each side of the bridge and feed that in as input to relays, are you saying all I need to do is control the LOW/HIGH states for the relays?

If I do the above, how do I selectively choose to turn on output from one side of the bridge to a block, then later choose to the output from the other side of the bridge to the same block, such that tram1 runs CW over the block, and tram2 runs CCW?

Why not? My model railroad is pure DC too, and I use only current sensors to detect free or occupied blocks. But indeed there are some points to consider.

There are several possibilities. You can use the full H-bridge of the 298 to be able to switch polarity for the tram. Then you need an H-bridge for each tram. By using a releay ( per block ) with two-way contact you can connect each block alternatively to one of the two H-bridges.
Or you change polarity by means of a relay and use each half of the 298 for one tram.

N.B. there are better H-bridges than the old L298.