Santa's transport
For this year's holiday decorations, I wanted to do something more than a circle under the tree that I have been doing the past years. I started thinking about it in early fall so there was plenty of time to design something new (or plenty of opportunity to procrastinate past the time when anything new could be designed).
My first thought was a simple point-to-point trolley or street car. I've seen plenty in displays or builds in the club so I could envision what I wanted. It also seemed like a pretty simple Arduino project to build. But, I don't have a trolley. And looking on line, even used ones were a bit expensive for a "maybe-I'll-get-to-it" project.
My wife liked the idea and found a box car transport for Santa's reindeer that she gave me for my birthday. We could use an existing engine and pull it along. She has a small LGB engine that would be a great size and it still runs on DC so easier to program using the Arduino.
My plan was to put a sensor at both ends that would detect the approaching train and slow it to a stop. After waiting for some time at the "station," the train would start up and head to the other end. .
I spent some time thinking about how I would set up the sensors. I experimented with a couple of options but settled on IR obstacle sensors. I had a couple around and they would be pretty easy to mount. I had hoped for something that would lay underneath the tracks but nothing I had would fit or it didn't look upwards.
I spent a couple of weeks over-thinking (the nice term for procrastinating) the design when I finally decided I needed to run something before we got too close to the holidays. So I started with the simplest thing I could do which was run the train forwards and backwards using a timer. I played around a bit with the time so the train didn't run off the ends of the rails. The distance traveled varied a fair bit even with a constant running time so I could only do half-a-dozen trips before the risk of running off the end was too high. But I had something running.
I can't control the track voltage directly from the Arduino. It puts out neither enough voltage nor current. The answer was to use a motor driver with a separate power source. Using Pulse Width Modulation (PWM), I could set the output voltage to the track just like controlling the speed of a motor.
I next added one sensor to get that working. I would run the train forward until detecting the engine passing the sensor. Then slow the train to a stop, wait, then start backwards. I would run backwards for a fixed time. Since I now had a pretty well-controlled starting point where the sensor is, the drift between each run wouldn't pile up.
This is where things were when we left town for the holidays.
The biggest problem at this point was that the small engine hummed loudly. I think this was a result of the rapid voltage changes [PWM]. When we got back to town I was going to see if I could find a way to smooth out the output voltage from the motor driver. It looked like a simple RC circuit might do the trick. But before I had a chance to test that ...
I received a new engine for Christmas! A wonderful gift.
It runs fine on the PWM output and even has sound in DC mode. All of that making it a obvious step-in for the previous engine.
So now we can listen to the engine chug back and forth transporting Santa's reindeer. And I have a great place to start from next year.
Below is the simple schematic I used for the circuit.
Comments
Post a Comment