Monday, February 17, 2014

NXT Embroidery Machine

"What the heck is that?" is a perfectly normal response to seeing the Frankensteinian thing on the photo above ― especially if you are a LEGO purist, as the non-LEGO parts outweigh the bricks easily by 5:1 ratio, perhaps even closer to 10:1.

NXT-Embroidery-Machine-Topview But let's start from the beginning, shall we? Not too long time ago, I was outraged by the prices of automatic hobby embroidery machines ― especially in comparison to standard home sewing machines with whom they share most of the mechanical internals, that can be nowadays easily bought for well under 200 Euro. Funky embroidery is sometimes a cool thing to have on clothes (though I am aware it's not particularly macho to say that), and instead of parting ways with loads of cash, I attempted converting a standard hobby machine I happened to have at disposal. Sounds like a job for NXT, right?

There are professional embroidery super-machines that operate with multiple colours simultaneously and can quickly embroider on anything up to a tank armor, but going small and simple, the main difference to the hobby sewing machines is 2D movement control of the fabric (as opposed to linear step movements) and control of the needle, via the master handwheel. That takes three motors, exactly as many ports NXT 2.0 offers.

NXT-Embroidery-Machine-Head I won't go deep into 2D positioning; that has been done a billion times already, using a million techniques. In this case, the fabric is fastened into a Technic 15x15 studs hoop, and moved on two sets of perpendicular rails using standard rack gears. (Due to physical size of the sewing head and room it requires for normal operation, only an area of approximately 9x8 studs is actually embroidable.) I've mostly used standard fleece as the base fabric, as it is relatively cheap, durable, soft enough for the machine to embroider easily, yet difficult to stretch, making the stitch points more accurate. In theory, it should work with other fabrics as well if an adequate stabilizer is used.

While two NXT motors move the fabric beneath the needle, the third one controls stitching by rotating the handwheel. As primitive as it sounds, this was actually by far the most challenging component that took over ten failed versions to get right. Firstly, the handwheel is very smooth and difficult to get a mechanical grip on (at least on the Toyota JFS21 I've used) ― the final mechanism actually rotates it by pushing a switch on its side. Rubber bands were out of the question as the revolutions need to be precise in the long run.

Secondly, the torque required to rotate the wheel occasionally rises beyond 1 Nm, especially when stitching very densely. This is beyond what an NXT motor can provide and requires a strong gearbox, lots of reinforcements and puts plenty of strain on the driving mechanism ― I've actually destroyed a couple of 3/4 pins pushing the machine wheel before I settled with a solution using a stop pin. And even with sevenfold gearing down, the motor obviously struggles at times.

NXT-Embroidery-Machine-Everything An additional requirement for the structure was to keep it as simple as possible to mount and dismantle from the machine, to change the bottom bobbins when necessary and let it be used for its sane, regular purpose.

Software running these motors is rather simple ― it moves the fabric to a desired location, does a full wheel turn, and repeats these two steps until all the stitch points are exhausted. They are imported as numerical data from a CSV generated by a handy application EmbroiderModder which can, in turn, import data from various other formats, embroidery programs, stitching clipart, etc. When sewing in multiple colours, the program stops and allows the user to change the thread on the sewing machine and resume by tapping an NXT push sensor.

And the results? Satisfactory, though by no means perfect. As mentioned before, this machine struggles with dense stitching (though I've seen reports that cheap embroidery machines do too), and the accuracy is often insufficient for very small and detailed, precise designs, e.g. text smaller than a few millimeters in height. Also, it asks for patience: stitching a typical design (say, a thousand sewing points) takes about an hour, so forget about mass production. An hour of loud NXT motor whining, that is. There is of course some more time required to find and prepare the stitching sequence.
However, it turned out to be pretty reliable and perfectly adequate for hobby stuff and making simple custom-embroidered shirts. There's something satisfying in the fact that the combined prices of this sewing machine and a full NXT set are less than a half of what a standard-issue home embroidery machine costs, regardless of its advantages.

A hypothetical future version 2.0 would probably take advantage of the embedded sewing machine motor which is significantly more powerful than anything in LEGO arsenal ― controlling its throttle pedal and measuring the real turns of the wheel, probably with a colour sensor and a piece of a coloured tape glued to the wheel off-center. More complicated and likely less reliable, but a lot faster.

T-shirts with a Classic Space logo (intentional rusty old look, as on the photo) now finally seem a much more realistic wish!


You can download the source files I've used for this project here. However, the parameters supplied within are applicable for my rig ― and if you decide to build your own, you will probably need to adjust them anew, since the rig design depends heavily on the sewing machine being used.