N-Scale Adventures: Automation

While I haven’t been able to make enough progress on any single project and have enough to actually write post about, I have been busy with many little projects all at the same time. One of those projects is to work on automating the Model Railroad layout. Once I get some warmer weather, so I can spends time in the unheated garage, I’ll start getting track fixed and putting in the framework for scenic break in the form of a mountain ridge.

One of the things the ridge will do is “hide” a long siding where we can “park” a second trian running the opposite direction, or have a single train just hang out there providing a time delay – like they have gone miles before returning to the front of the layout. While this allows for cool running, opportunities to build mountains and make tunnels, it also means not having an easy way to operate the two switches used to make the passing siding. Enter remote automation.

After much YouTube surfing I stumbled upon the DIY and Digital Railroad model railroad channel. Jimmy has lots of good stuff and quite the playlist devoted just to Arduino and Arduino based projects (all related to model railroading, of course). I borrowed heavily from his sketch that he designed to switch multiple Kato switches. I want to use push buttons to operate the switches on the layout instead of the ginormous lever switches Kato sells to thrown the points remotely. Mostly because doing stuff yourself is way cooler and it gives me the opportunity to learn something new – microprocessor coding.

The basic design is to use an Arduino board (I prototyped on the Uno, but have move the programming to a Nano to save space, and they are half the price!), to send instructions to a dual motor driver board, which send a half second burst of power out to the electromagnets in the switch, which pulls the points to either the straight or the divergent route. Jimmy designed the code to operate two then three turnouts on a very small layout, so it just throws the points and that’s it, you have to visually make sure the switch is switching the direction you want to have the trian take. I added some small bits of code to have an LED light up depending on which route the switch is facing. Once I deploy these on the layout, the LEDs will be placed on a schematic of the track and the LED will visually tell you which route is chosen.

At the present time I can get it to work once you cycle through a button push, which is fine once you’re running, but I want it to tell you which way ’round the points are at start-up. That is taking me down some coding rabbit trials. Even if C++ language existed when I was in college, it would only help me slightly, as Arduino IDE language is loosely based on C++, but only has two required functions, Set_up and Loop. Set_up only runs once, then the Loop function, well loops until you re-power or reset the board. So I know I need to read the initial setting of the switch in the Set_up, but the “state” of the switch isn’t determined until the Loop! So more fiddling with code and prototyping on the kitchen table continues.

Anyway, just a quick post this weekend to keep from the blog going dark. Oh yeah, I did start a Hobby YouTube channel as well, it’s about a video a week since January, other than the “Hello” intro and a “Rant” video after my favorite football team benched my favorite player. If you care to feed the algorithm here is a link. Mostly Railroading stuff, but some scale models as well. If I can figure out how to film and paint at the same time, maybe some of that, but nothing you can’t read about on this here blog – other than the video footage of little trains running in circles!

Advertisement

12 thoughts on “N-Scale Adventures: Automation

    1. FORTRAN, Pascal and VAX Assembly were my Java back in college days (1983-87!), so critically thinking through the code, yes helpful, actually writing the code, not so much.
      At this point I’m going to add two additional switches to the code and see if I can get a second set running from one board. if so, then start adding them to the layout for functionality , and see if I can “fix” the code off-line. If I can get it to work I can always upload the new code without unwiring the whole lot!

      Liked by 2 people

  1. To piggyback on what Guru PIG said (no pun intended!), I think you have a great voice for Youtube and I enjoyed watching a couple of your model train videos as well. I can’t say I knew much of what you were talking about but the videos are well done all the same πŸ™‚

    Liked by 3 people

    1. Thanks! No-one like hearing their own voice, it never sounds like you hear it. Plus I had thought I had lost much of my Philly accent, but it’s there, not really hard, but it’s there.
      I’m going to try for one shunting puzzle a month, as long as they don’t get too boring. And there will be some scale model stuff, just not the best as filming assembly and details – yet!

      Liked by 3 people

      1. I didn’t hear much of an accent but I’ve never been to Philly either so I could have missed it. I imagine the Philly accent sounds belligerent but that is primarily based on their sports fans πŸ˜‰

        Liked by 3 people

  2. Brilliant Ec ! It was interesting seeing the build after I had just viewed your last post on the plane, great to actually see how you did it. Totally agree with Kuribo, you voice is very clear and your accent isn’t like I would imagine, not that I’m an expert on American accents. When I hear my voice I just shudder Ha Ha !

    Liked by 2 people

  3. I was just telling the girls about voices and how one imagines someone you follow would sound like and as an example had them listen to your you -tube show< well my daughter said "that the perfect voice on e needs for pod casts" , so well done mate I can see fame coming you way!!

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.