Magnetic Speed Control of Trains

3,994

13

15

Introduction: Magnetic Speed Control of Trains

About: I am an author and a maker. My current project is Santa's Shop. I'm working on a science fiction type book--more later. @EngineerRigsby

For "Santa's Shop," an animated Christmas display window (https://www.instructables.com/id/The-Story-Santas-Shop-2016/) getting multiple trains to start and run (not too slow and not too fast) is complicated by the fact that everything must start, run and stop at night (controlled only by a master on/off timer switch). The business (not mine) allows use of their window, but I can only access it during business hours--and not make too much noise or disturbance then.

Using two hall effect sensors (and a magnet on the train), an Arduino can sense speed and adjust the voltage up or down to stay in a desirable range. If the train is "stuck" (dirty track, rollers--train needs oil), the Arduino can sense this (no sensor activity for 15 seconds) and give a full voltage start up jolt for one second, while gradually increasing the base voltage to get it running until I can get in to service the system.

I used a 3d printer to create the brackets that hold the hall effect sensors.

Supplies

PARTS:

Arduino Uno

Two Hall Effect Sensors

Motor Speed Controller

16 volt dc power supply

USB power supply and cable

Breadboard

Wire

Heat shrink tubing

Solder

Magnet

Wood screws

Four 3mm screws (6 mm long)

Step 1:

I secured the hall effect sensors using 3mm screws (6 mm long).

Step 2:

I spliced extra wire to the sensors so that they would reach the Arduino (which is ultimately one layer down beneath the trains).

Step 3:

The sensor bracket is fastened to the wood base using wood screws.

Step 4:

The sensors are placed nine inches apart.

Step 5:

The hall effect sensor will only react to one pole of the magnet--if the magnet is turned the wrong way, it will never be detected.

Step 6:

With the magnet I am using, the sensor will detect proximity within about 3/4 inch or less. Results will vary depending on the strength of the magnet.

Step 7:

Wire the assembly according to this schematic.

Step 8:

Although it seems like a simple enough task to "get the train rolling and maintain speed," I had to consider that the train (on startup and during running) could be anywhere and moving or not moving. At any time, the train could change speed or stop moving.

The train engines (about 95 years old) are colorful and fun to watch, but their performance is not entirely predictable--this system should keep them running with a decent level of reliability.

Magnets Challenge

Runner Up in the
Magnets Challenge

Be the First to Share

    Recommendations

    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Back to School: Student Design Challenge

      Back to School: Student Design Challenge
    • Metal Contest

      Metal Contest

    15 Comments

    0
    chuck_laws
    chuck_laws

    Question 1 year ago on Step 8

    Interesting design, and I can see a real application for this.
    However, the Lionel trains are designed for AC power on the rails. Some of the locomotives may have issues with running continuous DC, others may have horn relays or accessories activated. Have you since had issues since deployment of this design?

    0
    MikeTheMaker
    MikeTheMaker

    Answer 1 year ago

    I'm using mostly pre-1930 trains running continuously in one direction for 3.5 hours per day with no accessories powered by the track. I have specialized and self made accessories but they have their own power supply and computerized control.
    The trains need to start and stop once daily (timer on and off) without user intervention, since start time is in the evening after the business is closed. They have to run for about six weeks per season and this has greatly improved the reliability.

    0
    chuck_laws
    chuck_laws

    Reply 1 year ago

    Thank you. I was a bit concerned as the newer locomotives may not work with the DC rail supply - but older motors have series wound motors that will work. In fact, they run a bit faster as I recall. I have a diesel that incorporates a DC relay to activate the horn - so will need to disable that. If you are dealing with MTH, Weaver, or newer Lionel (post 2000) be careful as their are several flavors of command control systems that may not work on pure DC. I have not seen any PWM interfaces for such command systems as yet.
    Glad to hear the new system works well - i have a train installed at a seniors home that could really use your system. Many Thanks for submitting it to Instructables.

    0
    MikeTheMaker
    MikeTheMaker

    Reply 1 year ago

    I tried two of the post 2000 Lionel trains (transformer control) and got less than 100 hours of run time out of each engine. On one, the plastic that a motor mounting screw went into failed--then the motor lifted up and the brass looking drive gear was chewed up. On the second, the little can motor failed--just shorted out and smoked up the engine. That was a lot of money down the drain for cheaply made engines.
    Keeping the trains running has been one of the greater challenges of our Christmas display window, but the trains are VERY popular with young children, probably the most important thing in the window. Just my opinion, but video games and other "high profit margin, low floor space" items (along with feature rich, but quality poor trains) have pushed trains off the radar for most children coming along.
    I have a couple of Lionel engines that are 100 years old--give or take a bit (bought off ebay for a pittance and repaired with my low level train skills). They still clean up and run great--and you can get repair parts.

    0
    chuck_laws
    chuck_laws

    Reply 1 year ago

    Thanks for the info Mike. I too have found the newer stuff just doesn't hold up as well. Sign of the times as they say. The story you had of making a more reliable locomotive was really interesting, trust all the work has paid off in not having to do so much maintenance. I found your story of Santa's Workshop very interesting - a LOT of work and really impressive. Congrats!
    Since you are interested in Lionel, you may want to check out a club that is for the classic train buffs https://www.canadiantoytrains.org/
    Take care and stay safe.

    0
    MikeTheMaker
    MikeTheMaker

    Reply 1 year ago

    Thanks for the kind comments and the link--I'll check it out.
    The train portion of Santa's Shop has grown to four trains (hard to contain in a 7' x 3' x 6' box). The tight curves, elevated rails and proximity to other moving objects keep me working and solving new challenges.

    display 2019 - 1.jpg
    0
    chuck_laws
    chuck_laws

    Reply 1 year ago

    Oh my goodness, you certainly have a challenge on your hands. Fun challenge though :-)
    I'm just getting into the Arduino world, not having done C++ in 20 years so am quite rusty to say the least.
    Although I'm into Lionel 3 Rail, and narrow gauge HO Scale, my real love is live steam 7-1/2" gauge. Not getting much of the latter due to Covid 19 so spending time doing fix-it around the house.
    Take care, stay SAFE and Healthy.

    IMG_2190.jpg
    0
    MikeTheMaker
    MikeTheMaker

    Reply 1 year ago

    Wow--the live steam looks great! I don't think I've ever seen one of those in person. That's totally outside any skills I've developed, but it looks like fun.
    If you get stuck on an Arduino project, I might be able to help--at least I can sympathize with a challenge.

    0
    Cheesey125
    Cheesey125

    1 year ago

    next stop:A hyperloop!

    0
    MikeTheMaker
    MikeTheMaker

    Answer 1 year ago

    The circuit is shown in Step 7

    0
    MikeTheMaker
    MikeTheMaker

    Reply 1 year ago

    Step 8 is a flow diagram of the process I used to write the software for the Arduino. There are many ways to accomplish a task in software, but you start knowing only that you have two sensors and the sensors can be "high" or "low."