Train Automation for Station Stops.

Massey Nov 27, 2022

  1. Massey

    Massey TrainBoard Member

    2,018
    6,526
    58
    I just finished designing and ordering a circuit card for automated train control. I took cues from my tram layout and decided to make a single board version. It’s still powered by an Arduino like before but this time it’s designed to be powered by a PS14 and it will have speed control. It will use IR sensors just as before, and you will be able to select how many stations per loop.

    One limitation to this version will be it won’t allow a linear line unless it is programmed into the Arduino directly. I will be working on making a version that will allow it, and it may be able to be done with this version, with creative programming. I’m planning on making it so the user can choose between linear and loop with just the flip of a DIP switch. Thinking about it now, I can free up one of the DIP Switches I have on the board as this device will need at least 1 sensor minimum to work, so I can just not write a switch function into that part of the sensors script. I may be on to something there! Anyway I will post more about it as I get the parts in, the boards have been approved, it will be at least a week before I see them.
     
    Mark Ricci, nscalestation and Sumner like this.
  2. Massey

    Massey TrainBoard Member

    2,018
    6,526
    58
    So I changed devices and now I can show you some of the new device.

    Here is the layout of the board.
    Screenshot 2022-11-26 at 9.01.34 PM.png


    The Arduino that it needs is just the standard Arduino Nano.
    ARDUINO_NANO_03.png

    And the IR sensors are the basic all in one type. I decided to use this type over the smaller ones that just have the LEDs and 2 resistors to make the main board much simpler. With this IR sensor the sensitivity is adjusted on the sensor itself, and all supporting circuitry is already there. These are not too much more than the other type and I think overall this type will keep the costs down.
    IR Sensor.jpg

    The eventual plan is to move the board to have it's own microprocessor and all supporting electronics on the board. There will be DIP switches to allow the end user to choose options such as number of stations, loop or linear, and maybe someday multiple lines. The Nano is being used almost to it's maximum on this version of the board.
     
    Mark Ricci, nscalestation and Sumner like this.
  3. Massey

    Massey TrainBoard Member

    2,018
    6,526
    58
    So I got some free time to start writing the code for the board and I discovered 2 things. One, I forgot to run 2 traces from U2 to the Arduino… oops. I guess I need a revision… but then as I’m going through each “mode” I’m planning I discover I don’t even need U2 at all. I don’t know what I was thinking when I thought I needed 4 motor channels. So my missing the 2 traces was actually serendipitous. I still need a revision removing the extra chip, and I think I’m going to add a pot for adjusting the stoping delay. Right now the delay is going to be a random time from 3 to 7 seconds, just like my tram layout.

    So let’s talk about my modes. I’m planning 4 modes.

    Mode 1: loop mode with 1 to 4 stops
    Mode 2: linear mode with 2 to 4 stops, and the train will reverse direction at stop 1 or 4. Stops 2 and 3 are optional.
    Mode 3: loop mode with 2 lines. Sensor 1&2 tied to M1 and sensor 3&4 tied to M2. A single sensor can also be used.
    Mode 4: linear mode with 2 lines. Sensor 1&2 tied to M1 with the train reversing direction at the stops, and Sensor 3&4 tied to M2 with the train reversing at the stops.

    The DIP switches will control the modes. Speed at the moment will be the same for M1 and M2, but I think I may want to make independent adjustments for that. With U2 removed that will free up the necessary pins to do that. Imma test this version and debug it before ordering the next version.
     
  4. Massey

    Massey TrainBoard Member

    2,018
    6,526
    58
    It’s been a while since I played with this, but I had some time tonight so I decided to give it a go. I got everything soldered on, discovered a PS14 won’t fit the power socket I went with, and when I tried to power it up with a different power supply, it failed the power up test. This could be a couple things, but I didn’t have a meter in the house to test. I will fetch my meter or O-Scope tomorrow and test for the power. I’m thinking that it could be the voltage regulator not liking the 9v power supply when I picked the one I did because I was expecting a 14v unit. Again, more testing tomorrow when I can get to my test equipment without freezing.

    Anyway here is a pic of the assembled board. 77017762-4E72-49B9-BA1C-4816A3FD1308.jpeg

    Oh, and U1 is missing because of reasons I mentioned above. I said U2 above but it was U1 that wasn’t fully connected. The final version will only have 1 motor driver anyway.
     
    Mark Ricci likes this.
  5. DCESharkman

    DCESharkman TrainBoard Member

    4,408
    3,103
    87
    Looks interesting, I might want to try that on one of my NTrak modules that has a three track station.
     
    Mark Ricci and Massey like this.
  6. Massey

    Massey TrainBoard Member

    2,018
    6,526
    58
    This is just a prototype version, I already have a new and possibly a production version designed but I didn’t want to order the boards until this design has been proven first. The production board will allow speed control for both lines independently, and an adjustment for the stop delay instead of that being hard coded. So we will see how it goes. I’m hoping to get a kickstarter going to cover the costs of building the boards once I get them to a production level. I don’t want to use the kickstarter funds to develop the board as I have seen too many fail at the development stage, and then no one gets their promised items, I will deliver and I’m close to getting a production board going.

    Eventually I want to build a board that has its own microcontroller, instead of an Arduino onboard. I currently lack the know how to make this in that fashion, but I have been learning.
     
    Mark Ricci likes this.
  7. Massey

    Massey TrainBoard Member

    2,018
    6,526
    58
    So I figured out the power issue. The point on the plug that the data sheet called ground isn't tied onto the negative side of the plug, so it simply wasnt getting power anywhere. Problem solved, a jumper fixes this and we now have power. I wasn't able to test any further tonight, maybe I will get to tomorrow, we will see.
     

Share This Page