HomeBridge – MQTT Blinds – Part II

After a good first start in my previous blog, I had to find another motor with more torque or some other kind of solution so my big (heavy) blinds wil open and close. So time for Blinds 2.0.

NEMA 17

At first I had some old 5V NEMA 17 Stepper (STP-43D1016) lying around so I tried these. I just simply connected the NEMA 17 motor to the ULN2003A shield and this just worked fine. Then I got excited, was it this simple? I draw a new 3D Enclosure and printed it. Time to test if the blinds works. As soon as I held the tube from the blinds it became obvious this will not work because the stepper will not hold the blinds up when there is no power on the spools, time to figure out another solution.

28BYJ-48

In the original design I used the 28BYJ-48 Stepper motor. but this Motor didn’t had enough torque. Now this kind of motor is not really up-to-date with modern technology. Unipolar stepper motors are not that common anymore. Bipolar steppers are twice as efficient with the same amount of copper on the internal windings. Even in full stepping mode, a unipolar stepper still has 2 out of four wires not active all the time. So basically, if there was a way to run current through all windings in the motor at all times, the thing would be stronger and faster. So the question was: can I convert a Unipolar stepper to a Bipolar? The answer is YES!

Unipolar Stepper vs Bipolar Stepper

Both uni-polar and Bipolar steppers are used widely in projects. However, they have their own advantages and disadvantages from the application point of view. The advantage of a uni-polar motor is that we do not have to use a complex H bridge circuitry to control the stepper motor. Only a simple driver like ULN2003A will do the task satisfactorily. But, there is one disadvantage of uni-polar motors. The torque generated by them is quite less. This is because the current is flowing only through the half the winding. Hence they are used in low torque applications. On the other hand, bipolar stepper motors are a little complex to wire as we have to use a current reversing H bridge driver IC like an L293D. But the advantage is that the current will flow through the full coil. The resulting torque generated by the motor is larger as compared to a uni-polar motor.

L293D

A bipolar stepper motor has one winding per stator phase. A two phase bipolar stepper motor will have 4 leads. In a bipolar stepper we don’t have a common lead like in a uni-polar stepper motor. Hence, there is no natural reversal of current direction through the winding.

A bipolar stepper motor has easy wiring arrangement but its operation is little complex. In order to drive a bipolar stepper, we need a driver IC with an internal H bridge circuit. This is because, in order to reverse the polarity of stator poles, the current needs to be reversed. This can only be done through a H bridge. There are two other reasons to use an H Bridge IC

The current draw of a stepper motor is quite high. The micro-controller pin can only provide up to 15 mA at maximum. The stepper needs current which is around ten times this value. A external driver IC is capable of handling such high currents. Another reason why H Bridge is used is because the stator coils are nothing but inductor. When coil current changes direction a spike is generated. A normal micro-controller pin cannot tolerate such high spikes without damaging itself. Hence to protect micro-controller pins, H bridge is necessary. The most common H Bridge IC used in most Bipolar stepper interfacing projects is L293D.

Interfacing to Micro-Controller

4 micro-controller pins are required to control the motor. We need to provide the L293D with 5 V supply as well as the voltage at which the motor needs to operate. Since we will be using both the drivers of the IC, we will assert the enable pin for both of them.

There are three different ways in which we can drive the bipolar stepper motor. Only one of the phase winding are energized at a time. That is, either AB or CD is energized. Of course the coils will be energized in such a way that we get correct polarity. But only one phase is energized. This type of stepping will give less holding torque because only one phase is energized. In this method, both the phases are activated at the same time. The rotor will align itself between two poles. This arrangement will give higher holding torque than the previous method. The third method is used for half stepping. This method is used generally to improve the stepping angle. Here, in step 1 only 1 phase is ON, then in step 2, 2 phases are ON, then again only one phase is ON and the sequence continues.

Torque

Torque is relatively difficult to measure, which is apt to permit a proliferation of specs on the web that are incomplete and highly suspect. I set up a crude apparatus to get a ballpark estimate of torque from these motors, running at different supply voltages. The apparatus consists of a support for the motor, an arm mounted to the motor shaft, and on the end of the arm (at 10cm from the shaft) a basket into which can be placed weights. I used recent US one-cent coins, which weight 2.5g, and also weighed the various loads on a digital scale.

With this we can make two measurements:

Pull-in torque: Max torque that the motor can exert when commanded to advance from one position to the next. To test this, with the arm horizontal we place a load in the basket and command the motor to lift it. We increase the load until the motor misses steps upon lifting.

Holding or pull-out torque. With the motor stationary and the arm horizontal, we add weight to the basket until the motor can no longer support it. This is generally a much higher torque value than the pull-in torque.

The torque values will be in units of gram-force * cm (g-f * cm). Since the basket is located on the arm at 10cm from the motor shaft, a 15g weight corresponds to 10*15 = 150 g-f * cm of torque.

I repeated the measurements several times, in both directions (the weight on one or other end of the arm). The results shown below aren’t statistically solid (only one 12V sample motor), but are perhaps representative, and are certainly interesting to compare to the spec listed.

Note that these are very low speed measurements. At higher speeds, pull-in torque reduces due to there being less time per step for the change in current to “overcome” the winding inductance and reach its full value. The default torque is 300gcm, when its connected as a unipolar motor (default). But when we connect the motor as described above as a bipolar motor we get a stunning:

800gcm

which is at least twice as much as full stepping unipolar (380gcm) and almost 3x more powerful than my half stepping unipolar test (300gcm).

TESTING FASE

After installing my blind with the standard 12V 28BYJ-48 Stepper Motor in bipolar setup. It works once again kindoff… because the motor isn’t strong enough now it has more torque. So I’ve ordered a new Motor, and I’am going to replaced the standard one.

So back to the drawing board and figure a way out to get this thing working with bigger blinds. Want to see if or how to fix this problem, come back soon, for part three!

Donate

Since October 2015, StudioPieters® has been writing this blog. Help accelerate its development with a small contribution! StudioPieters® is open source, and 100% free . Please consider donating to StudioPieters® before starting the fun of building and learning. StudioPieters® is a non-profit organisation devoted to making creative use of electronics accessible to everyone.