Train Projects  

  RSS

teddy
(@teddy)
Eminent Member
Joined: 5 months ago
Posts: 34
2020-01-07 7:51 pm  

How about a Train Controller with an Arduino!  It would have to have Voltage Control & PWM.

This topic was modified 3 months ago by teddy

Quote
Topic Tags
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 10 months ago
Posts: 466
2020-01-07 8:39 pm  

Now you're talking!

Back in the early '90s, I build an HO gauge layout in my basement on two 4x8 pieces of plywood. Made mountains, tunnels and a lake that nearly asphyxiated everyone in the house when I poured the liquid plastic for it.

No Arduino's back then, so I controlled it with a 6502-based controller that I designed and programmed using my Apple II (still my very favorite computer). Mounted hall-effect sensors (salvaged from an old keyboard) under the tracks and magnets on the bottom of the engines to determine where the trains were.  Used PWM to drive the trains.  I built it for my son and occasionally I'd even let him play with it!

I'd do a model railroad controller in a heartbeat - if I only had a model railroad!  Sadly I don't, I don't have space for one and I have a lot of other irons in the fire at the moment.

But I still love the idea, even if it's unlikely I could ever do it without an actual model railway to control.

 

"Never trust a computer you can’t throw out a window." — Steve Wozniak


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1604
2020-01-07 10:21 pm  

Since the topic has come up I'd like to share what I started, but may never finish. ? 

It's a long story so grab a cup of steam engine oil and get comfortable.

I  have quite a few Garden Trains or "G" gauge as they are often called.   I wanted to set up a huge layout in my front yard.  Sadly outdoor G-scale track is not cheap.   For the layout I would like to build it would cost over $1000 just for the track alone.  I looked into the possibility of manufacturing my own track from aluminum bar stock as the rails.   There were two problems with this.  First just the aluminum bar stock would still be quite expensive at about $500.  Then I would need to fabricate all the track on top of that.  Including making ties and roadbed, etc.   There were also major "warnings" by other Garden Train experts that using aluminum track is not a good idea for outdoor use and that brass is far superior.   So they were telling me not to cheap out on the track.

Well, $1000+ dollars just for the brass track was simply not an option.  I was about to give up when I got an email from a Garden Train hobbyist in England.   He advised me to give up on using metal rails entirely.  Yep that's what he said!   He said that he uses homemade wooden rails.   And he runs the trains using onboard batteries instead of trying to electrify a complex track layout.  He says that this actually has a lot of benefits, which I could instantly see as well.  He also shared with me photos of his layout and explanations of how he constructed it.  Unfortunately all that information has since been lost due to a hard drive failure.   I don't even remember who the guy was or how to contact him anymore. ? 

This all happened quite a few years ago.

That's not the end of the story though.   I decided to go for it and build the wooden track and convert my trains over to being battery-operated.   So I set out making a lot of designs.

Here are some of my Sketchup Drawings of my designs for homemade wooden track:

All Pics

And here is my design for a special router jig for cutting the rail groove on homemade turnouts.

Turnout #1

Turnout #2

I actually did some work toward this dream. 

I cut down an oak and cherry tree and made them into lumber on my sawmill for the roadbed, ties, and rails.  I even cut up a bunch of railroad ties that I have in a box out in the wood shop.

I bought the router for making the track grooves. ? 

And I have some G scale steam engines sitting on my kitchen table waiting to be converted to battery power.  They been waiting a very long time!

Originally I was going to do the whole thing with Raspberry Pies onboard the trains.   Originally I was going to use rpi A+ boards, but they were kind of big to be trying to fit inside the trains.   Then I was thinking of using an STM32 Blue Pill as the microcontroller and RF link to the trains.   Lately I've been thinking of using Pi Zeros as the "Train Brain". ? 

Whatever I used I was going to ultimately control all the trains via WiFi connections using a Notebook computer that would orchestrate the activity of the entire layout.

~~~~~~~~~~~

So there you have it.  Yet another unfinished dream sitting around waiting for some human to bring it into fruition.   Since the locomotives are sitting on my kitchen table I dream about this model railroad everyday.

Apparently I'm content with just dreaming about it. ? 

So there you go.  A long-winded story of a dream that has stalled on the kitchen table.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 10 months ago
Posts: 466
2020-01-08 9:52 pm  

I'm moving this over to the Model Railroad area, it was a GREAT suggestion but sadly I would need to have a model railway myself to carry it out.

Robo-Pi - all I can say is "wow"!

"Never trust a computer you can’t throw out a window." — Steve Wozniak


ReplyQuote
toolmaker
(@toolmaker)
Active Member
Joined: 2 months ago
Posts: 10
2020-03-17 2:37 am  

Hi Trainiacs, I have been looking at a tutorial that uses Arduino Mega and a REV3 shield to make a DCC base station for train control. I have 2 spare L293 driver boards in my bits draw. Can they do the same as a REV3.

Cheers

Steve


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 4 weeks ago
Posts: 11
2020-03-21 10:47 pm  

@robo-pi

I have a garden railroad with about 700 feet of track. I started with stainless steel track, but that has become very expensive. I changed to aluminum rails. They have been no problem. They are not as strong as stainless steel, which you can walk on, they get easier dirty. When you change to aluminum you have to run your train on batteries, and remote control. If you run on track power you will have to clean your track  constantly, instead of running your trains. I have the aluminum rails now for several years without any problems


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1604
2020-03-22 1:07 am  
Posted by: @runutral

When you change to aluminum you have to run your train on batteries, and remote control. If you run on track power you will have to clean your track  constantly, instead of running your trains.

Once you move over to battery operated trains there's no longer any need to have the rails made of metal at all.   Even aluminum rails would still cost a bundle.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 4 weeks ago
Posts: 11
2020-03-22 11:35 am  

@robo-pi

No, do not have to use metal at all. However, making rails from wood for a garden railroad introduces new problems. Wood is rotting over time , even treated,  and it warps, which gives derailments. Probably making it from some kinds of UV resistant plastic would be a good alternative.


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1604
2020-03-22 7:34 pm  
Posted by: @runutral

No, do not have to use metal at all. However, making rails from wood for a garden railroad introduces new problems.

I agree there are many pros and cons to it.   Using UV resistant plastic would no doubt be a solution that would last far longer.   I also haven't tested how much traction the metal wheels of the locomotive would have on wooden rails.  I do know that if the wood gets wet traction can disappear completely.  So no running trains on wet wooden tracks.   But then again, I wouldn't have any desire to run my trains on a rainy day anyway.

I certainly wouldn't recommend using wooden tracks to anyone else.   For me there are the following incentives to try it.

  1. I'm an avid woodworker.  So I'd like to make it out of wood just for the sake of doing it. 😊 
  2. Cost-wise it's next to free.  Especially since I have more lumber than I know what to do with.
  3. It's true that I would need to actually cut the rails, but that process can be done quickly.
  4. I would still need to make the roadbed and ties even if I used something else for rails.
  5. I'm designing the wood rails so they can be easily replaced.  Either with new wood, or other materials.
  6.  Finally, and perhaps most importantly. I kind of want to do it just to say "I did it my way". 🤣 

If it works at all, I would imagine it would be the talk of the MRR community.   Pros and cons, likes and dislikes, would be profuse.  And my railroad would be the focal point of that controversy.  If I do something average or expected I'd just be an "unknown" for the rest of my days. 😮   Although, that's probably the wisest path to take if I want a long-lasting MRR.

Sometimes being the focal point of controversy can be more fun, even if it's short-lived. 😎 

Besides, I'm already 70 years old, so the MRR won't need to last very long anyway.   If it lasts just one summer I'll at least have videos of it running, along with tons of photos I can get out to show people what once had existed. 

Bottom line:  I'm actually more interested in experimenting than building a MRR.   Although, lately I've been focusing on robotics, to the model railroad has taken a back seat to robots.   I have (5) G scale locomotives.  All are old-fashioned steam engines style.   Two of them are sitting on my kitchen table waiting to be converted over to battery power remote control.    I actually have all the electronics required for the conversion.  I just haven't done it yet.   I would do that first before making any wooden track.  I have a bunch of indoor metal track that I have fastened down to long roadbed boards.  I take it outside and set it up in the yard during dry spells in the summer.  It sets up fairly quickly, and disassembles just as quickly.  I take it down when it's going to rain.

By the way, when (if) I ever build the wooden track, I'm going to build hinged covers for it that I can just flip over it when it's going to rain thus keeping the track from being rained on all the time.  The entire planned track layout will all be elevated about 2 to 3 feet above the ground.  I actually have the entire layout drawn up.

If I bought commercial made brass track for it it would cost close to $5000 just for the track.  That's out of the question.  If I made my own homemade aluminum track I could squeak the cost down between $1,500 and $2000.  Still too much, plus I would still need to build all the ties and roadbed, etc.

Wooden rails would cost me $0.00.  That's just too inviting to pass up. 😎 

Of course, as you suggest, plastic rails would probably be pretty darn cheap too.   What I would do is make some wooden track first, and just see how that works.  If it looks promising I'll just continue with the wood.  If not, then I can switch over to plastic rails at that time.  Everything else would be the same, the only part that would need to change would be the rails themselves.

So anyway, the whole thing is just an experiment in woodworking.  Not a recommendation for MRR. 

Think of it as a wood craftsman pushing the limits of artistic woodworking.

That's better than thinking of it as an idiot model railroader. 🤣 

Gotta put things in their proper perspective. 👍

But yeah, you are right.  From a practical perspective plastic rails would be more reasonable.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 4 weeks ago
Posts: 11
2020-03-22 9:37 pm  

@robo-pi

It is always worth a try. Making the ties is not that difficult just cut wood in small strips and cut those in the length you need use spikes to attach the rails to the ties. I make all my switches that way, but use stainless steel or aluminum for the rails. Plastic would make it easier to make your curves, because they would not break when you bend them. I use for the regular track uv resistant plastic ties. I use a double rail bender to make any curve I want.


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1604
2020-03-22 10:32 pm  

@runutral

Thus far everything I've done has only been done on the drawing board.   But this also includes designing special jigs and tools for making the track.   In terms of the actual track I have cut lumber for the "roadbed" part of the track.  This is what I will fasten the ties down to.  I also cut a lot of blank stock for making the ties.  I have them in bundles of about 1/2"  x  1/2" square blanks about 4 feet long.  They will then need to be cut down to actual ties that are only about 3" wide (or whatever it comes out to be in proper scale).  Although I'll be making the actual ties quite a bit heftier than what an actual scale tie would be.   I'm not worried about keeping everything to scale.   I'll be using a lot 1/32 scale model cars for layout scenery.  So these trains will be quite a bit larger in comparison with the cars.  But I think that will be alright.  At least it will be consistent throughout the layout.

The first thing I need to do is get the engines battery-operated and remote controlled.    This has really been the hold up.  I keep putting it off.  Although I have done quite a bit of work in that area in terms of setting up software to control them.   I've decided to go with Raspberry Pi  Zero W boards for the remote control and run the trains from a notebook computer via WiFi.  They can be fully automated this way by writing a program on the notebook to control the trains.  It will be full two-way communication so the notebook can get feedback from the train concerning where the train is at on the layout.

In terms of track, my first goal will naturally be to make some long straight sections.   I'll probably make those about 8 feet long.   And the second goal will be to make the curved sections to finally  make a large oval.  Then once that is up and running and I can see that it's actually going to work I can then move on to making the more complex layout with turnouts.

By the way, I plan on using all "Stub" turnouts.  With no moving parts or tapered points.  Of course there will be a moving part, but that's basically an entire track section just moving very slightly to the next rail position.  I'll have the main line be the track that moves and the actual turnout will remain stationary.    I'm thinking this will be the easiest to design and build.  It also won't require tapered rail points which could be a problem for wooden rails.  

I'm also thinking that the ends of the wooden rails that actually serve to do the turnout work could be reinforced with with metal ends, or maybe just some sort of epoxy use to strengthen the ends of the rails.

As I say, it's all in the dream stage at this point.  And actually has been for a while.  Some work at been done toward it, but at this point there's nothing operational to show for it.   I really need to convert the engines over to battery power and remote control.  If I can get off my lazy behind and get that accomplished then I would be far more motivated to go out and build some actual track. 😊 

So that's really where I need to start.  I have the engines sitting on my kitchen table which has become a make-shift MRR workbench.   But they keep getting shoved aside so I can eat dinner. 🤣 

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1604
2020-03-22 10:39 pm  
Posted by: @runutral

When you change to aluminum you have to run your train on batteries, and remote control.

By the way, are you currently running your trains on batteries and remote control?

I'd like to hear how you converted your trains over.   I haven't even taken my engines apart yet.  I'm thinking of putting the Raspberry pi in the tender.   Not sure where to put the batteries yet.  I would love to have the batteries in the engine case itself to make the engine heavier.  But I have no clue if I can fit them in there?

If I keep talking with you I'll end up working on these things. 🤣 

Today I've been working on researching a Text-to-Speech engine that I'm using on a robot A.I. project.  That alone looks like it's going to become a time-consuming project.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 4 weeks ago
Posts: 11
2020-03-22 11:25 pm  

@robo-pi

I have my trains on two commercial systems for battery and remote control. One system is the Airwire 9000 system, others are on the Crest system. At the moment I am working on changing the Airwire system for one of the locomotives into an Arduino system. As I stated in my introduction post that I am working on a locomotive that runs a switching program that runs by itself. As for starters I am using an Arduino nano, and a cytron MD10c and a nrf24 system into the locomotive. The remote will be run by an Arduino mega and nRF24. In one of Bill's video's he was using two Arduino uno's and NRF24 and Cytron MD10c to drive remotedly a set of large motors with a joystck That will be my starting point for my hardware, Than writing a porgram for the Arduino meega that makes it possible to let the switcher do the program without any manual input, I would not use a joystick There are a lot of things that have to be sort out, things like what is the given input to the program and what kind of sensors are being used to signal where the loco and cars are and there movement. Lots to sort out. Probably I have specific questions along the way for the forum.


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1604
2020-03-23 12:22 am  
Posted by: @runutral

As for starters I am using an Arduino nano, and a cytron MD10c and a nrf24 system into the locomotive. The remote will be run by an Arduino mega and nRF24.

Yes, that's a good system.  You should be able to do anything you want using that set-up.

I decided to go with WiFi and a Notebook computer because I like programming in C# as it provide access to the entire Windows Forms GUI interface.  😊   So it can not only control the railroad but it can even graphically display a model of it on the screen. 

As far as the actual programming is concerned, that's an area that I am very much experienced with.  Where I get lazy is in the actual mechanical build.

Where do you store the batteries on your trains, and what type of batteries are you using?

Also do you have any photos of your G-scale projects?

You have me wanting to disassemble a locomotive now to see if I can squeeze any batteries into the loco itself.   I'm guessing maybe not?  If that's the case I might just add lead weights to the engines to give them more traction as they will need to be towing a train filled with batteries.

By the way, all my trains are just cheap Bachman trains.  Nothing fancy here.   I bought these a very long time ago at a flea market for dirt cheap.   And then I got some more given to me over the years.   I think I have at least 5 sets, plus some extra cars.  I might even have more than this, I can't remember. 

I know I have two of these Silverton flyers.

 

And two of these Liberty Bells along with a couple extra coaches.

 

And one Royal Blue set

As I say, these are all cheap Bachman trains.   I think I only paid $30 a set back when I bought them.  They retailed for about $100 a set.  I see them today going for anywhere between $200 to $300. 

Maybe I should just sell them all and run with the cash. 😎 

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Runutral
(@runutral)
Active Member
Joined: 4 weeks ago
Posts: 11
2020-03-23 11:27 am  

@robo-pi

I use Airwire batteries, It depends of the type of loco and the number of motors to use a 14,8 or 18 v battery. It looked that your loco's will do fine with a 14.8 v one. Most people try to get them in the tender. I have bought them from reindeer pass. They also sell the harness for charging them as well as the chargers. Good service and good advice from them. You need different chargers for different volt levels. If you buy batteries make sure they have charge protection on them I have some video's that I will post later.


ReplyQuote

Please Login or Register