The small Pro Mini board easily fits inside HO scale rail cars. Here the controller (on the right in the picture below) is used to animate the conductor making random stops along the way. You can change the delays in the sketch yourself to “set your own pace!” It also turns the toilet lights on and off at random. The animation is switched on and off directly by the Digitrax TF4. I used a long 0-80 set of screws though the coach floor to mount and suspend the motor drive and capstan (made with some plastic scraps and a 2-56 screw). Roughen the capstan to give it some grip on the belt. Make sure the belt turns freely. I removed ½ of the coach seats I installed to widen the aisle for the conductor. Passengers were distributed throughout the car.
Coach Insides
Pulley and belt on the left, with the motor mounted up-side-down to drive the belt
Here’s what the motor looks like—drive gear is tapped for 2-56 thread with a bottoming tap
Coach belt installed without passengers
More details for the coach components
Basic wiring diagram for the coach
The LM7805 regulator is used because the small regulator on the Pro Mini is a bit too weak to reliably power the motor and LED, and the DC voltage level from the TF4 can be higher than the maximum 12 Volts expected by the Pro Mini voltage regulator.
Loading the Pro Mini code (sketch) has been covered in this article and it’s accompanying materials: A modeler’s introduction to the Arduino Model Railroad Hobbyist Mag, Dec 2016 You can copy and paste the sketch below into the Arduino editor and modify it to make it your own. As with many other subtle animations, this coach raises some eyebrows… and smiles, when viewers catch on to the action! You can modify this to make it simpler or more elaborate. You don’t have to have it DCC controlled, and you don’t necessarily need the random variations. In my mind, however, these things change the model from having animated “features” to helping tell a story in animation.
In any case, I hope you enjoy this. Have fun! Best regards,
Geoff Bunza
Arduino Pro Mini Skecth for the Coach:
// Coach1 Motor Control 1 Drive for Coach Animation
int motor_pin = 11; //Motor H
int toilet_LED = 9; // Toilet Light
int fwdon = 1050; //effectively sets forward speed
int cyclewidth = 2000;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pins as outputs
pinMode(motor_pin, OUTPUT);
pinMode(toilet_LED, OUTPUT);
digitalWrite(motor_pin, LOW);
digitalWrite(toilet_LED, LOW); // A "HIGH"/1 out turns the light on
}
void loop()
{
delay(4000); // Wait 4 seconds
//forward
gofwd(7,fwdon+300); // Kick Start
gofwd(random(800,3700),fwdon); // Conductor Movement Time
delay(random(1200,4500)); // Conductor Stop Time
digitalWrite(toilet_LED, lightsw() );
}
boolean lightsw() {
if (random(0,100)> 30) return HIGH; // 70% time is ON
else return LOW;
}
// Move forward for fcnt cycles and fcycle modulation ON
void gofwd(int fcnt,int fcycle) {
int icnt;
icnt = 0;
while (icnt < fcnt)
{
digitalWrite(motor_pin, HIGH);
delayMicroseconds(fcycle);
digitalWrite(motor_pin, LOW);
delayMicroseconds(cyclewidth - fcycle);
icnt++;
}
}
Bill of Materials and sources
For good prices for quality surplus electronics you can use:
for transistors, diodes, LEDs, switches, relays, and many other components
Digikey.com and Mouser.com for brand new high quality components
for low cost LEDs and transistors:
but for many other components too.
Ebay.com offers very low prices but be wary of some low quality parts sometimes offered.
Parts | Qty | Description | Part Source |
Arduino Pro Mini | 1 | Arduino Pro Mini | |
LM7805 | 1 | 5 Volt Regulator | |
2N3904 Transistor | 1 | NPN Transistor | |
1000 1/4W | 1 | RES 1.0K OHM 1/4W 1% AXIAL | |
470 1/4W | 2 | RES 470 OHM 1/4W 1% AXIAL | |
0603 LED | 5 | White SMD LED | |
White 3mm LED | 1 | White 3mm LED | |
TF4 Function Decoder | 1 | Digitrax TF4 Function Decoder | |
Gear Motor | 1 | 5v Gear Motor | |
Belt | | Dritz 1/4" Braided Elastic | |