As part of a larger prototyping project I needed to wind some special coils. The coils would be a few hundred turns of relatively thin copper wire (about AWG 35) on a specific piece of polysterene pipe. In order to bracket the proper parameters of the coil during development I would need a few variants of the coil to experiment with.

Winding the first coil by hand was a desaster. Even with another pair of hands helping me it was difficult to control the tension of the wire while rotating the pipe, messing up the coil. I also lost count on several occasions due to the distraction. The resulting coil was poorly wound and geometrically undefined. This also makes the DC resistance a poor estimator of the number of turns, not to mention inductance. Clearly, an alternative method of producing the coils was needed.

While there are companies offering coil-winding as a service (CWaaS), the closest one within an hour of driving, the setup costs are high and the turn-around time would slow down my development project. Buying a used winding machine and adapting it myself was an also alternative but it would take even longer, and it would be expensive. At that point I decided to build a specialized winding machine myself. This Hackaday project explaines my thinking and the resulting design.

Every design project should start from functional and non-functional requirements. It is not always necessary to write these down but they should be in the mind of the designer. Here is the list I came up with for this project:

Note that beauty is not among the requirements. So this thing will be ugly, rough cut and designed for a highly specialized purpose.

Given the set of requirements I scavanged the workshop for available parts and did some 'thinking with my hands' (as opposed to 3D CAD design) on the structure mechanics part. Suddenly, pieces of wood were in my hands.

Design considerations

The easiest way to make the machine mechanically safe was to have a low rotational speed, few turns per second max. The shaft could be driven by hand, for example with a crank, but this would occupy a hand. Better to use an electric motor. A foot switch will free both hands, which is why sewing machines have them. With slow rotation either a stepper motor is needed or a gearbox. For varying the speed some electronics is required. For holding the pipe some coupling and a bearing are needed. The tension in the wire should be controlled and adjustable. Counting windings can be done with a mechanical counter or an electronic rotary encoder.


There is an electronics shop close to where I live who have their inventory online. It turned out they have small electronic motors with gearboxes. I settled for a MFA/Como drills MFA 919D1481, with 148:1 single ratio metal gearbox. By varying the voltage between 4.5 and 15V the speed could be adjusted from 40 to 132 RPM nominally. The torque of 0.6 Nm would be more than sufficient for winding the coil but it is safe to use.

Drive electronics

The motor is an inductive DC load of 2-3A at 4.5-15V. Drive electronics for this class exceeds the usual Arduino shields, even using Toshiba's TB6612. Circuitry for electric safety would complicate the drive electronics, and it would take many days to design, build, test and qualify it. Hm, ...

One of my lab power supplies fit the specs. Setting the current limit as a safeguard, I could control the speed literally at the turn of a knob---which is exactly what I intended to do.

The downside of the 'lab supply as motor driver' solution is that switching this kind of inductive load off takes its toll on the output relay. In addition, alternating direction meant flipping the cables.

This made me buy a large on-off-on switch, wiring it up as polarity alternator. Mind you, even a hefty switch designed for 250V/AC 10A will suffer from switching this small DC motor, but contact derating will be slow enough to wind all the coils I need.

I also bought a foot switch. These can be surprising expensive but the one I bought was not. (It had its cable cut off at 10 cm, so the other parts of the sewing machine went somewhere else.)

So the cockpit was: On/Off/On-switch to select direction, lab supply to set the speed, foot switch to run the motor.

Rotating the pipe

Since the output shaft of the gearboxed motor has already the right rotational speed, the only thing left to do was transfering the torque to the pipe.

I build the most simple solution I could think of. A piece of solid polysterene rod, which fits into the pipe, is connected to the output shaft using heat-shrink tubing. A pipe is then fixed to the rod using Scotch tape.

At the other end of the pipe, a bearing is needed. Rotational speed is small (< 180 RPM), torque is small (<0.6 Nm), accuracy requirement is low (<0.5 mm), normal force is low (<1 N).

After some 'thinking with the hands' I settled for a V-contact surface of a few centimeters length which is secured by a textile band. The contact surface is taken from an IKEA part which is used inside a cupboard to hide the screws. Cutting it down produced a nice 90 degree interior angle with a low friction coefficient. It is mounted on the supporting surface with Sugru so that I could align it properly in all degrees of freedom, in particular in height and along the axis.

The textile band is used to secure the pipe. Its tension can be adjusted with a clasp from an old backpack, which also serves to open the band very far to insert or remove a pipe.

Feeding the wire

A critical element of any winding machine is of course how the wire is fed and its tension is controlled. This is a mechanical problem solved for a long time, probably for sewing machines. However, going for utmost simplicity, my first question was whether I needed a mechanism for that at all.

A tiny digression on coil winding. The best coils consist of orthocyclic windings, where the position of the wire is precisely determined and as close to optimal as it can possibly be, meaning the coil has a high fill factor and defined cross-over points. At the other extreme is the 'wild winding' where you simply run the wire onto the carrier somehow, probably as fast as you possibly can.

In the application this winding machine was designed for orthocyclic winding would not be a large improvement over a reasonably good winding in discernable layers. So controlling the position and tension of the wire could still be done by hand.

This lead me to a design with a rod opposite the rotating pipe. The rod is in fact a piece of eloxed Al-pipe. The spool of wire is on the rod and it is slowed by friction against two pieces of packaging material, defining wire position and tension. Since the speed of rotation is so low, you can even guide the wire between your fingers---which you should not attempt with any commercial coil winding machine.

Counting turns

An easy way to count the turns is by using a mechanical counter. They are cheap, widely available, can work in both directions and store the state persistently. The main disadvantage here is that I would have to construct and build something mechanical to attach to the motor output. The same holds for any form of rotary encoder.

Instead, I made my own 1-bit opto-electronic rotary encoder.

The sensor is a "Transmissive Optical Sensor with Phototransistor Output" of type TCST2103 from Vishay. (In German this is called a "Gabellichtschranke", fork-light-boom-gate?) The sensor is placed close to the output shaft of the gearbox, where the heat-shrink tubing is.

When the shaft rotates the gap between LED and phototransistor is periodically occluded by a mask attached to the shaft. The mask consists of four pins (sewing, again) stuck into the tubing with two black fins between them, one short and one long. The fins are snippets of an intransparent black film with adhesive on the back (Oracal). Then the pins where trimmed.

Since there is a short and a long mask each full turn of the shaft produces two impulses, one short and one long. Depending on the direction of turning, the sensor goes ".-" (Advance) or "-." (rewiNd). This way you can count full rotations.

On the down side, you can only count full rotations. Moreover, the timing varies when the operator changes the speed of the motor. And worse, the signals become hard or even impossible to interpret when the operator starts, stops and reverses within the mask. For the application at hand, all this is acceptable and the encoder is extremely simple.

The sensor is attached to some interface electronics and read by an Arduino Uno R3. The user interface, displaying the winding counts and possibly resetting the counters, is on a laptop using the serial console.

The interface electronics has two paths, one for the receiving phototransistor and one for the illuminating LED. Adding a resistor to the phototransistor is sufficient to read it with an ADC input of the Arduino. Modulation depth is good, bandwidth way sufficient. The LED I wanted to switch on and off in order to have some self-checking capability. Since the LED is rated at 60 mA, exceeding the sourcing limit of an I/O pin of the Arduino, a (garden-variety) NPN-transistor and two more resistors seemed prudent.

As my rule of thumb, if there are more then 5 components or mechanical stability matters, I switch from bread board to PCB stripboard, and beyond 30 components (or SMD or high frequencies or tiny currents or large currents or ...) to a designed PCB. So for mechanical stability, this is done on stripboard in the form of an Arduino shield. Schematics in Eagle, stripboard layout on paper. No housing.


The first program just printed the ADC values from the phototransistor. Blinking the LED and turning the shaft showed the values for dark and bright, the background level and the form of the transitions between dark and bright when occluded by the mask.

It turned out that dark, in-between and bright can be distinguished with two simple fixed thresholds.

The timing of the pulses depends on the speed of rotation, which might be zero. By assuming a minimal and maximal rotation speed the timing of the pulses becomes easy to interpret. The program detects a transition from bright to dark or back and stores the last four transitions in a FIFO. By looking at the three durations between the most transitions, the program can determine the phase and direction---if possible. If this is not possible it skips a beat.

Instead of incrementing and decrementing a single counter there are two counters, one for forward and one for reverse. This makes it easier to know where you are, and also easier to wind several coils on the same pipe in different directions, which I needed to do.

Since the RAM of the Arduino looses its content when the power is switched off, the counters are stored in the EEPROM whenever their value changes. EEPROM has a finite endurance, the Atmel datasheet specifies >100k cycles, so this is taking a toll on the EEPROM. However, at <1000 windings per coil wearing out the EEPROM will take longer than making all the coils I need.

The whole contraption worked like a charm.