Motor drive for sewing machines

Yes. I think most of the noise is caused by the pulley on the motor gripping the belt and air is compressed out there. Perhaps you could build some kind of noise damping shield around this area. A V-belt might be better, but then you need an extra couple of pulleys on a shaft to make a reduction of about 1:10. Perhaps a larger motor with larger pulley may also reduce noise.

It might be due to some integrator windup of the speed controller, when you disable it. So when you enable the power to the motor, it will start with full power to motor. You need to set the integrator to zero while the power to motor is disabled.

This is normal for both BDC and BLDC motors. The rotational energy is reversed into the DC power supply causing the voltage to rise. I have used a hardware circuit, that switch in a 5 W wire wound power resistor of 6.8 ohm when the voltage increase above 26.5 V and switch off, when voltage drops below 25 V. I also use two extra electrolytic capacitors on the 24 VDC supply to stabilize the voltage better.

In my case, the IBT_2 H-bridge actually also have some build in over voltage shut down. They turn on the upper transistors, when voltage comes above about 27.5 V. In this way the DC motor gets a short circuit. I think I damaged one IBT_2 by this kind of protection, because this kind of braking current can become very high, because the motor resistance is only about 0.15 ohm. It is better to be able to measure the current and limit the current before this happen.

Best Regards, Viggo

If you activate the motor very quickly after deactivating it, there is a chance the motor will still be spinning. This will likely throw off the integrators of the PIDs. However, setting the integrators to zero in this case may not always work, because the true value of these integrators won’t always be zero. Additionally, the rough startup could be caused because the target speed is very far away from the current speed, so it will send full power to the motor to accelerate it to the target speed. Another reason could be incorrect disabling logic which disables sensor readings, which will mean when the sensor is re-enabled, the speed could be wrong initially.

For the current loop, the integrator should initially be set so the output of the PID is equal to the back EMF of the motor, otherwise the control loop might become unstable. This is easily done by setting the integrator to zero when the motor is stopped, however it likely requires some sort of phase voltage sensing to do properly when the motor is rotating. Since my boards do not have phase voltage sensing capability, I haven’t been able to get on the fly startup working properly yet. I’m currently looking at possible ways to get around this limitation without using phase voltage sensing.

In my implementation, where I reset the current integrator to zero on start up, if the motor is already spinning it results in the control loop becoming unstable and a huge current spike occurs. The duration of this current spike is around 200us, which is also similar to the current PID loop response time. The magnitude of the current spike is correlated to the speed of the motor.

For the speed loop, the integrator should initially be set so the output of the PID is equal to zero. This can be done by solving the PID equations for the value of the integrator, given the PID output is zero, the input is the current speed, and the target speed is also the current speed.

I suggest that you don’t disable the motor, instead switch between the speed regulator and the current regulator (keeping the current regulator always active). To “disable” the motor, simply switch to the current regulator and set the target current to zero. This will produce effectively a disabled motor. To re-enable, switch to the speed regulator and set the integrator of the speed regulator as described above. This approach should ensure a smooth startup without having to add 500ms delay.

Another way of fixing the power supply voltage rise is to use a beefy TVS diode across the power rails. Choose a TVS diode with a breakdown voltage around 10% higher than your maximum supply voltage. Make sure that it can handle the power dissipation of the large motor, you may need to parallel multiple TVS diodes to achieve this.

The advantages of this method over the resistor is that it does not need an additional control circuit, and it also does not introduce additional ripple into the circuit. However large TVS diodes are a lot more expensive than large resistors, so this solution would only be suitable for small and medium sized motors.

Thank you for the great suggestion. With this solution, the motor can now be switched off perfectly.

I’m not sure about the overvoltage protection yet.
A Meanwell UHP-500-24 will be used for the power supply. According to the power supply’s data sheet, overvoltage protection is already integrated:
Meanwell UHP 500-24
How does this overvoltage protection work and is it sufficient?

1 Like

Unfortunately the overvoltage protection on the power supply only shuts down the output voltage of the power supply and does not do anything to absorb the excess voltage. It is intended more to reduce the damage to your circuit caused by internal faults in the power supply which result in excessive output voltage. Therefore it won’t work for this application, and your power supply will blow up if you don’t implement some other way of clamping the voltage spike.

If you are using this power supply, I suggest picking a TVS diode with a minimum breakdown voltage of around 26V. One option is the 1.5KE27A from Littlefuse. This diode has a minimum breakdown voltage of 25.7V, which is higher than the maximum voltage of your power supply by a sufficient margin so it won’t activate under normal operation.

You will need multiple TVS diodes, the datasheet says the diodes maximum steady state power dissipation is 6.5W, divide this by 2 to get a good margin against overheating (3.25W). Estimate the amount of energy that the motor will generate in a single regenerative braking event (joules), and multiply it by the maximum frequency you anticipate the motor will operate like this (hertz), so you get the average power dissipation (watts). Divide this number by 3.25 and round up to get the number of diodes you need to parallel.

Also make sure the peak power dissipation of the TVS diodes isn’t exceeded, but for this application it is extremely unlikely.

One disadvantage of using TVS diodes and a power supply with overvoltage protection is that you might experience false trips of the overvoltage protection, due to the TVS diode not perfectly clamping the overvoltage. This is because the maximum clamping voltage of this TVS diode is 37.5V at 40.5A, and this is higher than the overvoltage trip threshold of your power supply (26.4V minimum). However the actual clamped voltage will be significantly lower if the current is limited. In my experience it is around 10% higher than the breakdown voltage, when operated at 10% of the maximum clamping current.

Using the approach of switching a resistor with a high frequency, you might be able to clamp the voltage more accurately, avoiding this issue.

Another approach to this is to store the excess energy in a capacitor instead of trying to dissipate it through a TVS diode or resistor. The maximum ripple voltage allowed by regenerative braking will be equal to power supply OCP voltage - power supply set voltage. Now using the capacitor energy formula E = 0.5CV^2, and the above voltages, solve for the capacitance required so the difference in capacitor energy between those two voltages is equal to the regenerative braking energy. Round this up to the nearest available capacitor value and add this capacitor to your circuit to absorb the regenerative braking energy.

If using this approach, I suggest including one TVS diode anyway in case you made a calculation error or something unexpected happens. To minimise the capacitance needed, you need to increase the available voltage range. One way is to adjust the power supply set voltage to be lower. You can also use a diode to block the reverse current, in this case the maximum voltage will not be limited by the OCP threshold anymore and will be limited by the maximum motor driver input voltage.

I hope one of these solutions is suitable for you.

Nice to see, that this integrator windup problem got solved by the suggestion from Andrew.

What type of sewing machine do you plan to use the drive for?

I have looked at the datasheet for the motor here:

It seems like the short term max torque is 2.16 NM or perhaps 1.44 NM. With a strong household sewing machine I aimed for 3.5 Nm on main shaft, and then at gearing to motor of about 1:2.4 might be reasonable. But if you do not need high sewing speed, you may like to make a higher gear ratio and then limit the current to reduce the max torque applied to the sewing machine.

The moment of intertia of motor, I = 1080 gcm2 = 0.108 E-3 kgm2. With a max speed of 4000 rpm on motor, the max rotational energy in the motor equals ½ x I x w2 = 9.5 J.
I would guess, that the rotation energy in sewing machine might be the same as the motor, so it makes 19 J in all. So if you convert all this mechanical energy back to DC supply, the power dump device should be able to handle that. It is however a worst case situation, that is not likely to happen often. Furthermore the losses involved in the braking likely will consume a significant amount of this energy.

If you assume a large electrolytic capacitor of 10.000 uF on the 24 V supply, then 19 J would charge it to about 70 V. Therefore you need more than a large capacitor to dump that energy.

I agree with Andrew, that it will be easiest to use one or more transil diodes to dump this energy, and in most cases the power circuit should be able to withstand an over voltage of 30 % like 31 V in this case. In my case the margin was lower, because I wanted to limit the voltage to about 27 V, and then the simpler circuit with transil diodes is less applicable. From the datasheet provided by Andrew, one diode should be able to take a transient non-repetitive power of 500 W in 10 ms. It makes 5 J. Therefore I think 4 of these diodes in parallel should be sufficient to dump the 19 J. The price here is 0.18 euro each:

I like your load cell for the pedal. I think it might be easier to use, but is such a cell expensive?

The air pressure sensor I use have an issue with temperature variations, that influence the pressure. I made some software able to adapt changes in pressure due to temperature changes, but it ads complexity. I furthermore use a non-linear element (part of parabola) in software of the pedal pressure signal in order to make the low speed control easier. I made the slope at start 20 times lower than slope at max speed.

I have made a recording of a kick to the pedal as well, and it looks like this. It made a move of 43 degrees on the sewing machine shaft or 452 degrees on motor:

In this case, the controllers mostly work with a current limit mode at +/- 26 Amp. The pedal value is sampled each 10 ms, and it causes the steps you see. At 160 ms the H-bridge is disabled by a condition of a filtered tacho speed signal is below a threshold AND the pedal is at stop position.

Thank you for your great answer. The 1.5KE27A TSC diode is a simple and good solution. These diodes are quite inexpensive. I will buy a few of them and connect them in parallel.

The motor will later drive a Pfaff 138 industrial sewing machine. The maximum sewing speed should later be around 2500 stitches per minute.

I tried to measure the moment of inertia of the sewing machine. In my measurements, the friction of the sewing machine’s mechanics always dominated.
A large part of the energy is probably absorbed by friction during braking.

For this project I am using a €5 load cell. A cheap load cell was the best solution in my case. Industrial sewing machines have a fixed pedal that is connected to the motor drive via a chain or rod. So all I need to do is screw a screw hook into the load cell and then attach the chain to it.
My loadcell

Oh, that sounds interesting. What pressure sensor do you use in your project?
In my company we use pressure sensors that internally compensate for temperature deviations.
Load cells also have temperature drifts. But I haven’t seen any major deviations in my tests.

In microcontrollers I like to use lookup tables for calculating non-linear functions. For example, you can use the pedal value as an index and access the table. And as a result you get a value for the motor controller.
Lookup Table Generator

Yes, I agree. My calculation is likely a worst case scenario. However, by stressing my machine with repeated brakes, my used dump resistor got hot.

My temperature problem is not caused by the sensor. You got a confined space of air, and when the temperature increase, the pressure increase according to ideal gas law. The confinement is silicone tubing, and it do not expand that much as the air do. I use an Omron sensor, and the typical price is about 7 euro:
https://omronfs.omron.com/en_US/ecb/products/pdf/en-2smpp-03.pdf

You can see my pedal in this video (it was also above some place): https://youtu.be/w9AfNjH3q4Y

I have set a max speed at a force on pedal of 40 N, and it provides an air pressure of 60 hPa. The motor starts to move at a force of about 4 N.

Elna and Singer made some sewing machines with air pedals back in 1980ies. I guess that it was this temperature problem, that caused them to abandon this principle.

I think your solution with the load cell will remove the temperature problem, but you get some more wires and cables to take care of. Force control like this is a good solution.