Controlling AC Motor

Per my other thread, I think I have the encoder issues resolved. I went ahead an ordered the LSI/CSI encoder counter chips. Hopefully that will improved the repeatibility of the encoders.


I would like to control the AC motor that comes stock on the sewing machine.

Currently the speed of the machine is controlled by Variable Router Speed control.

The speed is dialed in and then a relay turns the machine on an off.

Now my question as a electronics newb. Is there solid state device that will do something simliar that is variable based on input?

I don't think that there is a VFD (variable frequency drive) inside the little 19 dollar box. I'm assuming that there is some type of potentiometer/Variable resistor or like device. ((I haven't cracked the box yet))

I want to be able to vary the motor speed based on the encoder output.

I realise that I won't have near the control that I would have had with the DC motor/gecko via step and direction. However, the wife changed the requirements. She wants to retain the existing motor.

At least in the short term.

Thanks for any help.

One option, considering how cheap that speed control is, would be to get a hobby servo and attach it to the knob on the speed control. This would let you use one of the proven servo control libraries instead of developing something to drive a new device.

I'm curious what's in the speed control box though, maybe you can let us know :)

What kind of sewing machine are you controlling? The Juki my wife used had a nice potentiometer input for speed control. We used the 'Handi-Control' product for speed control. This simply replaces the foot control present on most machines with a knob and a start/stop switch.

I'm curious how you are going about controlling the machine.

I presume you are already aware of the 'Quilters Cruise Control' product which does the same thing you are doing (optical encoders on the axis).

I always thought it would be interesting to see if a 2-axis accelerometer could be used in place of encoders. If the cumulative error didn't cause it to drift too much it might be possible to get good stitch-length control without any mechanical encoders.

The wife has a Juki for her piecing maching.. It does use the standard sewing machine treddle(sp?) foot and would be alot easier to integrate.

The machine is a homesteader 19" (I believe).

It's an old singer 1650? that was stretched and rebranded. They provide a AC motor, but does not have the foot control. They control it with the little router box I mentioned before.

I talked to a buddy at lunch today, about using the servo on the knob possibility.

The main problem I see there, aside from the bandaid type fix.

I would need to setup some type of index pulse on the motor shaft to track the speed. Then I could write the code to turn the servo based on index pulses to modify the speed on the fly.

The wife has the Quilter's cruise control for the Juki... It's part of where I got the idea. Unfortunately, it's a best effort kind of solution. You can't actually pick 10, 12, 20 stitches per inch. It has a short/medium/long with a logic control to the potentiometer that replaces the foot control. It works "ok", but will not work with homesteader. There are some other issues that I have with the product also.

I'm reeeeeeeealy close to making this work.

If I could toss the AC motor in the trash and use one of the Gecko 320s from my CNC mill. I'd be in business.

I was thinking about using an accelerometer. I just wasn't sure how much of a "g" force they could detect. From the websites, the unit of measurements didn't mean much to me. And I wasn't willing to drop the cash on it to find out.

I had few left over encoders from my cnc conversions, so I'm trying to use them at the moment.

Aparantly I had a moment of old age...

I forgot about the following company, that I had shopped from in the past.

They have a A/C frequency converter.... So I guess I have to decide if I want to try and reverse engineer it. Or purchase and move on.

Also, they have a stepper controlled potentiometer like we were talking about above... lol

I talked to a buddy at lunch today, about using the servo on the knob possibility.

The main problem I see there, aside from the bandaid type fix.

Motor-driven shafts aren't all that unusual, and are only band-aid if you build them poorly. The advantage is that you use a simple mating between two well-engineered and well-tested systems. With an appropriate control system that is aware of the characteristics of the linkage (compensating for the mechanical backlash when reversing direction for example) it works quite well.

It isn't as sexy as building your own control, but it's usually faster to get a functional device. For one-off production where time is a constraint sometimes it makes sense.

I would need to setup some type of index pulse on the motor shaft to track the speed. Then I could write the code to turn the servo based on index pulses.

Whether you use a servo on the knob or directly control the motor speed, without some kind of feedback for the motor speed you'll be operating open-loop and will need to do the some kind of calibration to determine how the control input correlates to stitch frequency.

I'd be inclined to add an index pulse, or possibly a reflective optical sensor on the needle holder thingy so that variations in the material wouldn't slow down the motor and thus effect stitch length.

Well, ok, that isn't really why I'd do it, but it's a good excuse for closing the loop to make the programming more fun ;D

It has a short/medium/long with a logic control to the potentiometer that replaces the foot control. It works "ok", but will not work with homesteader.

Why doesn't it work with the homesteader?

I'm guessing that what is inside that motor controller is a triac-based 'dimmer' type circuit suitable for controlling universal motors.

If so, I wonder if these application notes from Freescale regarding microcontroller operated universal motor control would be useful?

Low Cost Universal Motor Phase Angle Drive System Low Cost Universal Motor Sensorless Phase Angle Drive System

The homesteader is on or off. It does not have the circuit to allow the standard foot pedal type setup. It appears to be a 90v brused motor. I'm going to see if I can google the part number and get some better specs.

I'd be more inclined for the servo setup, if it was something for me. Or more easily hidden. The end result should be as pretty/hidden as possible. I'm not tossing away the servo idea, but it would probably be my last choice.

At first glance the pdfs look nice... At least they give me something else to dump into google.

Thanks for the replies.


So I spent most of the night reading a bunch of stuff that generally makes my head hurt. grins

I believe that the motor on the sewing machine is a universal motor. I haven't verified that it is 100% yet.

However with that said.... I've been looking at the triacs on the various supply houses. I'm curious if I'm understanding these devices correctly. There are also isolated types that I assume seperates my arduino from most bad stuff via magic... erm..

It would appear that there are 3 pins... 2 for the ac and one for the control.....

In theory, you chop the power line and place triac's ac pins across the cut. Now this device becomes and on/off switch.

I would assume, that I use the PWM output of the arduino to turn the triac on and off very quickly via the control pin. This would allow the a/c to flow, but at a very diminished about. I.e. 10% if the PWM is set to that.

Am I missing something? Is it really that simple. Are there any other components required?

I.e. I always get confused on knowing when and where I might need a resistor and how that value is determined. Obviously, if the devices is 3.3 volts and I have a 5v lead, I need to drop it down. But other than, I get more than a bit confused.

Thanks for putting up with all my newb questions.


Side note.... Generally, the devices that I use need a ground also. I don't see that on the Triacs that I have been looking at.. Unless, what I think is the heatsink. Doubles as a grounding location. Similar to how the little surface mount 5v rectifiers work.

When I use triacs I usually use an optoisolator chip and a triac driver along with a cheap triac. Look for devices that are intended to control inductive loads. These are sometimes called 'snubberless' triacs or alternistors. Mostly you just need to read the datasheet and see which ones say they are good for controlling motors or inductive loads.

As an example, STMicro's T1035H snubberless triac is a 10A device "Especially designed to operate in high power density or universal motor applications such as vacuum cleaner and washing machine drum motor". $1.66 at Digikey.

Watch out for devices (drivers or integrated triac/driver packages) that include a zero crossing detection circuit. This will only let the device start conducting when near the zero crossing. This is handy because it is simple and keeps down the switching noise on the power line. Unfortunately it usually also means you cannot use it as a random phase angle drive because you can't pick the phase angle for turning it on.

Operating the triac is a little more complicated than just hitting it with a PWM signal. While you can turn one on while it has a voltage across it, you can't turn it off again. It continues to conduct until the voltage drops below it's holding current (ideally, when the voltage across it drops to zero).

To use it for motor control you would watch the zero crossing signal on the power line. If you turn on the triac at that moment you would have 100% power. If you wait about 4.1mS (one quarter cycle, peak voltage) and then turn it on you would have 50% power. See the application notes I posted earlier for details.

Triacs usually take a fairly stiff gate current and operate on the line so you'll want to use a random phase optoisolated driver. I use something like the MOC301, which you can order from Mouser.

The ACST10 which you can get at Mouser says it's good for universal motor control (you don't have to worry about adding snubbers for inductive loads) and for microcontroller applications because it has low drive current and so can be controlled directly from the MCU pin.

That might be worth checking out if you don't want to deal with a triac driver, but personally I'd rather have the optoisolator in there to protect my outputs.


I had more or less figured out some of that...

There is a guy that has an AC dimmer circuit on the 2nd page of this forum, which provided some links on the monitoring the zero-cross deal.

From what I gathered, he was using the interupt attached to the zero-cross monitoring circle to trigger his pwm. I'm going to try and do it without the hw interupts. Since I want to retain them for e-stop type senarios.

I figured that it wouldn't be as easy as using a relay, but I wasn't sure. Unfortunately, my brain and the datasheets don't get along. I think that the manufactures assume the reader understands all of the little Vi -Vdd = Vz-v3... etc...

I'm going to have to buy some electronics for dummies book. I have no problem working on the formulas when I know what information to plug in.

You might also consider skipping the triac and going with a simple DC chopper. The universal motor is universal because it runs on AC and DC. You can rectify the AC, feed the DC to the motor (complete with heavy 120Hz ripple), place an appropriate n-channel FET between the motor and neutral and then drive the FET gate with a simple PWM signal (best to feed it through a FET driver, but in a pinch you can work without it).

This eliminates all the work and input pin associated with having to synchronize to the zero crossing.

I was thinking about doing something similar, but I was concerned about the building of the DC power supply.

In my CNC world, I have to use a very pretty dc voltage. A 90v transformer and related capacitors could add up very quickly.

I believe that my 48v/20A power supply was somewhere around 100-150 bucks in parts.

Fortunately, with the universal motor the power supply really is nothing but a bridge rectifier. Think of it as a really cheap DC power supply with a 120 volts of ripple :o

To the motor it's pretty much the same as running it on AC, you're just flipping the negative part positive so it's easier to handle it with a FET.

Do you have any preference on the mosfet...

I'm assuming that I'll want to pick one that handles more than the potential power of the house line. i.e. minimal of 150v and a maximum current of the house breaker.

I realise that this should be extreme overkill. Since the motor shouldn't pull anywhere near the 20 amps that runs to her sewing area.

Is there any concerns with oversizing the mosfet? i.e. If I get a 600v 40amp. Am I'm screwing up when I could probably use a 140v 10amp.

I looked at the prices, but there doesn't really seem to be a "huge" difference in price. Around 60 cents to 2-3 bucks. The shipping will probably be more than the parts. mumbles

Just to clarify.

1 Bridge rectifier spec'd to match max current/voltage expected. 1 Mosfet, spec'd to match current/voltage expected.

I believe I have some 250v/25a bridges laying around.

What Fet driver do you suggest? I'm assuming that we are talking about something like a optoisolator? I tried searching on mouser for mosfet driver, but didn't get much. I'm guessing that the size of the mosfet comes into play when your pick the driver.

Remember that nominal 120VAC refers to the RMS voltage. Peak voltage is closer to 180V, so add some padding to that when you consider voltage ratings.

Also, the breakers in your house's panel are there to protect the branch circuits, not specifically your equipment. If the motor "shouldn't pull anywhere near" 20A, then don't protect it at 20A. Choose a fuse or breaker closer to what the motor will actually draw, and install that in your device so you can protect the motor rather than worrying whether or not your $2 transistor is going to die.

Thanks for comment.

I'm planning on matching volatage/current as closely on the parts as possible.

I was planning on putting a fuse on the AC volatage for the motor.

I'm a little confused on the mosfets. When I tried to see how much voltage is required to operate the gate. I don't see a 5v/0. I see something that looks like +/-20.

I'm starting to feel like I'm getting closer.

Most MOSFETs will do best with a 10-20v gate drive to get them turned on to a minimum resistance. Obviously you aren't going to get that out of the microcontroller, which is why you would use a gate driver. Some high-low bridge drivers also include a charge pump for driving a high-side MOSFET, so that the gate voltage can be boosted far enough to get it turned on.

There are some logic level devices too, they are designed to connect directly to microcontroller pins. The IRLI640 is a good example, but I haven't seen many logic-level devices with a Vds over 200V. If you are comfortable with a Vds of 200V the IRLI640 would be a good choice as it avoids the requirement for a driver. It's $3 at Digikey, $2.25 at Mouser.

Watch the Rds figure. The IRLI640 has an Rds of 0.18 ohms with 5v gate drive, so you'd be looking at around 5W dissipated in the device at 5A. A 600v device would have an Rds up closer to 0.75 ohms, so you'd be looking at closer to 30W. That's why you don't want to pick a much higher voltage rating than you need, the Rds goes up and you have to deal with more heat.

Not sure if you've already seen this:

AC shield for Arduino with 4 triacs, zero crossing detection and code to make it go.

Thanks for the link..

I saw it the other day and was part of my research into how to make the triac work. I'm not sure that I'm interested in having the ac power that close to the rest of my parts. I was planning on sticking the AC components into a different hobby box for the moment.

I jsut got back from a mini vacation. So I will start the researching again.


So I got access to the machine and got the spec's off the motor.

Manufacturer: Baldor Spec# 23A2803003 Frame Type = 2318P HP = .078 V = 90 A = .9 RPM = 1750 F.F. = 1 (whatever that is)

I can't seem to find the exact motor with google, but got close. Maybe it's a custom motor or old surplus. I'm going to email the company and ask for a replace model number.

So it looks like the motor uses alot less juice that I originally guessed.

Looks like the AC shield should be able to handle the motor. Although, I'm still a little nervous about having it all in the same box in close quarters. I'd prefer to have a high voltage quarantine area.

Does that make things easier or harder?

Thanks for all the help.

Separating high voltage from 5V circuitry makes it a lot harder… to get killed.

Most people would consider that a good thing.