Baby steps toward Märkin CS3 automation

phils2um

Phil S
Country flag
I spent this afternoon putting in two IR train detectors on Track 1 of one of my RR's two stations. The sensor positions still need to be finalized and I need to install another sensor pair on Track 2. I also need to paint the sensor wires and the butt joints where I attached the sensors to indoor/outdoor 4 conductor 22 awg control cable extensions with some black "Liquid Tape". The cable will need to be buried next to the right-of-way too.

Yesterday was spent setting up/debugging the "Events" necessary for the seemingly simple task of having a train slow down, then stop at the station, depart the station on command, transit the loop, then do it all over again. I have to give credit to the author of the "Railway.zone" blog, railway.zone | The German Railway in H0, for explaining how the CS3 event macro "BRAKE" functions. I would have been completely lost without this help. After 'events" have been set up the CS3 lets them be tested without actually running a train. This is very helpful correcting errors in both programming and logic.

In any case, I was able to do some real testing with a train today which was very useful. I got to straighten out some sensor contact assignments and a few other glitches. By the end of the afternoon I had the train departing the station on command traveling around my layout, and returning to the station. I should be able to have two trains taking turns going in opposite directions around my single track mainline as soon as I install the Track 2 IR sensors.

The "Brake" macro makes automatically stopping the train in a station relatively easy without needing to install a brake module and associated isolated rail sections and wiring. This was one of my major automation objectives achieved! The macro uses the braking and acceleration settings in the locos decoder to control slowing and departure. The macro is active, when station signal for Track 1 is "red". It will slow the train to a preset setting when the first sensor is triggered. The speed is set to zero and the train stops when the second sensor is triggered. The train accelerates to its original speed when it is released by a "green" signal. Note that a real signal is not required, I created a virtual signal that gets reset to "red" after the train departs. I've got the "green" triggered by correctly setting the departure turnout for Track 1. At some future point this will be triggered by a second train having entered the station on Track 2.

I've got two more Azatrax MRD8 IR sensor modules and LGB catenary mast bases and wire holders on order to prep another bunch of IR sensor pairs for my other station and to set up block control potential. IR Train Sensors

I'm beginning to think in "train control logic" but have a long way to go!
 
Last edited:
Friday I permanently installed four IR sensor pairs at my main two track station. The sensors are needed to run two trains in opposite directions on my single track mainline. They don't look too bad - almost like actual pieces of RR infrastructure.

IR sensors - 1 (8).jpeg

I decided to put them in with the IR receivers mounted between the two tracks. This should keep me from whacking them with the strimmer. I did make one minor mod to the IR emitters installed in the LGB 10710 (old no. 5071) wire holders. I completely potted the back side of the emitters with epoxy. They'll be covered in snow for extended periods in the winter. Potting the emitter leads should help them hold up over time.

It only took me a little more than an hour to create, debug, and verify the additional "Events" needed to get the trains to take turns running around the RR. This thanks to all the time spent earlier to understand the Märklin CS3 "Brake" event macro. I had the trains in the pic running for about 3 hours Saturday without any glitches. The IR sensors are functioning great. Having the trains take turns running in opposite directions is quite an improvement over watching two or three trains chase each other in the same direction. The way my layout is setup I can manually operate a train doing shunting, etc. in my other station without playing dodge-um with the two under automatic control. (Unless I want to take on the challenge!)

There is one issue with using CS3 events programming the way I am using them. The brake macro and other associated events to make things work are dedicated to specific locos. The events do not track what train triggers the sensors which is a drawback. It is easy to change locos in the events though. There is a dropdown loco menu in the CS3 Events editor.

I got the additional hardware needed to prep a bunch more IR sensor pairs which is my next task. These will be installed at my Guarda Station and be used to create some additional control blocks on the mainline. I also need to spend time understanding how to implement the train tracking algorithm described by Curtis Jeung in the Märklin March-April 2022, Vol. 34 No.3 2 Digital Newsletter.

Edited to correct Newsletter Number No.2 not No.3 and fix grammar errors.
 
Last edited:
Onward and upward! Its been about six weeks since I updated this thread. Just today I have successfully got three trains running automatically on my single main line RR. Two, Trains A and B clockwise and one, Train C counter-clockwise.:party::party::party:

A couple of weeks ago I finished installing 7 IR transmitter/receiver pairs at my Gaurda Station. The Azatrax MRD8 IR detector board and Märklin s88 module are inside the station building to protect them from the weather. Here are some pics showing part of the installation. 1. shows the concrete base for the Gaurda station building partially pulled up. This was done to bring the sensor wires (white) and the Cat6 s88 bus cable (red) into the station building. 2 is a closer look at the 3 northern most sensor pairs and associated wires. The red Cat6 cable runs along side the blocks then ducks into the stream. It is buried beneath the rocks in the stream bed. In pic 3 a slit is cut in the sod to take the Cat6 cable from where it exits the stream bed over to the Schoenweiler waiting room. It connects to the s88 bus in the waiting room. 4. Another look at the slit. 5. While I was installing sensor pairs I decided to put two more, one for each track at the Schoenweiler station. I'm using left hand driving ala the RhB for the dual station tracks. The sensors were placed nearer to the platform. This sensor placement lets me stop short trains without overrunning the station platforms. The first sensor pairs I put in centered 5 to 7 bogie wagon trains at the platforms as seen on the pic in post #2. 6. is another look at one of the added Schoenweiler sensors.

1 . Gaurda s88 - 1.jpeg 2.Gaurda s88 - 1 (1).jpeg 3.Gaurda s88 - 1 (2).jpeg 4.Gaurda s88 - 1 (3).jpeg 5.Gaurda s88 - 1 (4).jpeg 6.Gaurda s88 - 1 (5).jpeg

The next series of pics illustrate part of what took me awhile to figure out. Due to the limited length of the run-around at my Gaurda station, pic 7., I need to pull long CW trains past the shed spur turnout, pic 8, then reverse the train, backing into the shed spur, pics 9 and 10. This clears the main for a train meet with the CCW train, pic 11. The CCW train pauses briefly at the station then continues on to the Schoenweiler station. Once the way is clear, the waiting CW train A releases to Schoenweiler in the opposite direction, pic 12. CW train B, which was waiting at Schoenweiler is released southbound to Gaurda once the CCW train gets in the Schoenweiler station. The CCW train waits until CW train A arrives from the north. Arrival of CW train A releases the CCW train to meet the CW train B and repeat the process at Gaurda. This works because the rail travel distance between the Schoenweiler and Gaurda stations is about 5 times longer when Gaurda is approached from the CCW direction as compared to the CW direction. There is plenty of time for a CW train to reverse into the shed spur at Gaurda before the CCW train arrives from Schoenweiler.

7.Gaurda s88 - 1 (6).jpeg 8.Gaurda s88 - 1 (8).jpeg 9.Gaurda s88 - 1 (9).jpeg 10.Gaurda s88 - 1 (10).jpeg 11.Gaurda s88 - 1 (11).jpeg 12.Gaurda s88 - 1 (12).jpeg

If this sounds confusing, you can understand why it took me a couple of weeks working :banghead::swear::banghead: off and on to get it functioning! Only some minor tweaks remain to really smooth it out. I created six "Events", two for each train to get this working.
 
Last edited:
Can't say I fully understand the workings, but the events speak for themselves.
 
Spent most of yesterday afternoon playing with observing and fine tuning the "Events" to run three trains mentioned in Post #3. I've got them running rather nicely now.

I still need to learn more about how the conditional "IF" macros that are available for CS3 Events programming do their branching. Meanwhile, with what i've learned so far and the IR feedback sensors I've got installed at the stations, I was able to quickly cobble together a single train automation that slows and stops at each station before continuing on. I'm about to set this in motion while I pick fallen leaves out of my streams. We've had some beautiful Fall days this week begging to be taken advantage of.
 
Back
Top