I have been told that you may have products available to help me with this project. This is what I want to do: I would like to build a single line of HO scale model railroad track and have the "train" go back and forth upon reaching the end of the track. I would also like to be able to control the speed of the "train" by using a DC power controller that is standard for DC model trains. If someone can help me, I would appreciate it. If you need additional information, feel free to reply to this or contact me directly at maassmi@comcast.net and use "model train project" in the subject line. If you know what I need and how to put it together, I would really like a reply in either location. Most of the "devices" that currently exist on the market cost over $50 and I know that the individual electronic parts on eBay would cost under $20 plus shipping. So any help would be greatly appreciated.
Is the power to the train engine determined by power from the rails or are you using some sort of DCC to control the train?
If you're just controlling the power directly through the track then there are a variety of ways you could control the train direction and speed. The first method to come to mind is some sort of h-bridge circuit.
Do you know how much current the train requires? What voltage does it use?
I've often thought of implementing my own sort of DCC but instead or using the track to send the data, I'd use the inexpensive nRF24L01+ modules and use wireless communication.
For what you describe an Arduino and an Arduino motor shield will do the job.
But you will also need to find a way of knowing when the train reaches EACH end of the track.
Mark
As @holmes4 said, an Arduino (Uno) and a motor shield are what you need. That will allow you to reverse the train and adjust it's speed. You can even control the direction and speed automatically in a program, no train driver [engineer] needed, but for that you will need to know where the train is on the track.
There are several different methods of train detection, all applicable to the Arduino Uno, and you will find people on this forum who support each of the different ways to the exclusion of the others. If you're interested, lets us know and we will tell you more.