Digital Singer 319K

Digital Singer 319k

I have never put a post into so many categories as this one. It involves an Arduino microprocessor, programming in C++, lots of 3D printing, and my latest sewing machine, a Singer 319K swing needle from 1957. My three main hobbies at the moment (besides Disc Golf) brought together in a single project and a single post. How? Read on!

When I bought the 319K for $10 a few weeks ago, it came without a foot control, just the plug that goes into the motor with 5cms of cable poking out. Even though I was going to try other ideas first, I knew that eventually this was the machine that I was going to add a digital speed controller to. I had a wish list of what it had to do. Firstly it had to fit into the little cubby at the back end of the machine. It had to plug in like a normal singer. When activated the machine should “soft start”, sewing a few stitches at a slower speed, before accelerating to a preset running speed. There are a few nice to haves too. I would like it to detect when the needle is at the top of its stroke when stopping, so that the workpiece can be removed without fiddling with the balance wheel, and I would like it to start without groaning and stalling at slower speeds.

Sounds easy? I thought so. In reality it took a little bit of work, brain power and perseverance, over quite a few days.

The principle I decided to use is “Pulse Width Modulation” (PWM) to control the speed of the motor. This is how electric bikes and cars work, and means that we don’t have to use big variable resistors to control high power equipment. Sewing machines of this age (68 years or so) use a foot controller which uses exactly that. The Singer ones use a stack of carbon discs which are squeezed together to vary the resistance, and hence the voltage getting to the motor. This lowering the voltage not only changes the speed, but also the amount of torque available from the motor, causing the humming, groaning and stalling we all know and live when trying to stitch slowly.

PWM works differently, in that it takes the voltage used to run the motor, and instead of lowering it, it chops the power into short pulses of full voltage. The width of these pulses compared to the width of the gaps between them is what controls the speed of the motor. Retaining the full voltage allows the speed to be less, but to retain full torque.

At least this is how it works on Direct Current (DC) systems. The motor on my 319K is a 230 volt alternating current (AC) operating at 50 hertz (cycles per second). The obvious way to go, with hindsight, would have been to replace the motor with a DC motor, find a power supply to convert AC to DC, and use PWM on the DC current. If I had done that, it would not now be finished, it would not plug in like a normal singer, and the controller would not fit into the cubby. And I may well have been divorced because it would have cost a lot of money.

I did find a PWM device to control an AC system, they are usually used as dimmer switches, but can handle larger currents that small AC motors use. It was reasonably priced, and could be driven by an Arduino microcomputer, or a Raspberry Pi or similar. Link to it here. It is not what I would expect of a pulse width modulation solution, as it takes the AC phases of +230v and -230v and shortens them by truncating the leading edge. This is OK while the power is at over 50%,but once it gets below 50% the main peak of the voltage is truncated, leaving an ever decreasing trailing edge of each phase. This reduces the available voltage for the lower power settings, and hence the available torque in the motor. More on this later.

As it happens, I had a spare Arduino DUE sitting in my electronics bits and bobs. Perfect for what I wanted to, I would have preferred a smaller footprint such as a Nano or ProMicro, but using something going to waste in my spares box seemed a sensible thing to do.

Prototyping Arduino projects is something I have been doing for a while, so most of the other stuff I needed was also in the electronics box.

Obviously I was going to need to have some inputs into the Arduino to control what comes out of the PWM module and controls the motor on the machine. Most importantly I would need an on/off switch and a speed control device. These are one and the same on older machines, but I had seen modern machines which had a slide control for the speed, and a simple foot switch or similar to make the machine go and stop. I decided to go this way.

I had no idea at this stage how long I would like the soft start go for or how fast it should go or how quickly it should ramp up to the chosen speed. These things could just be parameters in the programming, but this would mean using the computer if I needed to change them. So I decided to add three extra potentiometers to control the start speed, how long it would run at the start speed, and how quickly it would accellerate up to the chosen top speed. I used 10 kOhm trim pots which are tiny and are soldered onto a circuit board in the controller. These have to be changed using a screw driver rather than a knob, but once determined should not need changing often.

The on/off switch is a simple micro switch, but I could swap in an Photo Interrupter switch when I finally sort out the user interface. The main speed control is a slide potentiometer, which gives a visual indication of what speed it is set to.

There are two other inputs into the Arduino. The first is the PWM module, which passes in the zero cross events (where the AC sine wave crosses the x axis, or where the voltage is zero). This enabled to Arduino to synchronize the pulse width modulation to work around that alternating current.

The second is a Photo Interrupter switch which uses a collar with a small protrusion (paddle), attached to the main shaft under the machine. Once every stitch the paddle interrupts the Photo Interrupter switch and the Arduino knows about when a stitch has happened. The original purpose of this was to allow the machine to park the needle at it’s highest point when the machine stops, let’s call it a work in progress for now.

The Arduino is programmed in C++, a programming language I have a love hate relationship with. I dislike it because it seems to be mostly punctuation marks and symbols, I like it because it is powerful and versatile and free. I am getting better with it as the tears go by, and I can at least read my own code now.

The PWM module is accessed by prewritten libraries which are downloaded and installed on the PC, and included into my C++ code and complex onto the Arduino. I don’t have to modify these, but some of the code is a bit doubtful, so later in I may have to work on them.

So what does my program do?

Well, it associates specific io pins on the Arduino board to the various devices attached to it. It reads these pins inputs from the devices, and translated the analog inputs from the 4 potentiometers into parameters for the speed control. It also reads the digital pins attached to the in off switch and the needle position switch.

When the on off switch is pressed it goes through a series of phases until the on off switch is released.

The phases are

1. Switch the motor to full power to overcome initial inertia and resistance and get the machine going.

2. When the needle position switch detects that the first stitch has been completed, slow down to the start up speed (based on the trim pot used to adjust this speed).

3. Allow the machine to run at start speed for the required duration, as specified by the second trim pot (0 to 5 seconds).

4. Step up the motor speed by 1% (or more according to a fixed parameter) at set intervals as controlled by the third trim pot.

5. When the machine reaches the full speed specified by the slide pot, run at this speed until the on off switch is released. During this phase, moving the slide control will speed up or slow down the machine.

6. When the on off switch is released, regardless of what phase it was in above it will lower the speed down to the start speed.

7. When the needle position switch detects the highest stitch position, the power is reduced to zero. This still needs some work.

The machine waits for the on off switch to be pressed again and starts the process again.

Prototyping in progress
Prototyping in progress

The program was developed on the workbench in a prototype configuration, lots of wires, lots of debugging code etc.

Nearing completion
Nearing completion

When completed, a structure was 3D printed to hold the various permanent parts of the controller safely in the cubby. The wiring if the motor was changed to that of a knee bar type machine i.e. the mains power comes into the motor through the 3 pin plug, and the controller is attached to the motor socket via a 3 core cable from the motor to the controller in the cubby. The on off switch and the main speed control slide pot sit over the Arduino on a second layer of structure,and the PWM module and eventually a small switching power supply (230v to 5v) are at the back of the cubby. Currently the Arduino runs of a USB cable, either connected to the PC for programming purposes, it plugged into a 2.4amp USB power supply for stand alone running.