Way to rock bell on G scale model train

I’m looking for suggestions on how to rock the bell on a G scale train locomotive.

Were I to couple linkage to the existing bell lever I would need about 1/2" of throw. The speed wants to be about 1 sec for a back and forth cycle.

Looking at components the only idea that presents itself so far is a geared motor rigged to an arm that moves a rod back and forth.

I posted this forum thinking in robotics there must be a need for reciprocating movements.

Any suggestions?

Thanks, Bob

A servo would do it, provided it could hit the speeds you’re after. A one-second cycle isn’t too fast for a small servo. Geared motor would also work, as you pointed out. A solenoid could do it, too, provided the force requirements weren’t too nasty.

Part of me is looking at that and thinking, “Mmmm… a nice steam cylinder would be just dandy!” But I’m guessing this may not be a live steam loco. And yeah, I’m getting esoteric.

Lots of possibilities.


I want a smooth motion forward and back. Solenoids I’m aware of would snap to quickly. What about the servos I see advertised - do these move slowly or quickly like a solenoid?

BTW, there would be very little torque requirement. Even something as small as a pager motor would suffice given a way to convert the rotary to reciprocating movement.

Servo or geared pager motor sound like they’d work fine. A servo is basically a geared DC motor with some electronics inside to tell it where to go.

As far as speed goes, with either of these you’d be able to choose. With a DC motor you can typically control the speed of the motor with pulse width modulation. Almost any microcontroller can be made to do this. I haven’t tried driving a pager motor off the Baby-Orangutan, but I don’t see any reason it wouldn’t work.

Servos typically have one speed they want to go. They’re trying to get to a target position as quickly as possible. For R/C airplanes, this makes perfect sense. Put my rudder here, so the rudder goes there as fast as it can.

But with a microcontroller you can more or less control the speed of your servo by telling it to go to a string of targets at a fixed rate. Go to 0.0. Now go to 0.1. Now go to 0.2. Now go to… you get the idea. By timing the new commanded positions, you can control the speed and position of the servo.

Servos typically update once ever 20ms, so you can have pretty good control over their position. The motion probably wouldn’t look jerky to the human eye. Best way to find out is to test, though.

Used to be there wasn’t a lot of size selection in servos. But these days you can get some pretty miniscule units. My guess is you could pick up one of the pico-sized units and fit it in your train.


The big question is really how much electronics would you want to get into to control this motion?

Lesser questions are should it go continuously or on command, and what kind of electrical power is available to run this mechanism?

If you’re comfortable setting up and programming a micro-controller and want total control over the slow rocking motion, then a small servomotor would probably be great for you. The smaller GWS servos that Pololu sells are actually quite nice (I once worked on a 16-servo miniature snake robot which used the GWS NARO HP/BB, but you could even use the GWS PICO). To run the servo you wouldn’t need a whole orangutan, just a little 8 pin ATTiny microcontroller (one with a timer/counter), 5 volts, and a single pull-up resistor (and a programmer, but we could help with the actual program) You would have complete position (and speed, just a little more complicated) control to rock it when you want, how you want. This almost sounds like overkill to me, but that’s practically my middle name.

If you don’t want to get into the custom electronics business, and just want something you can power and forget about, then a small gear motor turning an offset crankshaft is the way to go, like the GM14a. At 6V is has an unloaded rotational speed of 71 RPM, just over what you would want. 5V might be right on the money. I like the little Solarbotics gearmotors, they’re really tough for their size, but it would run constantly. You could install a switch, or even a microcontroller and transistor to time the motion, but you wouldn’t really be able to control where it came to rest when it was off.

So, does any of this sound good to you?


Adam, you’re a bad influence in the best possible way. I just read what you posted about using a gearmotor and offset crank, and not being able to predict where it would stop. You COULD if you used some sort of a switch to indicate an index position on the crank. A small magnet and hall effect switch would be pretty simple to rig. A microswitch with its roller engaging a cam would be easier, electrically, but more involved mechanically. All sorts of possibilities.

Yeah, a Baby-O would be overkill. But like you said, overkill’s the middle name of way too many people. An 8-pin ATTiny would do the job just fine.

It’d be neat to get the thing to talk to a DCC controller so you could tell it when to ring the bell and when to stop.

(Ok, maybe I’m the bad influence…)


P.S. I think a pico or naro servo would probably be the easiest, mechanically, to set up. And the micro would have complete control over velocity and position.

Something to think about though, the little servos are pretty squeaky. I’m not sure how much noise your train already makes, but the servo squeak could be as loud as the bell itself.


Oooh… good point. And it would certainly blow the whole aspect of realism. Yeah, maybe a small DC motor would be better after all. You can pick the PWM frequency and tune the motor hum until it’s more or less inaudible.


The application would be for DCC controlled trains so from the decoder I have a way to turn the bell motor or servo on and off. The constant track power is 15-18V square wave AC and the decoders have rectified DC outputs which I can add a regulator to drop the voltage.

Most of the G scale steam locos have a small string leading from the bell lever back to the cab. Hence, something really small that could fit under the roof of the cab would be ideal. There’s room inside various sections of the locos to put a gear motor but then the linkage becomes a hassle. My plan is to either use a solid linkage to the bell lever or just a string to pull in one direction and a small spring for the return.

The servo idea sounds interesting - where do I find one of these ATTiny controllers and what does it take to program them?

Thanks, Bob

I really wish they were something you could pick up at Radio Shack, or even Jameco (although they do carry the ATTiny2313, but that’s a 20-pin chip, and way overkill for your project) but the normal place to get an ATTiny is Digikey.com (although it would be GREAT if Pololu would stock such items…).

Atmel has a free development environment, AVRStudio (latest release), which lets you write and download assembly-language programs to your AVR controller. If you also install WinAVR from Sourceforge, you can write C programs for the AVR, either in your their supplied editor, or from within AVRStudio (my favorite).

You’ll also need a programmer. Now, you can save a little money by building your own programmer, or adapting an evaluation board like the AVR Butterfly for programming, but I would recommend just buying a programmer, it’s a good one-time investment. The standard is the AVRISP-MKII, currently $36 from Digikey, but Pololu just came out with their own USB AVR programmer for $28, and some other nice features like direct access to the USB to Serial converter chip (which you probably don’t need to worry about).

You would need a clean 5V for the microcontroller and servo, probably from a voltage regulator, and at least a pull-up resistor for the reset pin. A power few capacitors and a second regulator would be good to keep the power constant and the motor noise form interfering with the ATTiny, but with such a small servo doing such light duty work it might not even be a problem.

You would want one of the controllers with a 16 bit timer/counter (I don’t think any of the 8 pin packages have 16 bit timer/counters, but if space is that much of an issue you could fake something with an 8 bit counter and more code). The 14-pin ATTiny84 (or 44 or 24, equivalent hardware with less program space, usually not worth saving the pennies only to run out of memory!) would be a good choice in any case. It could do servo control signals, or generate a higher frequency PWM output to speed-control a DC motor on command through a power transistor or FET.

Anyway, now you have way too much information.


Thanks Adam, this looks like enough to get me started.

One more question - would it be feasible using PWM to run a pager motor as slow as 60 RPM - the torque I’ll need will be minuscule?


Not really, no. Ungeared DC motors, and more so smaller motors with less rotational inertia, have high minimum speeds, especially under light loading. The duty cycle required to overcome its own static friction will send it flying, probably at a few thousand RPM. You could slow this down by adding some artificial loading, but not all the way down to 60 rpm. You’re really going to need some sort of reduction gearhead if you go with a regular DC motor.