The story behind this project is a bit overcomplicated. That’s all below, if you’re interested. I made a video to explain the final product:
This all started when I bought a sewing machine for making fabric RFID tags a little over a year ago, and started using it to make cute plushy objects. Well, as much as I like making plushy objects, I haven’t actually made very many of them since buying the machine. So, my boyfriend has been guilting me into making him a few as gifts for Christmas, birthday, valentine’s day. Naturally, being the great partner I am, this gets me thinking about ways to soup up my sewing machine first 🙂
The original machine did bug me in many ways when working on fine detail work. I’m lazy and uncoordinated with a needle, so I tend to sew almost everything by machine, even when the individual stitches all have to be lined up just right. In fact, when sewing the face parts on my meat and crab plushies, I found myself sewing individual stitches by turning the flywheel by hand.
I don’t know whether more expensive sewing machines are any better, but on my cheap Singer Inspiration 4210 the stock motor is nearly unusable at slow speeds. It stalls easily, makes an awful buzzing noise, maintains an uneven speed, and delivers very little torque.
My first experiments were to instrument the sewing machine with sensors that I could use to estimate the speed and angle of the main shaft. I needed some kind of absolute angle reference, plus some way of counting how far the shaft has traveled. For the angle reference, I found a really handy place to mount a photo-interrupter sensor. This cam is part of the mechanism that advances the machine’s feed dogs. It conveniently moves this metal bar back and forth once per revolution of the shaft.
For sensing the shaft speed accurately, my preferred solution would have been a high-resolution encoder wheel attached to the motor or the main shaft. But that would, at the very least, involve making a rotary encoder disc and attaching it somehow to one of the sewing machine’s moving parts. I wanted to avoid messing with the machine’s moving parts as much as possible, so I looked for non-contact solutions. I noticed that, with a little signal conditioning, an IR reflection sensor works pretty well for counting teeth on the machine’s drive belt. After switching motors, I modified this to sense teeth on the motor’s sprocket instead, but the same signal conditioning circuit works in either case. The signal conditioner is an dual op-amp configured as an amplifier, bandpass filter, and comparator with hysteresis.
Lastly, there’s the most important sensor: the foot pedal! I wanted to keep the original foot pedal feel, but use it as a generic input device for the microcontroller. So, I removed all electronic parts other than the variable resistor itself, and connected that to a 1/8″ jack. With a little modification, the jack fit into the same hole that was originally used for the mains cord.
Induction Motors Suck
This is where the project got a bit out of hand and I started making wrong turns. At first, I was hoping it would be possible to implement smooth closed-loop control by using the original motor and a simple triac-based speed controller for the motor. This seemed straightforward enough. But I didn’t have all of the parts on hand to do a normal optotriac + triac based driver circuit. So I went shopping at HSC. No optotriac, but there were some solid state relays. Alas, after I got them home and looked up the data sheets, it turns out they are the zero-crossing switching variety. Useless for speed control. So, back to the drawing board. No optotriacs on hand. Well, I could move the opto-isolation, putting the microcontroller on a line-powered circuit, and opto-isolating the serial port instead. But that sounded really annoying to debug safely, especially for me without an isolation transformer or variac. But that would require a low-voltage power supply on the mains side of the optoisolator anyway, and if I had to go to that trouble I might as well just use a transistor to switch on the triac…
So I started rummaging through my junk bins again, and I found an old X10 lamp module. This must have a triac in it, I thought. It won’t have an optoisolator, since X10’s cheap circuits never bother with mains isolation. But it might have a power supply and zero-crossing circuit I could use. So I find a handy LM465 schematic online, and I start paring down the circuit into just a bare-bones triac driver, zero crossing detector, and +15V power supply. I got pretty far along on this triac-based speed controller before I switched tactics:
I was experimenting with closed-loop servo control using this triac controller, but the results were pretty uninspiring. With a triac, you can only change speeds as fast as twice your AC power frequency. And a 120 Hz control loop just isn’t tight enough to keep the sewing machine operating smoothly at low speeds. The motor’s lousy torque at these speeds certainly doesn’t help.
I also had lots of trouble with EMI in this design. With all the parts strewn about my desk and electrically isolated but not RF shielded, my microcontroller would randomly reset after the motor ran for a few seconds or so. I first saw this with my trusty Propeller. I tried switching to an AVR Butterfly, half to try and avoid the EMI, half to have its LCD and joystick as a user interface. But, no luck.
I was curious how they solve this problem in industry. Servo motors are pretty common in industrial automation, and surely you must need a fancier way to control the speed of a large motor in order to build a heavy-duty servo. Well, it seems that there are two solutions:
Just use a DC motor instead of AC. This is more expensive, but it’s simple and until recently it was the only option.
Variable-frequency drive. You still use an AC motor, but now you use an AC-to-DC power supply plus a DC-to-AC inverter to control the frequency of the motor’s power supply. With an induction motor, this controls the speed.
VFD seems quite cool, and I was really close to attempting to build a simple VFD controller using parts from a dead UPS. But then my better senses caught up with me…
So, I was about to settle for this mediocrity and finish off my triac-based controller with some buttons and mounting hardware from HSC, when I randomly happened upon the perfect DC motor. I didn’t know it was perfect at the time, but I had a hunch. As soon as I got it home and sat it next to the original motor, I knew.
I was pretty lucky. The speed range was good, the sprocket had the same pitch, and it had plenty of torque at low speeds. The only problem: It’s just barely too large to fit inside the sewing machine cabinet. So, I had to improvise the mounting a bit. I ended up slicing off the bottom panel of the sewing machine, bolting its frame to some scrap pressboard, and mounting the motor using a hacky arrangement of pressboard scraps, screws, and zip ties.
I started out building a simple MOSFET speed controller for the motor, since I’d never used a MOSFET to control an inductive load before. But after spending an hour or two trying to squash transients and convince my FETs to switch at a high enough frequency, I figured I’d had enough pain for one week. I had a spare LMD18200 chip with this project’s name on it.
The LMD18200 is an amazingly versatile and robust little chip. I used it for my laser projector project a while back. It was really overkill for that, but it’s about right for this sewing machine’s beefy new motor. I needed a pretty heavy duty motor drive capacitor too, so I ended up mounting the LMD18200, capacitor, and DC-DC converter in a small metal box for safety reasons. If the capacitor fails, I’d prefer not to have burning hot electrolyte and shrapnel all over my face.
Enough rambling for now. And I guess I should stop hacking my sewing machine, and start sewing cute things 🙂
I did leave plenty of room in this build for later expansion. I’d like to add some kind of user interface for switching sewing modes. Right now I’m using the USB port for that, but a little LCD with a rotary encoder knob would be just swell. I’ve also thought of other ways to automate the sewing machine to make common tasks easier. For example, it would be useful to have a mode that automatically lifts the presser foot between stitches in single-stitch mode. I already found a good place to mount an RC servo motor for that.
And then there’s the idea of building a CNC embroidery machine around this, using Lego Mindstorms to make the cartesian robot…
Lately I’ve been interested in e-textiles and fabric sensor technology. For an example of something I find infinitely fascinating, take a look at this DIY fabric bend sensor. (Via talk2myshirt, the best named blog evar.)
In that project, many of the conductive textile materials were originally designed (or at least marketed) for electrostatic/electromagnetic shielding applications. Hannah Perner-Wilson, who invented this bend sensor, recommends buying materials from lessemf.com. This web site appears to be catering to some tin foil hat-wearing clientelle who would buy microwave-shielded drapes or radio wave blocking baby blankets. Great.
How did this happen? It was actually kind of complicated…
Months ago, Scott and I dreamed of an automated kegerator. For the workplace, naturally. We’d need some way to hand out credits that coworkers could use in order to dispense beer, so we’d need a way to identify people or otherwise store these credits. We could use some kind of “credit card”, but that’s so last century. I wanted to just use the proximity ID badges we already had as employees.
So, I got interested in RFID technology. It was also a decent excuse to brush up on analog electronics.
After only moderate fuss and only about an hour waiting in line, I get a basic mechanical sewing machine (a Singer Inspiration 4210) from my local Jo-Ann’s.
Whew. Ok, I have a sewing machine. So what do I do with it?
I did end up making a working cloth RFID tag. This is a 2×3 inch iron-on patch with an antenna coil made of conductive thread. I sewed the bulk of the antenna by machine (and it would have been thicker if my thread hadn’t broke) then I did the more intricate bits by hand. The antenna itself is actually conductive only on one side, since I had insulating thread in the bobbin. I ran the conductive thread back from the outside of the coil to the center of the tag by sewing on the opposite side, so as not to short-circuit the coil. The black blob is an ATtiny85 microcontroller in a SOIC-8 package.
In this tag, I attached the chip to the antenna using conductive epoxy. In my next prototype, I’ll probably use crimp beads as Leah Buechley suggests. The antenna should also really use more ‘turns’ of thread. This tag works with my Parallax RFID reader, but the range is only a few millimeters. On the right is a larger coil I was sewing for practice. This one would have been larger too, but I had problems with the thread breaking.
I plan to make more prototype RFID tags, both to practice my sewing and to try and increase the range.
So, what else can I do with this machine? I had some fun with it:
The red dude on the bottom is of course an anime smiley, which may or may not be from the Kingdom of Loathing universe. The “ears” and “legs” were totally unintentional, but I think it turned out pretty cute. Next I made the orange above it. It came out kinda lumpy, but it was good practice. I later practiced my vivisection skills by giving it the test-claw that I built while figuring out how to make my next critter- the cute yellow crab in the middle.
You may remember the crab from an earlier post of mine. It’s kind of a chibi version of Ikea’s KORALL KRABBA. They’re so cute together!
There are a few more pictures in my Sewing set on Flickr ^_^