Gantry crane for model railway

Getting a lift

Build a gantry crane for a model railway using versatile stepper motors

STEPPER MOTORS are to conventional DC motors as computers are to calculators – in other words, much moresophisticated. The ability of stepper motors to specify rotation precisely both by velocity and angle opens new doors for movement control. The downside is that to get the most out of these little beauties, you need ancillary digital-pulse control circuits, a fact which may deter some sheddies from exploiting their numerous advantages. This article outlines, in detail, a simple but practical stepper motor project. It uses mostly reclaimed parts as a way of demystifying the necessary control aspects. I hope it will encourage other people to experiment and use steppers in their own projects. Our project is a model gantry crane in approximately 1/32 scale, suitable for a G scale railway. Railway enthusiasts please note this does not claim to be prototypical, but serves simply as model to demonstrate the methods of basic stepper control. The motor we are using to drive the crane is a fairly typical 4-phase bipolar stepper, rated at 12 volts, 30 ohm / phase. It was obtained from a discarded dot matrix printer, which also provided the mechanical components. The size of these parts, particularly the gantry traversing bars, has largely dictated the overall dimensions of the model at about 600mm across and 450mm high. The supporting legs, crossmember girders and control house have been made from 3mm particle board painted to resemble metal. The controls are mounted on the back panel of the operator’s shack. Some suggested plans are shown but obviously can be modified according to what’s lying around the shed. Please note that these are not reproduced to scale.

Drill end-mounting plates simultaneously

The gantry

Once the various designs for the gantry, supports and housing have been marked out on the 3mm board, it can be cut out with a fret or scroll saw. I find it is easier to paint the individual parts before gluing them with white PVA. This also gives a neater end result. The quasi-dovetail design gives a very rigid structure and is self-aligning during assembly.
The only really critical step is the placement of the holes that fix the rods carrying the winch mechanism back and forth – they have to be absolutely parallel and correctly spaced if the carriage is to move smoothly. The easiest way to ensure this is to drill the holes through the two end mounting plates simultaneously.

Electronics

This is the real heart of the project. There are five main sections to the circuit, as illustrated. The 12v DC is provided by a commercial 240v AC adapter which is then passed via a simple regulation circuit to the logic elements and the stepper motor. The manual switch settings are in our case limited to left-right movement of the carriage at a selected speed and the detection of limit switches. The translator converts these manual switch settings into digital pulses that are fed to the driver stage directly, energising the stepper motor coils in the correct sequence. The component details and connections are laid out in the circuit schematic shown, with a parts list attached to this article.
The values chosen for this project have allowed for a morethan- reasonable safety margin in terms of power dissipation, with the thought that it can also be used with higher-rated motors without further modification. Be aware that the integrated circuits are of the CMOS type, which can handle the 12-volt supply, rather than TTL five-volt variety.
The circuit works in the following manner. A constant flow of square-wave pulses with a 50 percent duty cycle is generated by the LM555 timer integrated circuit. The pulse rate, hence the motor speed, is determined by the setting of the 4K7 ohm potentiometer, R3. A series of four dual input exclusive-or (XOR) logic gates on the CD4070 chip determine which direction the rotation is to be, whether or not either of the limit switches has been activated and if the MOVE button has been depressed.
The output is then passed to the CD4027 integrated circuit which turns on the TIP31c transistors in the appropriate sequence. The relative pulse timing of two of the four coils, showing the 25 percent offset of two consecutive pulses, is displayed on the oscilloscope screen inset, giving an idea of how the rotor is turned step by step. In pursuit of simplicity, the same supply voltage of 12v DC has been used both for the driving circuitry and the motor itself.
Often in real life, the motor supply may need to be quite different – anywhere between five and 30 volts. At that point, an additional regulated DC supply for this would be needed at the point indicated as V2 on the circuit schematic.

Consecutive pulses displayed on the oscilloscope screen

"bread board" mock-up of circuit

Cut copper strips with a twist drill

Veroboard

I confirmed the correct function of the circuit on a “breadboard” mock-up before I transferred it to Veroboard for the final assembly. As the actual arrangement of components on the Veroboard is largely a matter of taste and / or convenience, I have deliberately not specified any particular layout. It is a good exercise to work through the circuit schematic and transfer the parts to the printed circuit board, thereby gaining an understanding of how the various sections function.                                                                                                                          Veroboard is designed as a general purpose prototyping material and has standardised copper strips with predrilled holes for the placement of integrated circuits and other passive components The easiest way to cut the copper strips in the necessary places is with a 5mm twist drill held between thumb and forefinger, but be careful not to cut adjacent strips.
A word of caution for novices: be circumspect when soldering these types of boards, as overheating will quickly melt the glue holding the copper strips to the reverse of the board, not to mention destroying delicate semiconductor components. Remember to heat the wire and copper by applying the tip of the iron to each simultaneously, not just melting the solder. A wellsoldered joint should look like a miniature Mt Taranaki.
Use DIL IC sockets for the integrated circuits themselves, and ground yourself with a wrist strap when handling them to avoid static electricity charges which can easily fry CMOS chips. Traditionally, it is best to attach passive components like the resistors and capacitors before the more thermally fragile diodes and transistors. Make sure polarised components like the diodes, transistors and electrolytic capacitors are mounted in the correct orientation.

Check

When everything has been assembled, meticulously check all the joints and connections with a multi-meter and a magnifying glass. Gently score the gaps between the copper strips with a scribe to break any inadvertent solder bridges between adjacent strips. Then check everything again! The most common reason circuits don’t work is because of poor or incorrect connections, not dud parts.
MOLEX pins provide an easy way to attach the motor and other wires so that the Veroboard can be mounted in the operator’s shack in small grooves and removed later if needs be. Identifying which motor leads are which can be a bit of a hassle. In a bipolar motor, the common lead for each phase will have an equal resistance through the coils – and in our motor the common wires are both red. It is then simply a matter of trying various combinations until the motor turns smoothly. If it vibrates rather than turning, swap the coil leads over. Note that the output transistors are grouped fairly closely together.

MOLEX pins provide an attachment

Serrated belt salvaged from a printer

Simple, reversible 3v DC motor working through a planetary gear

Crane mechanism

The mechanical parts act in two ways. The winch carriage is pulled back and forth along two metal rods by the serrated belt salvaged from the printer. The effective range of travel is determined by limit micro-switches, also courtesy of the dead printer. Two switches on the back of the shack control the direction and the start / stop. The movement range is just over 350 mm, being more than enough to cross two sets of 45mm G scale tracks. In the interests of simplicity, as the lifting winch I used a simple reversible 3v DC motor, working through a planetary gear, although a second stepper could obviously be used here. A DPDT switch mounted on the roof of the winch house controls the lifting motor. Power comes from a rechargeable battery pack in the top part of the housing, avoiding the need for any flexible connections to the moving parts. A pulley block and hook assembly was purloined from a Meccano set.

The future

This is very much a basic stepper motor project, aimed at getting something off the ground (sorry!). Two obvious adaptations or enhancements spring readily to mind: replacement of the translator segment by PC software and/or microprocessor control for more sophisticated functions; and the use of dedicated driver integrated circuits, rather than discrete transistors. Direct interaction between DCC control of the model train and the translator has clear appeal. The Internet is a veritable mine of useful information and a quick Google will yield endless details about specifications, applications and circuitry.
The main message is experiment, experiment, experiment. The circuit described will drive a wide range of steppers, but ultimately if it blows up or melts down, it simply means that more shed time is needed to get it right, and that’s never a bad thing. 

Veroboard

The famous Veroboard, which is described as the fastest and easiest permanent method of assembling electronic circuits, is according to Vero Technologies also known as stripboard, prototyping board, electronic prototyping board and breadboard