zondag 27 oktober 2013

Change unipolar 28BYJ-48 to bipolar stepper motor

Now here's something I was not expecting. Previously, I tried to drive this stepper motor with the driver board that came with the motor. My main goal was of course keeping the accuracy of the tiny motor safe and then testing at which speed I could get the maximum torque it could produce. Depending on the driving method, I came up with 300gcm when it was driven using half stepping and 380gcm when I switched to full stepping. Those were actually good results considering that the datasheet predicted these numbers more or less.

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.

That's what happens in a bipolar stepper motor. It has only two windings instead of four in a unipolar stepper. Both windings can be activated all the time, but their polarity is switched in four steps. This means that this kind of motor only has four wires instead of 5 (or 6 or 8). The tricky part is changing the polarity. That cannot be achieved by the simple driver board that came with this motor. It only activates one or two out of four outputs, but current always flows in one direction.

What if we could change the wiring of this motor, thus converting it to a bipolar model? All you would need to do is cut the red wire in the scheme above and then ignore the center connection marked 2+3+6+7. The result would be something like the left drawing.

I found out that this is very easy with this motor. All you need is a sharp knife and a tiny screwdriver. Use the latter to remove the blue plastic cap that hides a small PCB. On this PCB, you can see eleven solder points. All it does is fixate the wiring of this stepper (which can be either unipolar or bipolar by design) into a unipolar type by connecting the center of the two windings. If we cut this connection and ignore it in our scheme, what's left is a real bipolar stepper motor.






This is what the PCB looks like in detail. The red connection in the scheme above is actually the copper connection in this picture that I cut with a cutter knife. That's all you need to do! Well, for your own peace of mind, you could also try to re-attach the blue plastic cover. And now, ignore the red wire of the motor. We don't need it anymore.




But now we have a motor without a driver board. What you need is a H-bridge type which luckily exists in small packages if you're not going to drive heavy machinery. I used a L293D 16 pins DIP chip which I found online for $5.5 for ten chips.

I drew up this scheme that I used to drive the motor with an Arduino (actually I used an Atmega8 on a breadboard doing exactly the same thing, only a bit slower). I'm using 9V on the motor in this test since windings are twice as long as in the original version. I guess you could go much higher than that, this thing never heated up in my test.



My simple code example to drive it can be found here.

Finally, most importantly, my torque test resulted in :

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)

Basically, if I cut one wire in the motor, it gains almost 3 times its original strength.

I like it! A lot! :)



11 opmerkingen:

  1. Cool - Very interesting!
    Thanks for sharing

    BeantwoordenVerwijderen
  2. Thanks for sharing this information!
    I'm still wondering though - does that connection really need to be cut? I mean, in bipolar drive with e.g. , the center taps of both coils are either disconnected or Vcc/2 so they shouldn't interfere with each other, should they? Driving the motor this way with the red wire unconnected does seem to work at least, didn't measure the torque it can deliver though. Tested with bipolar half stepping with an L293D similar to your setup, but also driving its enable inputs to disconnect the coils in the appropriate steps. Couldn't make out a difference whether the trace is cut or not.

    BeantwoordenVerwijderen
    Reacties
    1. Hi, thanks for your remark. I was wondering about this when I write this post, and I must say that in theory it's certainly true. For me, it was not an option because I'm not using the enable inputs of the L293D (it requires two extra pins on the microcontroller) and I'm planning on using a bunch of cheaper chips (L9110S) that don't even have this input, so these appropriate steps are connected to ground when inactive in my setup.
      I might try driving it in full stepping with the red wire connected and measure its current, this would be a nice test just to make sure...

      Verwijderen
  3. Hi Jangeox, I've followed the guide here (https://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors/stepper-motors) which I think is similar with yours. But the "Vin" pin is not connected in the guide, but i still managed to get it working. You mentioned that you are supplying 9V to the motor, I am using a 12V power supply to the Arduino, is it the same? I'm not sure whether I am getting the same torque as you are...

    BeantwoordenVerwijderen
  4. Hey Jangeox,
    thanks for the idea! Can I simply use the small board that came with the ULN2003 and put the L293D on it instead?

    BeantwoordenVerwijderen
    Reacties
    1. Hi, no that won't work, the chips are really completely different. You really need to connect the chip according to the scheme above.

      Verwijderen
  5. Great ideas, thanks a lot.
    I asume that the wires are in sequence Pink=A Orange=NA Yellow=B and Blue=NB
    Is this right?
    Thanks for letting me know

    BeantwoordenVerwijderen
  6. Hi interesting work,
    Will this setup work with the Arduino Stepper library

    BeantwoordenVerwijderen
    Reacties
    1. It should work with the library, although I did not test it. Keep in mind that you must consider it to be a bipolar stepper after you cut the connection on the PCB ... because then it is ;-). The example circuit on the Arduino website is exactly this setup (using L293D)

      Verwijderen
  7. Hi,
    Just to clarify the setup workd with Arduino stepper library.I just had to change pin definitions for my setup.I am supplying 12v to the motor via the L293D and the Torque is really improved although i did not cut the trace i simply left red wire unconnected. This extra torque is just what i needed for my current project so thank you for sharing.

    BeantwoordenVerwijderen
    Reacties
    1. Thanks for sharing your trials!
      In theory and according to your setup, cutting the center trace may indeed be unnecessary. Full stepping should always work (as mentioned in comment above, both taps would always carry Vcc/2 Volts). Half stepping and even microstepping is possible if you use the enabled pin of the driver chip to disconnect the outputs from ground and Vcc in the appropriate steps .. although microstepping is a bit rediculous with this motor ;-)

      Verwijderen