• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Control AC sewing machine speed with an Arduino

DIYO

New Member
Hello,

First of all, please apologize for the potentials language issues, English is not my native language but I'll do my best :)

For a little project, I'm trying to control the speed of a sewing machine with an Arduino but I can't make it work...
The first thing I did was to try to undestand the wiring of the connector with a multimeter and this is what I found :

Wiring Schematics.PNG
After that, I opened the foot pedal to know how the speed was controlled and here it is :

IMG_20191224_155617.jpg IMG_20191224_155627.jpg

I'm a software developper and this circuit is far beyond my electronics knowledge so I googled the ref of the top right corner component (BT136) and I've found some topics about TRIAC dimmers and, correct me if I'm wrong, this is what this circuit is, right ?
The next step was to find a TRIAC dimmer controllable with an Arduino and I found this one : https://robotdyn.com/ac-light-dimmer-module-1-channel-3-3v-5v-logic-ac-50-60hz-220v-110v.html
I've tried a lot of different wiring with this module but I've not been able to get descent results : I cannot find a way to get a linear output voltage between 38 and 220V like the one produced by the foot pedal...

So here are my questions : Is the dimmer module I bought what I really need to replace the foot pedal of my sewing machine ? If not, is it even possible to control with an Arduino the speed of my sewing machine ?

If you need more details, please ask :)

Thanks,

Yoann
 

MaxHeadRoom78

Well-Known Member
Appears to be a simple Triac controller, you could convert for Arduino use using an opto, check out Fairchild AN-3006 and AN-3003 and also Picmicro has a processor controlled Triac circuits on their site.
.Max.
 

DrG

Active Member
My first question would be what type of motor drives the machine? Don't know much about sewing machines but a "universal" (series wound brush) will respond to triac control, where an induction motor will not.
 

DrG

Active Member
My first question would be what type of motor drives the machine? Don't know much about sewing machines but a "universal" (series wound brush) will respond to triac control, where an induction motor will not.
I see your point, but the OP has already identified a triac (BT136) on the existing pedal motor control, so I would assume that speed control of that motor can be accomplished with a triac.

The module he has also has a triac and zero-crossing capabilities. That is not to say that it will work or that it will work as well as the pedal has worked.

Let's hear more about the connections and software - no?
 

DIYO

New Member
Hello,

Thank you very much for your answers !

Appears to be a simple Triac controller, you could convert for Arduino use using an opto, check out Fairchild AN-3006 and AN-3003 and also Picmicro has a processor controlled Triac circuits on their site.
.Max.
Thank you, I'll check that but I would like to test with a "pre-made" module first to avoid mistakes with high voltages...

Are you using the RBDdimmer library?

Using the potentiometer example can you draw out the connections from the dimmer module and to both the sewing machine and Arduino (and which Arduino - an UNO?).

What if anything happens?

Edited to add: did you see their tutorial example with a lightbulb? How do your connections compare...where is the sewing machine connections?
Yes, I'm using this library but I don't know how to wire correctly the machine to the module because there is 2 inputs and 2 outputs on the module but only 2 wires going to the foot pedal controller... Maybe it's very simple but I prefer to ask for expert advices instead of doing stupid things...

My first question would be what type of motor drives the machine? Don't know much about sewing machines but a "universal" (series wound brush) will respond to triac control, where an induction motor will not.
I cannot tell you what type of motor it is because I can't open the machine since it's not mine but I think that the picture of the foot pedal controller can help determine the type of the motor right ?

Thank you :)
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Hello,

Thank you very much for your answers !



Thank you, I'll check that but I would like to test with a "pre-made" module first to avoid mistakes with high voltages...



Yes, I'm using this library but I don't know how to wire correctly the machine to the module because there is 2 inputs and 2 outputs on the module but only 2 wires going to the foot pedal controller... Maybe it's very simple but I prefer to ask for expert advices instead of doing stupid things...



I cannot tell you what type of motor it is because I can't open the machine since it's not mine but I think that the picture of the foot pedal controller can help determine the type of the motor right ?

Thank you :)
As it's just a crude 'light dimmer' the motor has to be a Universal AC/DC type, and there should be no issues using an Arduino controlled dimmer to control it.

Wiring wise, you probably need to rewire so the mains goes directly to the controller, and the motor is fed directly from it's output.
 

DIYO

New Member
As it's just a crude 'light dimmer' the motor has to be a Universal AC/DC type, and there should be no issues using an Arduino controlled dimmer to control it.

Wiring wise, you probably need to rewire so the mains goes directly to the controller, and the motor is fed directly from it's output.
Thank you, so if I understand well, this is how I need to wire the module :

Capture d’écran 2019-12-28 à 13.37.04.png
 

Nigel Goodwin

Super Moderator
Most Helpful Member
It rather depends if the original controlled in the live or neutral, I suspect from the connection it might be in the neutral? - which was why I suggested feeding the motor directly, rather than via the three pin connector.
 

DIYO

New Member
It rather depends if the original controlled in the live or neutral, I suspect from the connection it might be in the neutral? - which was why I suggested feeding the motor directly, rather than via the three pin connector.
Thank you but I can't feed the motor directly, I need to find a way to control the motor without modifying the machine just by replacing the actual foot pedal control. I thought that if it was possible to control the speed of the motor with the foot pedal, it would be possible to control it with a micro controller too...
 

DrG

Active Member
I am still following this thread, but frankly, I don't want to weigh in on MAINS issues that I don't completely understand.

Your pedal board seems to be common - here is one with several pictures https://www.ebay.com/c/729483579 I don't understand how there can only be two wires - is only one side of the AC being switch or ?

What are the connections from mains to machine to pedal? I might be able to learn something :)
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Thank you but I can't feed the motor directly, I need to find a way to control the motor without modifying the machine just by replacing the actual foot pedal control. I thought that if it was possible to control the speed of the motor with the foot pedal, it would be possible to control it with a micro controller too...
It would, and it is, but to do so you need to accurately know EXACTLY how it's connected.
 

KeepItSimpleStupid

Well-Known Member
Most Helpful Member
I, sort of, want to stay out of this. Here's somethings to think about. It;s designed for an incandescent bulb. That is a non-linear load. It's basically a current dependent resistor. The bulbs brightness depends on power, not voltage. It's proportional to V^2.

Speed is more proportional to voltage, not power.

When you phase angle fire a motor. See https://en.wikipedia.org/wiki/Phase-fired_controller you get some strange output that only a True RMS meter can make sense out of.

A cheap DVM averages the input and pretends it is seeing a sine wave. It then multiples that number so what you "see" is the RMS value of only a sine wave. When you feed it nonsense, it returns non-sense.

TRMS or True RMS is what DC voltage will create the same amount of heat as your wacky AC voltage.

Motors are inductive. Triacs turn off at zero voltage and zero current. With a bulb (resistive load) the triac turns on and off at the same time.

You have 1/2 cycles to deal with to, furthermore complicating stuff.

In any event, you have some sort of input say 0-100%. Possibly with a motor you might have Off and 10-100% ir maybe a burst to get the motor started.

let;s just look at the positive half-cycle for a bit. v(t)=A*sin(wt); So we normalize this to V^2 and we don;t care what A is because we need 0-100% power which is proportional to V^2 and we get this tab;e of phase angle and V^2 or time (0-100%) and 0 to V^2 or some f(0-100%) = firing angle and we have to send out pulses from that firing angle measured from V(t)=o to v(t)=0 for one period. We have to continually send out pulses because the motor might turn off at zero current.

For a light bulb, we can turn it on and wait until it turns off. For a motor we have to keep turning it on.

If you want brigtness of an incadesent lamp, you have to convolute the temperature resistance change in there too.

If you want speed, then your f(0-100%) = firing angle is going to be proportional to the ABS(v(t)) over a cycle.

For robust control, the incadesent lamp and the motor controller should incorporate current limiting. and it should compensate for peaks and valleys of the line voltage.

You have a lot of stuff going on and it starts with a good detection of 0 Voltage. Current will not be sinusoidal. You can't overshoot either and you have to keep the waveform periodic and deal with the upper and lower halfs.

Overcurrent and line compensation are finer details.

The lamp will have a resistance about 1/12 the hot resistance when cold.
 

Pommie

Well-Known Member
Most Helpful Member
If the diagram in the original post is correct then the switching is in the brown line. Is this correct? Is brown live in your country?

Mike.
 

DIYO

New Member
I am still following this thread, but frankly, I don't want to weigh in on MAINS issues that I don't completely understand.

Your pedal board seems to be common - here is one with several pictures https://www.ebay.com/c/729483579 I don't understand how there can only be two wires - is only one side of the AC being switch or ?

What are the connections from mains to machine to pedal? I might be able to learn something :)
This is exactly why I asked for help, I don't understand why there is only 2 wires going to the foot pedal and not 2 coming from AC and 2 going to the motor...

I, sort of, want to stay out of this. Here's somethings to think about. It;s designed for an incandescent bulb. That is a non-linear load. It's basically a current dependent resistor. The bulbs brightness depends on power, not voltage. It's proportional to V^2.

Speed is more proportional to voltage, not power.

When you phase angle fire a motor. See https://en.wikipedia.org/wiki/Phase-fired_controller you get some strange output that only a True RMS meter can make sense out of.

A cheap DVM averages the input and pretends it is seeing a sine wave. It then multiples that number so what you "see" is the RMS value of only a sine wave. When you feed it nonsense, it returns non-sense.

TRMS or True RMS is what DC voltage will create the same amount of heat as your wacky AC voltage.

Motors are inductive. Triacs turn off at zero voltage and zero current. With a bulb (resistive load) the triac turns on and off at the same time.

You have 1/2 cycles to deal with to, furthermore complicating stuff.

In any event, you have some sort of input say 0-100%. Possibly with a motor you might have Off and 10-100% ir maybe a burst to get the motor started.

let;s just look at the positive half-cycle for a bit. v(t)=A*sin(wt); So we normalize this to V^2 and we don;t care what A is because we need 0-100% power which is proportional to V^2 and we get this tab;e of phase angle and V^2 or time (0-100%) and 0 to V^2 or some f(0-100%) = firing angle and we have to send out pulses from that firing angle measured from V(t)=o to v(t)=0 for one period. We have to continually send out pulses because the motor might turn off at zero current.

For a light bulb, we can turn it on and wait until it turns off. For a motor we have to keep turning it on.

If you want brigtness of an incadesent lamp, you have to convolute the temperature resistance change in there too.

If you want speed, then your f(0-100%) = firing angle is going to be proportional to the ABS(v(t)) over a cycle.

For robust control, the incadesent lamp and the motor controller should incorporate current limiting. and it should compensate for peaks and valleys of the line voltage.

You have a lot of stuff going on and it starts with a good detection of 0 Voltage. Current will not be sinusoidal. You can't overshoot either and you have to keep the waveform periodic and deal with the upper and lower halfs.

Overcurrent and line compensation are finer details.

The lamp will have a resistance about 1/12 the hot resistance when cold.
Thank you very much for all these explanations, at least half of this is clearly far beyond my knowledge, It's clearly more complicated than expected...

If the diagram in the original post is correct then the switching is in the brown line. Is this correct? Is brown live in your country?

Mike.
I created the diagram in the original post by checking which wires were connected with an Ohm-meter so I think it's correct. In France, brown is phase and blue is neutral.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
This is exactly why I asked for help, I don't understand why there is only 2 wires going to the foot pedal and not 2 coming from AC and 2 going to the motor...
There are two going to the motor, but one of them is joined to one of the incoming mains wires, allowing them to use a three pin connector instead of a four pin one. The problem is we don't which wires are joined together.
 

DIYO

New Member
There are two going to the motor, but one of them is joined to one of the incoming mains wires, allowing them to use a three pin connector instead of a four pin one. The problem is we don't which wires are joined together.
Alright, the blue wires are joined together as shown in the schematic in my original post. (Or at least, that's what I determined because the resistance between these 2 wires is null)
 

KeepItSimpleStupid

Well-Known Member
Most Helpful Member
Think of the foot pedal as a switch. It is and it isn't.

A light in a house might be wired with power to the fixture. Then, white and black are wired to the switch. The white wire should be re-coded black with tape.

We have trouble when trying to connect automation devices because there is no neutral in the switch box.

==

The triac or back to back SCR is the basic power controlling element. They need a minimum load on the order of say 50 mA. They can "appear" broken because of the lack of a minimum load.

They "shut off" when the gate current is removed AND either the load drops below the miniimum load (call it zero current) or zero voltage (actually a few volts).

==

When a time varying voltage (lets say periodic) is applied to an inductor, the current is not inphase with the voltage, A quick and dirty definition of an inductor is a device where the current cannot change instantaneously. With a resistor, the voltage and current are in phase.

So, when we turn on the SCR/TRIAC with a motor, it might turn off nearly right away. For that and other reasons, we pulse the gate. This is not what happens in a simplistic dimmer.

Like I said earlier brightness is proportional to power and therefore brightness is proportional to voltage squared.

We have a look-up table of power (%) vs turn-on phase angle and can now figure out when to turn-on the device.

Complications include, we have positive and negative half cycles, frequency can change slightly, Mains frequency can be nominally 50 or 60 Hz.

Current limit is nearly essential, but I don;t know the best way of implementing it. When voltage is first applied to the motor, the instantaneous current is essentially the winding resistance, so at least the triac device has to be rated much higher.

Some have low voltage compensation and true power control.

"Real controllers" can generally do process signal proportional to voltage, current or power with a resistive or tunsten loads. Power and current limiting are common.
 

DIYO

New Member
Think of the foot pedal as a switch. It is and it isn't.

A light in a house might be wired with power to the fixture. Then, white and black are wired to the switch. The white wire should be re-coded black with tape.

We have trouble when trying to connect automation devices because there is no neutral in the switch box.

==

The triac or back to back SCR is the basic power controlling element. They need a minimum load on the order of say 50 mA. They can "appear" broken because of the lack of a minimum load.

They "shut off" when the gate current is removed AND either the load drops below the miniimum load (call it zero current) or zero voltage (actually a few volts).

==

When a time varying voltage (lets say periodic) is applied to an inductor, the current is not inphase with the voltage, A quick and dirty definition of an inductor is a device where the current cannot change instantaneously. With a resistor, the voltage and current are in phase.

So, when we turn on the SCR/TRIAC with a motor, it might turn off nearly right away. For that and other reasons, we pulse the gate. This is not what happens in a simplistic dimmer.

Like I said earlier brightness is proportional to power and therefore brightness is proportional to voltage squared.

We have a look-up table of power (%) vs turn-on phase angle and can now figure out when to turn-on the device.

Complications include, we have positive and negative half cycles, frequency can change slightly, Mains frequency can be nominally 50 or 60 Hz.

Current limit is nearly essential, but I don;t know the best way of implementing it. When voltage is first applied to the motor, the instantaneous current is essentially the winding resistance, so at least the triac device has to be rated much higher.

Some have low voltage compensation and true power control.

"Real controllers" can generally do process signal proportional to voltage, current or power with a resistive or tunsten loads. Power and current limiting are common.
Thank you very much for taking the time to explain this to me, I really appreciate that and I think I understand better now. The module I bought is made for light control and will probably not work (even if wired correctly) with a motor as it's an inductive load. Is there an Arduino compatible module able to control my motor ? If not, is there schematics showing a circuit that can achieve that ?

Thanks again,

Yoann
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Thank you very much for taking the time to explain this to me, I really appreciate that and I think I understand better now. The module I bought is made for light control and will probably not work (even if wired correctly) with a motor as it's an inductive load. Is there an Arduino compatible module able to control my motor ? If not, is there schematics showing a circuit that can achieve that ?
He's vastly over complicating it, the circuit for controlling an incandescent lamp or a small universal model is identical. He's talking about controlling large motors accurately, not simple speed control on small motors. Sewing machines, electric drills, vacuum cleaners etc. all use simple phase shift triac or thyristor circuits, just the same as lamps.
 

Latest threads

EE World Online Articles

Loading

 
Top