You're reading ...
Traincontroller

Traincontroller 42 – Loading Wagons Using a Sensor

In the previous video we simulated wagon loading by advancing the train one wagon at a time, based on a fixed speed during a certain amount of ms. This works well if the engine runs stable at low speeds and if the number of wagons in a train does not change throughout a driving session.

If one of these conditions is not met, we can use a sensor to detect the wagons. This could be a light beam that detects the gap between the wagons, or a reed switch on the track combined with a magnet under every wagon. The end of the train is assumed if no new wagion is detected after a given number of seconds.

The macro that advances the engine has the following code:

1. Switch the ‘Loading’ switch on.
2. Label ‘Next’. This is the point where the below Goto in line 7 jumps to.
3. Increase the wagon counter.
4. Engine speed 6.
5. Delay 00:00:15:000. Total time for advancing plus loading.
6. Prerequisite on/off switch ‘Loading’. If not end of train, execute the goto statement.
7. Goto label ‘Next’. Jump back to the top and repeat the sequence.

The sensor is given an Operation that stops the train. Furthermore we use 2 flagmen to detect the end of the train. The first Flagman is the ‘Timer’. It triggers when the detector sees the gap between wagons and in its Memory tab it is put on ‘Timer reset’ after a given number of seconds. Be sure to set the tick mark at ‘Forced Reset’. The second Flagman is the ‘End of Train’ flag, it is triggered by the Timer Flagman’s reset, with the conition that the sensor still sees no new wagon. In its Operations we turn off the ‘Loading’ switch, which means the prerequisite in the macro is no longer true and the goto statement is skipped … this ends the macro.

 

..

About RudyB

Hobbyist

Discussion

11 thoughts on “Traincontroller 42 – Loading Wagons Using a Sensor

  1. Hello Rudy

    I first off want to thank you for your series on Traincontroller and other associated projects. You have helped me automate my railroad to the delight of all who visit and “push buttons” and watch the show.

    I was wondering if you have made use of the +4DSound and perhaps interested in creating a series on that subject?

    Regards
    Kevin Wagner

    Like

    Posted by Kevin Wagner | January 3, 2017, 03:52
  2. hello mate
    i wonder if you can help me out i am running TC gold version and i have a trainset with 5 tankers and a loco
    i can uncouple the front and rear tankers ok

    what i am trying to achieve is uncouple tank number 3/4/ but i cannot get TC to do it
    TC will only uncouple front or back
    can you help please

    Like

    Posted by Alan | December 1, 2016, 20:16
    • I have no idea … maybe you can post on the Freiwald forum and someone knows how to get this done.

      Like

      Posted by RudyB | December 6, 2016, 11:27
      • Hi Rudy
        I am new to DCC and a complete beginner to the hobby, currently working on a layout design. I have decided to use the ECoS system and now based upon your video training on TC will be using this system and ditching Itrain.
        My question is, which ver of TC should I use. Bronze Silver or Gold.
        If I used Gold your info would make it easy for me to follow. Happy to discuss your thoughts and ideas and happy for all advice as a beginner eager to learn.
        Meant to ask if we could mail regarding layout bus wires using ECoS.
        Kind Regards
        Allan

        Like

        Posted by Allan Alexander | December 19, 2016, 22:25
      • Allen, I sent you an email. Feel free to contact me with any questions you may have.

        Like

        Posted by RudyB | December 21, 2016, 12:33
  3. Hello Rudy. I have followed all your videos on TrainController with great interest and have found them invaluable in setting up and getting the best from TC gold. you haven’t posted one for some time and would like to know if you are going to publish any more.

    Kind Regards
    Peter

    Like

    Posted by Peter Oates | September 26, 2016, 15:08
  4. Hello Ruud I hope things are alright with you. I found your website about a week ago and have been going through your tutorials, on T.C. in order. I am now on number 19 and things are getting exciting, I make notes as I watch them, and they seem to get longer which is good because I am learning. I have T.C. Gold for my layout which is currently in a room 14 ft x 12 ft but am extending it into the next room! My Son is a computer software designer but unfortunately I am still learning computer skills. He does not have the time to teach me, with family commitments, so I am trying to learn myself. I personally find the manual very difficult to understand and your tutorials have been excellent. May be I can master it on my own with your help! All the best Steve.

    Like

    Posted by Steve | July 30, 2016, 20:41
  5. Hello Ruud, Just to say Thank You for another excellent video on the subject of ‘traincontroller’ I have been following ALL you videos on the subject and quite often when setting up my system I will have the manual open at the appropriate page along with your video, It has been a great help to me, Thank you and keep up the great work.
    Regards John (Jan) Oxford

    Like

    Posted by John Oxford | May 31, 2016, 08:18

Leave a comment

Archive of all posts