My Layout... And it's problems

QuinnM Aug 6, 2018

  1. QuinnM

    QuinnM New Member

    4
    1
    1
    So first off I would just like tp introduce my self... Yes I realize that there is a thread for this but I decided just to combine it into one thread. I am a 14 year old who got into trains when every Christmas my grandpa got a out a basic oval track to put around the Christmas tree. In 2012 We decided that in my basement we would build a larger layout. We built the layout stuck a train on it and hey it worked. But it was just track, we added a few accessories (A small train house with a small led, a culvert loader & an unloader). We made plans to get a few more powered accessories as well as locking into getting scale decorations (trees, gravel, etc.). Before we actually got around to this my grandpa's health started declining and without him to push me forward (I was just barely 10 at the time) The project came to a halt. The room that it was in was a multi-purpose room. It was our network room, Gift wrapping room, as well as my robotics room and so the table the train layout was on got used mainly as a storage table meaning even if I wanted to just go down to run it would have taken an hour just to get stuff cleared off the track, so the train never go used. Fast forward 4 years and I decided that I am going to start working on it again. Now with new knowledge of electronics and how things in general work I have decided that I am going to make my own, Raspberry pi based, control system. I have done most of the grunt work (Cleaning up the room, getting the track into a basic working order, and then completely disassembling the current network of power cables the provide power to the track. Now I'm starting on the fun stuff (and the stuff I need the help of this board to problem-solve) So what I am currently doing is running each section of track it's own power line back to the "control station". I am also running accessory power to each switch so it can be operated regardless of track power. Then once I have everything run back to where it is easily manageable in one location on the track I will start adding in the new component. The idea is that I will have a normal electromechanical relay control board for each switch and possibly a solid state relay for each block of track. (1) This is the first problem I hit: How do I use a relay (or some other piece of hardware) to control the "large" amount of track power with the "small" amount of power from a raspberry pi and still maintain the ability to control the voltage (speed) of the train. The next part is direction and sound. I figured out pretty quickly, confirmed by a quick google search, that direction is changed just by a drop to zero in the voltage and then bringing it back up again. (2) The part I can't figure out is how my current train transformer/controller tells the train to sounds its bell/whistle. There is no voltage fluctuation that I could see use a multimeter and it doesn't have Lionel's tmcc controller on board. (3) The last problem I face is the software I love electrical engineering/playing with the hardware but I only know the basics to coding in any language and defiantly couldn't build the software that I have in mind. I would like something that is open-source and low to no cost. And although I'm not ruling anything out because of this, It would be nice to be able to send inputs ( button presses) to the software and have it respond accordingly so that way I could use a traditional interface combined with some form of computer system. I looked into JMRI but I wasn't sure if it would be able to control the relays from the GPIO pins of the pi (just to clarify the whole software doesn't need to be run from the pi it just needs to be able to accept inputs and transmit them to say a pc based system either way works).


    So just as a short recap or for those who don't prefer reading large blocks of text here are the problems I face:
    (refer to numbers in text for more details)
    1. Using a relay/other hardware to "dim" the tracks voltage (not just ON/OFF)
    2. How to trigger the Bell/Whistle function on train using the above method
    3. Software interface for the whole project
    Attached is a photo of the train layout design for anyone interested. I appreciate any help even if they are just untested ideas as I can always research and if nothing else just try it out.
     

    Attached Files:

  2. YoHo

    YoHo TrainBoard Supporter

    5,508
    2,011
    98
    Hi and welcome, I don't have complete answers for you, but I will say this, you're probably looking at an Arduino project more than a Pi project...Or really a combo of the 2...A brief Google search found a combo project that used the raspberry pi to drive an Arduino to control Lionel switches...separately I saw some discussion on Arduinos driving triacs. Which is what you need to control A.C.. so what I think you may want to do is start with that instructables on switches and when you understand those parts, do the research on Triacs and how to get them working.

    https://www.instructables.com/id/Control-a-Lionel-Train-with-a-Raspberry-Pi/


    Sent from my SM-T377V using Tapatalk
     
  3. QuinnM

    QuinnM New Member

    4
    1
    1
    Thanks for the advice. I saw that instructable for the switches as well as I saw a reply on how to use just one relay and I understand that part pretty well. What does the TRIAC do that a relay can't? Relays can control either AC or DC and from what I understand a TRIAC has some leak through voltage.
     
  4. RailMix

    RailMix TrainBoard Member

    1,527
    3,829
    60
    Quinn,
    Can't say as I can help with your control issues as control wise I'm still stuck in 60's with block toggles and such archaic things. However, I will say congratulations on your interest in robotics, electronics and trains when many people your age are totally glued to their phones and video games. Stay curious, keep doing your research and you will come up with an answer. In the meantime, welcome to trainboard.
     
    Hardcoaler likes this.
  5. BarstowRick

    BarstowRick TrainBoard Supporter

    9,511
    5,673
    147
    Your asking an age old question: How does it work?

    Irregardless of the generation your are currently running with you will learn with and from experience the answers you need. One of the answers is it just does.

    Wish I knew more about the generation of trains you are operating, the transformers you are using and the buttons or activators you are using to blow the whistle or horn. It all sounds like old school Lionel and then you are talking about building your own Raspberry pi. So, if I may ask...what's up?
     
  6. Hardcoaler

    Hardcoaler TrainBoard Member

    10,676
    44,848
    142
    You may well be pioneering the technology with O-Scale, which is kind of neat. I like that you have the railroad properly running old school style, so that it doesn't lay fallow while you experiment. Good luck with your development - it sounds like fun.

    I'm building a control panel in N with toggles, LEDs and capacitive discharge circuits for each turnout and block indicators. It's simple stuff compared to what you're working with. I find my greatest frustration is having to order everything by mail. With each learning or enhancement, I order a small batch of test parts, and then I want to improve something else and that spawns another small order, and on it goes. The shipping charges are killing me. Soon though, I hope to have the components finalized so that I can place a big order and move to completion.
     
  7. acptulsa

    acptulsa TrainBoard Member

    3,344
    5,868
    75
    Hi, Quinn! I'm glad your grandfather got you into his old school trains, and I'm glad you still have an interest in them. They are definitely a cool thing. The center third rail may not be something you see on prototypes, but it makes things possible. For example, your layout has two wye tracks. Like reversing loops, wyes are something that requires special handling of the polarity on two rail electric trains. Like a reversing loop, a wye is not an issue with three rail O, because the two outside rails are the same side of the circuit, and the center rail is always in the center.

    If you'll allow me to start a new paragraph so this doesn't turn into a scary block of text, reversing is indeed accomplished by interrupting power. The E Unit has to be engaged for that to happen; the control switch is generally on the top of steamers and underbelly on diesels. The E Unit is a solenoid with a sort of a bucket loader-type attachment that turns a gearwheel. The gearwheel connects or disconnects the power to the motor through brass brushes or wipers, or whatever you want to call that type of contact. It's tricky to turn the E Unit off in the mode you want. If the E unit switch gets thrown while the locomotive is in reverse, it'll stay in reverse. If you turn it off in neutral, the lights will come on but it won't go. It won't even growl. Setting a computer up to work the E Unit is an iffy proposition at best because the things were never 100% reliable. They are supposed to cycle forward-neutral-reverse-neutral-forward, but sometimes they don't, and sometimes they skip a step--straight from forward to reverse, for example, with no neutral in between. They were designed to be operated by something one hell of a lot smarter than a computer--namely, a human being like you, who can see if the locomotive is doing what he wants it to and can push the button again if it isn't.

    If you want to have a computer control train speed, you need to either install something in the locomotive that will vary the amount of power getting to the motor, or something that will vary the transformer output. If you do the former, you need to modify your classic locomotives. They may or may not have much collector value, and any modification will affect what collector value they may have. Since you don't code, you'll have to buy all of that, and it'll have to be specially designed for Lionel's AC power and their hefty amperage. The locomotive controls probably replace the original E Unit, but I don't know that for certain. To do the latter could involve some kind of robotic arm physically moving the transformer's control lever. The advantage there is your grandfather's stuff could serve with few or no modifications.

    The bell and whistle controls do not affect the total amount of power in the tracks. They are specially designed not to, so using them will not slow the train. They overlay enough DC power to operate a relay, and use a diode to reduce either the positive (bell) or negative (whistle) nodes of the AC current. Since you don't code, again the easiest way may be a robotic arm to operate a vintage controller.

    What do you want a computer to do for you? You don't need one to reverse polarity so the train can go different directions. If your switches are Lionel remote control units, you don't need a computer to send the train over different parts of the layout. Those switches can be wired together so when one operates, another operates too. This is another advantage to the three rail system. One rail on each of the two legs of the switch is insulated from the rest of the track (you'll need to use a vintage fiber pin or a modern plastic pin when attaching track to it to keep it insulated). When a train approaches the switch and the switch is not properly aligned, these switches operate automatically. When that switch which is operating automatically, triggered by the approach of the train, is wired to another switch, they both operate. The rest of us pay through the nose and go to a lot of trouble to install optical detectors and wire in computers large or small to get that, and here's Lionel doing it with 1940s technology. With that, you can skip the darned fool computer and get a lot of interesting action just by rolling the train. With the layout in your OP, the train could go around one loop, then the other loop, doing the right hand loop clockwise then counterclockwise, and doing the left hand loop clockwise twice and counterclockwise twice, without you lifting a finger. The train will go around most or all of each loop four times before the pattern repeats. No computer is required to do that.

    You've been busy thinking of ways to teach Grandpop's trains new tricks. But you should stop to consider the old tricks Grandpop's trains have been able to learn for sixty years!

    I strongly believe in wiring each pair of those switches together through a double pole, single throw switch (or, if you can find one, wire both pairs through a four pole, single throw switch). That way, if you want normal operation where you are in complete control, you just turn those switches off and you have it.

    Hope this helps!
     
    Last edited: Aug 13, 2018
  8. QuinnM

    QuinnM New Member

    4
    1
    1
    Hey guys sorry for my lack of response I just got back from being out of town and I forgot to copy the website and my login details...

    Thanks for the encouragement its always welcome!

    Unfortunately for myself it does doesn't really process in my brain... I'm always trying to figure stuff out and if I can't then I research hoping someone has asked the same question as me and if they haven't then I ask them on forums like this one.

    In response to your other question it"s old school just because that was what worked with my grandfathers train so we could share some parts when its not Christmas time. We both have upgraded to FastTrack We just have the TMCC integrated. So I figured why not try to pioneer my own version of TMCC...


    I have a ton of shipping here too. My savior has been Amazon prime free 2 day shipping (barring annual fee which we well make up for in our household) if I can find the part I need. Since my layout is probably a good bit smaller than yours the only real way to test is with the main parts hence all the research before I go buy something. I feel like any time I have free time to go work on it I get down there to it and realize I'm still waiting on a part!

    '

    Sory had to cut your quote because of the 10000 character limit!

    Thanks for the advice. The main reason was to be able to do as much control from aa computer as possible. For example instead of finding which Lionel remote control switch I need I could just click on the switch on a computer displayed diagram of the track. The other big thing is for me I am an tinkerer at heart so for me I would rather have something, albeit slightly more complicated, that I can add onto in the future... say a way to control it from a webpage on my phone or add hall effect sensors that can sense where the train is, how fast it is moving, control where it will go. In the future the idea is that it would be so integrated that my grandpa could connect with a username and password on his computer at his house and be able to control the train and know where it is all from his laptop. or be able to run set loops that will switch the direction of a track, uncouple a car, sound the bell/whistle, operate a culvert loader/unloader all automatically so I can demo it to friends without having to do anything but turn it on and click button. While I do prefer working with hardware I have taken basic intro courses to java and while I certainly wont be programming this all from scratch possibly using a program such as JMRI to start off as will be a good place. In all of this the biggest advantages to a full computer controlled system vs a robotic system are: Expandability, Cleanliness, and abilities. Also in response to your concern of the automatic operation of the switch. This should still work because the only difference is instead of the remote control unit sending the signal the relay connected to the pi will. So the switch itself "won't know the difference".

    Going back to the bell and whistle topic though. How would I go about laying a dc signal over an ac signal? I assume its slightly more complicated than just applying a +/-3VDC to the track while the train is operating but I could be wrong.



    Thanks for all the help and support guys. I think along with this forum and talking to my local "train guy" I should pretty solid footing to start with... Then there is the small problem of school starting Thursday! It's always something.
     
    Hardcoaler likes this.
  9. BarstowRick

    BarstowRick TrainBoard Supporter

    9,511
    5,673
    147
    That's ok. I've tried to wrap my head around a number of things over the years. Got it to work but for the most part I will never understand how DCC works.
     
    Hardcoaler likes this.
  10. acptulsa

    acptulsa TrainBoard Member

    3,344
    5,868
    75
    Actually, with the 022/072 switch with the non-derailing feature, especially when they're wired together, the trick may not be teaching the computer to tell the switch what to do. The trick may be teaching the computer to see what the switch has gotten up to on its own volition.
     
    Hardcoaler likes this.
  11. QuinnM

    QuinnM New Member

    4
    1
    1
    I hope to accomplish both by using the feedback wire that I recently learned send a +/- signal to indicate straight or curved
     
  12. acptulsa

    acptulsa TrainBoard Member

    3,344
    5,868
    75
    You can actually use that for train detection. Program the computer to throw trailing point switches the wrong way ahead of the train, and when the switch accomodates itself to the approaching train, the computer will know where the locomotive is.

    Just be sure you don't program the computer to do something really dumb like throw the switch under the caboose of a long train. It pays to remember that a computer will happily do the most stupid things imaginable if you tell it to.
     

Share This Page