






MTH has provided some nice, sophisticated animations in the last 20 years, expanding the range of accessories that have always made 3-Rail O Gauge (‘Lionel’ Gauge) a special place. One of the coolest is the Mel’s Drive-In, which features a classic 1950’s drive-in restaurant with roller-skating waitresses and a moving car rolling up for some burgers and soda pop.The motion on these animations is fine for the home front, but too slow and noisy for our needs here at Roads and Rails, where we prefer to make things faster than real life, and where we have quite enough sound already! One of the first modifications was to remove the speaker playing the 50s music, as it was intrusive and out of step with our general sound design.
Our approach aims to maintain the viewer’s interest and quickly reward the pressing of a button. We tried running the animation constantly so visitors would not have to wait but that only wore down the motors. Accordingly, we decided to remove the original drives and replace them with geared motors we have used in previous animations. These animations are generally manufactured for use on a flat surface, but as our layout allows us to have motors hanging on the bottom of the animation, we can use much larger motors and place less stress on them.
There are many screws on the bottom of this animation, but once removed I was quite glad to see an opportunity to re-use most of the gearing and axles of the original. I had considered using a Tortoise Switch Machine™ for the movement of the waitresses (more on this later), but found the present levers good enough for remotoring with a geared motor I had already purchased some months back from American Science and Surplus (www.sciplus.com). Another geared motor with a large pulley wheel was a perfect match for the movement of the car.
The mechanism proved to be event-driven: the ‘brain’ of the animation works executes a series of movements and waits for switches to report back when actions are complete. This was good news since it allows for an accelerated set of actions once faster motors are installed. If it was timer-driven only, it would force the viewer to wait longer between more rapidly accomplished actions, and would not be more entertaining.
I was never quite able to get the motor working for the waitresses: the gear would slip on the shaft or the teeth wouldn’t quite meet up. Some things are best done at the factory, so I returned to the idea of having the Tortoise™ Switch Machine move the waitress.
The new arrangement worked for 2 days before smoke began to waft out of Mel’s roof, and it wasn’t burned cheeseburgers: I had cooked the ‘brain’ or at least the part concerned with motor movements. Fortunately for me the LED sequence and the lights were ok, but I would have to find another way to make the animation work; I would need a new brain.
After some web research and a visit to Radio Shack I decided upon the Arduino platform to control the sequence of events on the animation. In order to get the most out of the Arduino chip I have left room for future inputs and outputs. The Arduino chip can be programmed from any PC or Mac with the open-source software available on the web. Programs are called ‘sketches’; these can be uploaded to the chip with the provided USB port. I recommend that any new user buy the Make.com kit available at RadioShack, along with the beginner’s booklet. There are online sources for these items if you prefer.
I had to learn a little more about electronics than I thought I needed to know initially, but when I figured out how to power relays off the Arduino output pins, and how to accept button pushes, I was ready to begin building my permanent Arduino installation below the layout. This incorporates the Arduino board itself, the circuit board with the relays and related circuitry, and a panel board with screws so I could attach motors and sensors. Once tested, I began programming my sketch for Mel’s Drive-In:
const int RELAY13 = 13; //the pin for the RELAY13 - DPDT double pole, double throw
const int RELAY12 = 12; //the pin for the RELAY12 - DPDT
const int RELAY11 = 11; //the pin for the RELAY11 - DPDT
const int RELAY10 = 10; //the pin for the RELAY10 - DPDT
const int RELAY9 = 9; //the pin for the RELAY 9- SPST single pole, single throw
const int RELAY8 = 8; //the pin for the RELAY 8- SPST
const int RELAY7 = 7; //the pin for the RELAY 7- SPST
const int RELAY6 = 6; //the pin for the RELAY 6- SPSTconst int BUTTON1 = 2; // input pin
int Butn1ReturnValue = 0; // store button return value
int val =0; // val will be used to store the state of the input pin
int old_val =0; // this variable stores the previous value of val
int state = 0; // 0= RELAY13 off and 1= RELAY13 onvoid setup() {
pinMode(RELAY13, OUTPUT); // tell arduino RELAY13 is an output
pinMode(RELAY12, OUTPUT); // tell arduino RELAY13 is an output
pinMode(RELAY11, OUTPUT); // tell arduino RELAY13 is an output
pinMode(RELAY10, OUTPUT); // tell arduino RELAY13 is an output
pinMode(RELAY9, OUTPUT); // tell arduino RELAY 13 is an output
pinMode(RELAY8, OUTPUT); // tell arduino RELAY 13 is an output
pinMode(RELAY7, OUTPUT); // tell arduino RELAY 13 is an output
pinMode(RELAY6, OUTPUT); // tell arduino RELAY 6 is an outputpinMode(BUTTON1, INPUT); // AND button IS AN INPUT
}
void loop(){val = digitalRead(BUTTON1); // read input value and store it
Butn1ReturnValue = val;
// check if there was a transition
if ((val == HIGH) ){
state = 1;
delay(10);
}old_val = val; // val is now old, lets store it
// delay(100);if (state == 1) {
//car
digitalWrite(RELAY13, HIGH); // turn RELAY13 ON- sets car direction FORWARD
digitalWrite(RELAY9, HIGH); // turn RELAY ON- turns power on/off- car in motion
delay(2000) ;
digitalWrite(RELAY9, LOW); // turn RELAY OFF- turns power on/off- car stops//girl
digitalWrite(RELAY12, HIGH); // turn RELAY ON ‘ girl out (tortoise turns itself off)
delay(3000);
digitalWrite(RELAY12, LOW); // turn RELAY OFF ‘ girl in (tortoise turns itself off)
delay(3000);
digitalWrite(RELAY12, HIGH); // turn RELAY ON ‘ girl out (tortoise turns itself off)
delay(2000) ;//car
digitalWrite(RELAY13, LOW); // turn RELAY13 ON- sets car direction- REVERSE
digitalWrite(RELAY9, HIGH); // turn RELAY ON- turns power on/off
delay(2000) ;
digitalWrite(RELAY9, LOW); // turn RELAY ON- turns power on/off//girl
digitalWrite(RELAY12, LOW); // turn RELAY OFF ‘ girl in (tortoise turns itself off)
delay(4000);} else {
}
state = 0; // event over
}
In this sketch I am only using 1 input (the visitor pressing a button) and 3 outputs controlling 2 DPDT (double pole, double throw) relays and one SPST (single pole, single throw) relay. Think of the DPDT as one of those old-time knife switches, like Dr. Frankenstein used to favor. It makes connections either up or down, just different connections. We use the DPDT to change the polarity of current flow, and thus the direction of the motor. The tortoise that controls the waitress shuts itself off when it reaches the end of the range of motion, but the car motor requires one SPST to turn power on and off to keep the car in one place for the required amount of time. The SPST is a simple on/off switch.
For future use the rest of the relays and sensors are available to control another animation. I am sure this potential will not be wasted, as I am sure we will be purchasing more Arduino boards for our layout.