Motor drive for sewing machines

Please keep in mind that the motors you chose are multicopter motors, designed to operate in the fast moving air of a flying multicopter. Those motors will overheat badly unless you have a big fan blowing directly on them. Those motors are not designed to be operated statically and have no way to properly dissipate the heat generated when working.

Also, in a multicopter, the motor works harder when the propeller spins faster. At low RPM, there’s negligible torque and very low amps. By having the propeller act as a fan, the motor is self-regulating: the more power required, the faster the propeller turns, the more air to remove the heat.

In your application, you need plenty of torque at low speed, so you cannot rely on a blower operated by the motor. You will need a separate motor to operate a fan.

Motors designed to work statically, have much more thermal mass to soak up the heat, plus fins or other venting tricks to dissipate it in the environment. Multicopter motors, on the other hand, are designed to be as lightweight as possible and have no provision to dissipate heat outside of the propellers.

Put it another way, those motors will not work for you. You need motors designed for a skateboard or RC car, or designed as an industrial motor.

Thanks for your comments.

Yes, I am aware, that when you use these kind of motors without forced cooling, you will have to downgrade. But how much? I guess that these kind of motors can work, if you downgrade their power sufficiently, and if you read my numbers and calculations above, I did downgrade, but perhaps not enough.

The Tarot 6S 3515 Kv400 motor is specified by supplier to manage 28.4 A continuous current and we must assume in very good forced air condition. The internal resistance is specified to be 85 mOhm and I guess it is at 20 C. I would consider a copper temperature of 200 C in max load condition, and it would change the resistance to about 145 mOhm. The copper loss will then be 117 W in max continuous current condition.

In my specification for the sewing machine I consider with same motor a thermal current of 10 A with 25% duty cycle. In this case I would think of the cobber to reach 100 C and 112 mOhm, and you then get 2.8 W mean power loss in windings. You might sew with 11.2 W loss for a 20 sek period. I just think, that the motor should be able to handle that without getting too hot. Did I get this wrong?

Interesting, try it out! We all learn from experiments like this. I’m sure you can make it work. Maybe a little smoke and glowing stator, it really depends on the force.

I have looked at motors for RC car, and in general they are designed for very high rotational max speed - typically 40.000 rpm. With a belt drive I do not like to go much above 10.000 rpm, because then you will find that the specifications on timing belts typically will not be specified or significantly downgraded. If you then go for 20.000 rpm max, the ESC should typically operate at 12 VDC, so you get very high currents.

Motors for skateboards seems much more reasonable. I just looked at this one:
https://vi.aliexpress.com/item/1005006572005808.html

Specifications
Price 29 euro
Kv value: 270KV
Power: 2500w
Resistance (m ohm): 38
Reactive current (A): 1.7
Adapted tones (A): 80
Voltage: 11.1-36v
Motor outer diameter C (mm): 50
Motor height B (mm): 59
Shaft outer diameter A (mm): 8

Initial calculations:
Power 36 V x 80 Amp = 2880 W. But max 2500 W.
Will assume max current of 2500W/36V = 69 A
I estimate power loss to be 2 x 38 mOhm x 69^2 = 366 W.
(I daubt very much that this loss and power can be handle unless very shortly)
The unloaded speed is 270Kv x 36 V = 9720 rpm.
I assume that the speed will drop to about 80 % of that at max load - 7776 rpm
The torque in this condition is then (2500 - 266 W) / (7776 x 0.1047) = 2.6 Nm
At 24 VDC I assume a less load speed of about 0.9 x 270 Kv x 24 V = 5832 rpm.

Then I should use a gear ratio of 2.9:1.
Max short term torque on motor will then be 3.5 Nm/2.9 = 1.2 Nm.
The estimated current for this short term torque is then 32 Amp.
The estimated thermal current is: 11 Amp (25 % duty cycle)
The mean power loss should then be about 1.5 W

I like the Ø8mm shaft better due to the belt loads.

If you “derate” the motor significantly, it might be possible to make it work without issues. One of the problems, is that the majority of drone motors are outrunners, and there is no way to easily add fins to dissipate heat (whatever heat sink you add, must rotate at the motor speed and be perfectly balanced. Inrunner motors like in skateboards can use an heat sink encasing the body, and any arrangement works. It’s also harder to measure the temperature in a outrunner, given that the body of the motor spins (you need an IR thermometer, but unless you understand what emissivity is and how metal behaves with IR, the temperature you read can be off by 30% or more)

Outrunners have more power per unit of mass, usually, which is a big consideration in a drone: each extra gram that the motor weighs, gets multiplied by 4-6-8 and requires extra power to lift. But are harder to cool in a static application

I guess this is a case of trying and carefully measuring the magnet temperature during and after use. More than anything, I wanted you to be aware of these considerations, not necessarily to rule them out for your use. I realize my previous message was a bit off message in this respect

Thanks for your comment. Yes, the optimizations involved for a drone motor do not fit for a sewing machine. The only thing that fits is, that motors are produced in large numbers, and then the price go down.

It seems to me, that the motors for skateboards mostly are out runner motors. I found this link for detailed parts:
https://vi.aliexpress.com/item/1005006541221940.html

It seems that the same motor for skateboards at same price level got more weight and less winding resistance, and then they will be better for a sewing machine.

I’m here for the same reason, but more out of curiosity. I use two vintage sewing machines, with proper industrial motors. I just bought another home sewing machine with a vintage motor, whose circuits and motors are now 40 years old and hard to find, but had some neat features specifically needle positioning - I bought it because it has one of the smallest freearms you can find in a sewing machine + zigzag.

OK, so first thing first, you can get a good industrial motor controller, this is the one I like:

Excellent low speed motor control + needle positioning = pure bliss.

I also have a Chinese one as well, which is kind of hot garbage, its slow speed control is really bad, but it’s needle positioning does work, it tends to jump at slow speed and is hard to control and error prone:

https://www.amazon.com/gp/product/B07VNQ5VJR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Although I kinda wonder about the details for the motor for this one, it might actually be a good motor just with a bad controller - it obviously can sense position.

The new vintage sewing machine I just bought hasn’t arrived yet, but in 1970 it had proper needle positioning, so it could stop the needle in the up position when you pushed a button.

I had this dorky idea just sticking a different motor on the side of this new machine, and adding automatic needle positioning, where it positions the needle either in the up or down position when you lift your foot off the pedal, and then add an automatic tie off function, where when enabled the machine runs the stitch forward and back 3 times, when you first start sewing, and does the same when you push a button to stop sewing. The other thing I want is to set max speed, sometimes you just want to rip through a bunch of stitches, and sometimes you want a slow max speed for fine detail control.

I have a modern Singer and I find needle positioning and automatic tie off to be big time savers, along with the max speed slider, but the modern Singer is otherwise a terrible sewing machine.

The 1970 machine with the needle positioning was kind of dead stupid, when you pushed the button for needle positioning, it would run the motor at a low speed until it hit a switch and stopped.

I’m not sure how my modern Singer does these things, but I’d be surprised if it is anything as complex as FOC. I should disassemble it and look, but my guess is optical sensor + simple DC motor control.

1 Like

I’m also working on a sewing machine project. My solution:
2 hall sensors (Upper and lower needle position) either on the main shaft or on the needle guide, depending on the design of the sewing machine
A custom software encoder that outputs 4 needle states

  • Upper position
  • It goes down
  • Lower position
  • Rising up
    And calculates the current number of stitches per minute
    The motor is controlled with the following parameters:
    Smooth start
    Speed control via pedal potentiometer
    Setting maximum revolutions (stitches per minute)
    Stopping at a given needle position
    Changing the needle position by briefly pressing the pedal (upper lower)
    One stitch with a short press
1 Like

That’s really cool, I’d love to know more!

Have you looked at or played with any of the industrial servo motors for sewing machines?

I might be following in your foot steps, depending upon the condition of the machine I ordered.

I do kinda wonder if @Backflip had specific ideas in-mind where FOC would be game changing.

For example, having the needle position snap up or down when you’re slowly moving the hand wheel. But you could still do this with the system you described.

I disassembled my modern Singer last night and it’s clear it’s just using a regular DC motor with sensors on the hand wheel for needle position, but since there is a massive gear reduction from the DC motor to the hand wheel there is a lot of control that is possible.

I did read about one of the industrial machines having a two mode pedal, where you could use it like a normal pedal, or pivot it in the reverse direction to sew in reverse, or to have it tie off the stitch.

No, but there’s nothing special there. Servo drive with encoder and controller

This is not the reverse of rotation, it is the reverse of the toothed rail of the fabric promotion. (Sorry, I do not know how to correctly use specialized terms in English) On most machines, this is done mechanically. On industrial machines, levers are made to turn on the reverse with the knee.

I’m still at the very beginning of the journey trying to figure out simplefoc. It is necessary to implement an encoder and then it will be clear how it will work.

It is nice, that we got two other users of sewing machines here. I like you to read my first two posts in this thread including the links. I am sorry to say, that I do not agree with more of your statements, celer. But I hope, that we can get a good exchange of opinions.

I do not agree, that this motor got excellent low speed motor control at all. I found video about this servomotor:

You see, that the lowest speed setting is 5, at it will normally mean 500 rpm. It might be lower, but normally you cannot have these kind of servo motors for sewing machines run below 100 rpm. It means that the speed range might be 500 - 6000 rpm or perhaps 100 - 6000 rpm. It is a speed range of 1:12 or 1:60. But I like to have a speed range of 1:250 at least.

I have seen one expensive brand of servo motors, EFKA. Some of their motor drives can manage down to 10 rpm on motor.

I agree, that you need needle stop with a good sewing machine drive. But you should be able to do an easy switch on an off of needle stop, and to move to next position easily. The good low speed control is needed, when you do not want to use needle stop, and with some sewing jobs you do not want needle stop.

Many of the needle stops, that you get for the industrial sewing machines are made wrong, because the stops are spaced 180 degrees, and it should not be like that. The upper needle stop is easy, and should be at highest needle position. Some more advanced machines may drop the feed dogs as well for easy removal of fabric. The low needle stop needs to be later than lowest needle position and after the hook have gripped the upper thread. So it will typically be with the top of the needle eye at surface of needle plate. In this way you can turn the fabric without the risk, that the hook may not catch the thread at next stitch.

Most servo motors for industrial sewing machines on the market place do not use FOC, but they have got 3 digital hall elements in the motor, that controls the commutation to 6 positions in every electrical cycle. On top of that they use PWM. I consider this as an old outdated way of motor control. Furthermore, they have got an optical encoder inside, but they will normally have below 100 lines. It limits their possibility for good low speed control.

Therefore my aim for a new motor drive is to get significantly better performance, and the motor size should be smaller and not like the bulky industrial servo motors.

upper position, SPM: 43.34
goes down
lower position
goes up
upper position, SPM: 47.67
goes down
lower position
goes up
upper position, SPM: 43.31
goes down
lower position
goes up
upper position, SPM: 33.31

The encoder on two hall sensors has been written to check whether it is working.
Now the main task for me is to understand how to control the motor using this data through simplefoc.

I have a test motor with 12 coils on which there is an encoder that outputs 7 pulses per revolution.
Voltage 12V: no-load current 0.56A, no-load speed 1700 rpm.
Voltage 24V: no-load current 0.65A, no-load speed 3400 rpm.

I tried to rotate it in open-loop mode, I haven’t figured it out yet and I don’t understand in which mode it is more important for us to work for our task

Ok, thanks for clarifying!

I use my industrial stepper motors on cup-feed chain-stitch sewing machines not a lock stitch machine, and at least for my cup-feed machines, with proper belt reduction it can move the needle pretty slow - but I understand your desire for really nice low speed control.

I got one of the cup-feed machines for cheap because it had the original 1930s clutch motors on it and the tailor who sold it to me told me she sold it because none of her employees could use it without breaking needles - which for that machine is all about low speed control and needle positioning.

I ordered a motor, driver and sensors to play with. I would like to understand FOC better and go from there.

I got a Nema17 26W 24V BLDC motor (42BLS01) which I don’t expect to be powerful enough to do much beyond low speed/low load testing - if even that. I’m not sure which driver to choose, so I figured I’d start with a DRV8313, which I’m certain won’t last long - I want to see if I get anything working at all, then go from there. The motor has hall sensors, and I ordered a AS5600 as well.

I’d like to play with both using hall sensors and the AS5600. I don’t have any motor control experience, I do have some digital electronics experience, I have a few ESP boards monitoring and controlling stuff, and I’ve fabricated a few boards and populated them.

It will be a few weeks before I get everything.

At this point my next step is I just want to get something to work in a basic open-loop mode, then move to closed-loop. I know I didn’t order the right stuff but I just wanted something to play with as a start.

My target is getting a Pfaff 1222E to spin with FOC - I think this motor might be able to get it to spin, but I’m pretty sure the driver I got won’t be enough.

My approach with this stuff is iterative, so as I make progress I’ll order better hardware.

OK, my guess is closed-loop velocity control.

My reason for this is Pfaff service manual for the 1222 talks about the importance of constant speed and how their motor control varies the torque to keep the motor speed constant - which makes sense. If you’re sewing you’d ideally want the speed to be constant or what the user has commanded, regardless of the load on the machine, because it would allow the operator accuracy as the machine is behaving consistently.

My thinking was the closed-loop velocity mode with the PID controller made sense. But I’m just guessing.

It also occurred to me that it would be easy and cheap to design and 3D print a pedal using the AS5600 as the rotation sensor, with some gearing to get a high accuracy foot pedal design, instead of using a potentiometer; although that being said cheap potentiometer based foot pedals are widely available.

.

That would certainly be possible, and the AS5600 would work very well for this - a much easier problem than motor control.

Pedal design is another issue, and I think this is about how you can design something, that make your muscles make an analog signal in a precise and fast way. This problem was solved for the controls used by pilots of fighter aircraft i 1970ies. They use controls based on variation of force and the distance of a movement do not matter that much. But too much movement of some pedal will make a change of speed slower. Unfortunately only a few sewing machines have adopted this concept, but Elna and Singer actually made some pedals back i 1980 to 1995 based on air pressure. In this way it becomes a variation in force, that you apply to the pedal, that change the speed.

It is so that (without looking), you can with your muscles control a force on something much more accurate, that you can control a position. Therefore the standards that specify how controls of an aero plane needs to be made is based on how much force, that you apply. The distance the controls may alter due to the force is less important.

Many of the pedals used on sewing machines are in my opinion designed incorrectly related to this knowledge, and they do not change the force that much when you change the speed from lowest speed to max speed, while the pedal is pressed down. It is the relative change in force, that is important to make good speed control. I have a similar method as Elna did, and use some silicone tubing to be pressed by the pedal, and then you use an air pressure sensor at the electronics with the sewing machine. You see a bit about that in this video:

1 Like

hello everyone,

I’m currently working on a similar project. We have a lot of old sewing machines at home. However, their motors are too weak to sew through thick material such as denim.
I’m now posting my experiences and questions in this thread. I hope that’s okay.

The first thing I bought was this BLDC motor together with a suitable motor driver:

57BLF01
ACT BLDC-8015A-5

The whole thing works pretty well and is a pretty simple solution.

Next I want to try out SimpleFoc for the motor control. I have now bought the DRV8302 as a driver board. The Hall sensor control works and I can already control the motor with the Voltage Torque Control. The next step I wanted to try was the DC Torque Control. But I’m having trouble parameterizing the PID-Q controller. The controller is extremely unstable. Does anyone have a tip for this?

#include <Arduino.h>
#include <SimpleFOC.h>

// DRV8302 pins connections
// I use the NUCLEO_G071RB board
#define   INH_A PA8
#define   INH_B PB3
#define   INH_C PA10
#define   INL_A PA7
#define   INL_B PB14
#define   INL_C PB15

#define   EN_GATE PC4
#define   M_PWM PC5
#define   M_OC PD9
#define   OC_ADJ PD8
#define   OC_GAIN PB5


#define IOUTA A0
#define IOUTB A1
#define IOUTC A2

#define HALL_A PB0
#define HALL_B PC7
#define HALL_C PA9


HallSensor hallSensor = HallSensor(HALL_A, HALL_B, HALL_C, 4);

BLDCDriver6PWM driver = BLDCDriver6PWM(INH_A, INL_A, INH_B, INL_B, INH_C, INL_C, EN_GATE);

// DRV8302 board has 0.005Ohm shunt resistors and the gain of 12.22 V/V
LowsideCurrentSense currentSense = LowsideCurrentSense(0.005f, 12.22f, IOUTA, IOUTB, IOUTC);

BLDCMotor motor = BLDCMotor(4, 0.93f, 160);

Commander commander = Commander(Serial, '\n', true);

void onMotor(char* cmd){ commander.motor(&motor, cmd); }



// Interrupt routine initialization
void handleHallA() { hallSensor.handleA(); }
void handleHallB() { hallSensor.handleB(); }
void handleHallC() { hallSensor.handleC(); }


uint32_t time_ms = 0u;

void setup() {

  hallSensor.pullup = Pullup::USE_INTERN;

  hallSensor.init();
  
  hallSensor.enableInterrupts(handleHallA, handleHallB, handleHallC);

  // DRV8302 specific code
  // M_OC  - enable overcurrent protection
  pinMode(M_OC,OUTPUT);
  digitalWrite(M_OC,LOW);
  // M_PWM  - enable 6pwm mode
  pinMode(M_PWM,OUTPUT);
  digitalWrite(M_PWM,LOW);
  // OD_ADJ - set the maximum overcurrent limit possible
  // Better option would be to use voltage divisor to set exact value
  pinMode(OC_ADJ,OUTPUT);
  digitalWrite(OC_ADJ,HIGH);

  pinMode(OC_GAIN,OUTPUT);
  digitalWrite(OC_GAIN,LOW);

  driver.voltage_power_supply = 24;
  driver.pwm_frequency = 15'000; 
  driver.init();

  Serial.begin(115200);

  commander.add('M', onMotor, "motor");

  motor.linkSensor(&hallSensor);
  motor.linkDriver(&driver);

  motor.voltage_sensor_align = 2;

  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;

  motor.torque_controller = TorqueControlType::voltage;

  motor.controller = MotionControlType::torque;
  motor.current_limit = 4;

    // current q loop PID 
  motor.PID_current_q.P = 1.5;
  motor.PID_current_q.I = 20;
  motor.LPF_current_q.Tf = 0.005;

  motor.init();

  currentSense.linkDriver(&driver);
  currentSense.init();

  currentSense.gain_a *= -1;
  currentSense.gain_b *= -1;
  currentSense.gain_c *= -1;

  motor.linkCurrentSense(&currentSense);


  motor.initFOC();

  _delay(1000);
}

void loop() {

  commander.run();

  motor.loopFOC();
  
  motor.move(0.5);
  //motor.monitor();

  //Serial.print(hallSensor.getAngle());
  //Serial.print("\t");
  //Serial.println(hallSensor.getVelocity());

  /*
  if (millis() - time_ms > 50){
    PhaseCurrent_s current = currentSense.getPhaseCurrents();
    Serial.print(current.a);
    Serial.print("\t");
    Serial.print(current.b);
    Serial.print("\t");
    Serial.print(current.c);
    Serial.println("");
    time_ms = millis();
  }
  */
  
}

I also thought about the pedal. I want to realize the pedal using a load cell.
I think controlling the pedal using air pressure is a pretty cool idea. The system must not have any leaks. Otherwise you will have a problem with long seams.

Best regards
Nico

1 Like

I can’t continue the experiments yet. Burned MKS DUAL FOC V3.1 BLDC waiting for a new one

I fixed the problem last night. The Current Sense is not working properly on my STM32G0. I then ported the project to a Nucleo F429ZI. The motor seems to be running stable :slight_smile:

What still worries me a bit is the motor mount. My motor gets relatively warm when running continuously. Maybe almost too warm for a 3d printed motor mount.

1 Like