Saturday, 30 June 2012

Where to Start

The first step will be: Just to fit a sensor somewhere, then hook it up and see whether we can actually sense the position of the needle or the position within the rotation cycle of the machine.

Then, feed that measurement into an Arduino.

Today I've taken some better pictures.
And I have had a lot of help -- thanks Bernd. Thanks everyone for their input. Thanks Unknown, for the suggestion of the light or magnetic sensor.
You said: I could put a sensor in the middle of the bed shaft.

It sounded a good idea, but when I opened the machine today, I noticed that it won't be possible, because the (rotating) bed shaft is too tighly nudged into a corner of the cast-metal frame of the machine. There is just no space around it. The flat band in the foreground is reasonably free, but it is not the shaft, it is part of the control mechanism for the feed dogs.

Thanks to Bernd who took a lot of time with me to evaluate different options.
We thought for a long time to attach a sensor that would sense the up-and-down movement of a lever somehwere in the actual vicinity of the needle movement.
These are two close-up pictures of the different phases of the needle movement. Points A, B, and C were all discussed as anchor points for attaching a sensor -- or a magnet which is sensed by a magnetic sensor.
Admittedly I have the feeling it's much too crowded there, and there is hardly any space to put anything in that wouldn't interfere with the existing mechanism.

But I have found out that not any old "up"  position of the needle will do. The needle is high enough "up" over easily 1/4 of the whole rotation of the shaft, but over most of this, the upper needle thread is still caught somewhere within the guts of the bobbin mechanism, making a turn around the bobbin to wrap itself around the bobbin thread and create a stitch. In this position, if a seam has just been sewn, the fabric cannot be pulled out of the machine because the threads are still caught in the mechanism. That means that the motor has to stop at indeed one very particular point of the cycle, which appears to be the time when point A is highest.

Unfortunately, then, I can't see how we would be able to sense both the "up" and the "down" position of the needle -- because both are needed variously.

So far we mostly thought about two candidates for machine rotation sensing solutions:

Sensing Solution 1

What Unknown suggested might actually work on the (top) arm shaft:

Please apologise the very bad drawing.
There is a little bit of space within the frame around this shaft.
  • Fix a disk with one or more gaps in it around the arm shaft. It can probably not be slid on, but will probably have to be made in two parts and glued together around the shaft.
  • Fix a light sensor to the frame that reaches around the disk and can sense the gap going past. This would probably be a photo interrupter like this or this.
  • The radius of the disk would have to be small, and so, a relatively wide angle out of the whole rotation would be considered as "signal"/"up". 
  • The gap in these sensors is only 3 mm wide, so the disk would have to run very true, even though it has to be fixed in 2 parts around the shaft.

Sensing solution 2

At the back end of the machine, where the big drive wheel picks up the rotation from the motor, there is a little bit of space that might be of interest:

  • Attach some reflective material to the smaller drive wheel, best at the spot which is at the top when the needle is in the optimum "up" position. It is of advantage that the wheel is originally black.
  • Fix a bracket to the frame above the top and attach a light sensor like this that senses reflected light.
  • A second bracket with sensor could be fixed underneath the wheel and sense when the needle is in the "down" position.
Main disadvantage: The brackets -- they'd have to have very particular, exact shapes to hold the sensors at the right places. Here is a picture of the same thing from the top:

Motor Control

Different to what I wrote before, the machine easily does 10 stitches per second, so 600 per minute, which would mean the motor then probably turns 8 times as fast, at 4500-4800 per minute.

I was told that it would be difficult to tell a conventional motor to stop that precisely at a certain point. I'll take my chances and try...

We had a look the foot control of the machine and found it contains a potentiometer that seems to range between 0 and 100 kΩ.

Thanks very very much to Bernd for all his help, assessments, and suggestions.

Wednesday, 27 June 2012

Hacking my sewing machine

The Machine

This is my sewing machine.

It's quite a nice one, if a bit old (I have had it for 16+ years). The plastic is a bit worn, and of course, these days there are much better machines around -- but it still has some interesting features, e.g.adjustable foot pressure. It is called "electronic", and the claim is that it somehow has an electronic sensor that senses material thickness. It's certainly true that it can sew through very bulky fabrics with no problem.

My hand wheel needed replacing, the hand wheel on this photo is black because it was printed with a 3d printer (thanks Dave!) (I think it was Dave).

But I had never seen another one exactly like this around until I walked into the hackspace the other day, where someone has donated one of exactly the same model!

How does a sewing machine sew? If you are not familiar with sewing machines -- before I waste a lot of space here, there is an excellent Wikipedia article here.

This machine here works with an (I think) potentiometer inside the variable-speed foot controller: You leave it alone, and the machine stops; you press it, and the motor starts to run and the machine sews, the more you press it down, the faster.

Maximum speed on this one is about, oh, say, 300 stitches per minute or 5 Hertz, but it could also be twice that or half that. I had said "300 RPM of the motor", but Holger has pointed out that of course the drive belt introduces a translation between the motor and the rotary wheel, so the motor would be running faster, at maybe 2000-2500RPM (assuming the ratio is 1:7 or 1:8).

The machine sews forward by walking the fabric forward with the feed dogs against the presser foot. This one has two different modes for the feed dogs: in one, they just make longer or smaller steps, and the stitch length is adjustable from 0 to about 6 mm, or can even go backwards. This creates straight seams or, if the sideways position of the needle is varied, different patterns, like zig-zag and more.  In the other mode, the feed dogs always go 2 mm forward - 2 mm forward - 2 mm backwards (repeat). This creates elastic seams, good for elastic fabrics.

Andy invited me to open up the Hackspace machine to look what's inside... so here it is!

(Please excuse the lousy picture quality, this was taken with my age-old dumbphone).

A pulley and drive belt takes the rotation from the motor, and a system of shafts, gears with different translations, cams, and more pulleys moves the feed dog mechanism, the needle and thread take-up lever motions, and the stitch cams in unison. (The stitch patterns are of course done with cams. There is a better picture of those below).

The Problem


Why does the machine need a hand wheel at all?

As you press the foot controller, the machine starts sewing. As you release it, it stops. And the needle will stop in whatever position it just is.

And that is a problem. More often than not, the needle will be in a downward or half-way position somewhere, and the fabric can not be pulled out. So in most cases, what you want is for the needle to be in an "up" position when the machine stands still.

Also, that's the only position where the needle can be threaded, of course.

But sometimes, you particularly want to lock the fabric in place with the needle, e.g. to lift the presser foot and turn the fabric, to sew corners. I that case, the needle should stop on a "down" position.
Very good (and expensive) modern machines have such a function, where you can define what position the needle should be in when sewing has stopped.

So, I imagine a function like this: the current electricity supply needs to be altered. When the foot control is pressed, it should work like before and let the motor run faster or slower according to the amount of pressure on the foot control. But when the foot control is released, it should not immediately stop the motor, but turn it just ever so little further until the needle is either in the "up" or "down" position.

The interface for that could be two buttons, one for "up" and one for "down" -- possibly on the cable that leads into the machine, but most elegantly, of course, incorporated into the body of the machine.

But when I've got that, I have the feeling that I wouldn't want to stop there -- if I already could control the motor rotations independently of the foot control, then I might also want to do something like: "Sew exactly 3 stitches, then stop" (if sewn in place, this, e.g., would make a knot, so the thread can then be cut off neatly and the seam won't come apart again). Or, to sew a buttonhole: "sew exactly 20 stitches, then stop". (I haven't thought about the interface for that yet).

Here are two pictures of the rear end of the machine. The electric circuitry is just in a little black box at the bottom which I haven't opened yet. One cable goes to the light and just supplies electricity whenever the machine is switched on. The other cable goes to the motor, but here, the flow of electricity is obviously controlled by the foot control.

It could be a second issue to replace the light with an LED light, and then the machine wouldn't draw 25W any more when switched on, but maybe 2 or 5 or so only.

So what will I need?
  • Something to sense whether the needle is up or down.
  • Something to control the electricity supply accordingly.
  • Some kind of interface for that.
  • possibly, a LED light and socket of the right size, and possibly a transformer for it.
... and all of that has to be  in a size so it fits into the very narrow space inside the machine...
... and all of that has to be affixed somehow to existing parts of the machine.

And here I am inviting some brainstorming!

Andy has suggested installing a sensor with a light barrier at the top pf the needle shaft to sense whether it's up or down.

Here is a sequence of  pictures of the different phases the needle shaft goes through with the rotation of the motor.

The problem I see there is: This would need two light bariers, one at the very top of the highest point of the needle shaft, to only fire when the needle is really high up, and another just above the top of the needle shaft at its lowest point, to fire when the needle is really, really down.

Others have suggested a rotation sensor.
I figure one could be put in at the end of the bed shaft.

I can show you how to sew ballgowns and T-Shirts, but I haven't done much like this yet. I don't know where to get either a light-barrier sensor or a rotation-count sensor and how to get one that fits in that space... and how to attach it.

I have no idea what kind of control mechanism to put in! a chip? an Arduino?  And could that fit into the machine?
I know we have a drill press, a lathe, a laser cutter and a 3d mill in the hackspace, not to mention several 3d printers...

Any comments, suggestions and ideas are welcome.

Thank you for reading this far!

Tuesday, 26 June 2012


Of course I have more dreams for the future...
like this:
... attaching an embroidery frame to the machine, then controlling that with two or more stepper motors like the mill, like the laser cutter, coordinating that with the stitch control that was already put in, and  this way, make it an embroidery machine...
Look what these guys have done. (They have made a quilting machine, not an embroidery machine). (They are moving the machine, not the frame).
But these are just dreams for the future...