Thursday, January 29, 2015

Controlling two stepper motors using msp430

In this post, I want to show how to control two steppers motor using msp430g2553. Of course, the driver used is easydriver.

I modified the source code in first blog and rewrite it in more systematic order and more functions are added.

The port 2 of msp430 launchpad is used as it coincidently has six pins, the control of one easydriver more of less need three pins for interface, so two stepper motors control need six pins.

The pins used are shown in figure below.


The port 2.0 to 2.2 are used to control first stepper motor, the port 2.3 to 2.5 are used to control second stepper motor.


Previously mentioned, the three pins are interfaced with easydriver
(MOTOR_X_DIR_PIN,
 MOTOR_X_STEP_PIN,
 MOTOR_X_SLEEP_PIN).

The MOTOR_X_STEP_PIN is used to send continuous pulses from launchpad to easydriver
(post 1).
The MOTOR_X_DIR_PIN is used to decide the rotational direction of stepper motor, clock wise or anticlockwise.
The MOTOR_X_SLEEP_PIN is used to disable or enable the easydriver IC. Even when the launchpad is not sending pulses to easydriver, the easydriver still sourcing current to stepper motor to hold the motor shaft in present position. When the easydriver is sleep (by sending 0 signal), easydriver is not sourcing current and the motor shaft can be easily moved.


The pins assignment are as follow:

The stepper motors are addressed as A and B. The naming which has A indicates the first stepper motor, B indicates the second stepper motor.


In order to control two steppers motor concurrently, the instruction sent must be delivered in the same time, so the pin of stepper motor A and B are combined.


Only three functions are need in the main program

the motorsInit() function set the IO pins for interfacing with easydriver,

      motorsRunCycles(int stepper_cycles) function controls the stepper motor
      turn how many circles.
      If stepper_cycles > 0, the stepper motor run in clockwise direction,
      If stepper_cycles < 0, the stepper motor run in anti clockwise direction.

for motorsGotoPosition(int stepper_degrees) function, you can turn from -360 to 360 degree.
      from 0 to 360 degrees, the stepper motor run in clockwise direction,
      from 0 to -360 degrees, the stepper motor run in anti clockwise direction.
      (the smallest resolution is one degree).


Last, the interfacing between launchpad, easydriver, and stepper motor is shown as follow


All the source codes are shared in github.







Wednesday, January 28, 2015

Temperature of easydriver

In the first post, I didnt put heatsink on the easydriver, the temperature of IC is very hot, by putting extra heatsink, it help to cool down a bit. In order to hold the heatsink tight to IC, I put some thermal paste in between and after it dry, it is holding good.

I use two different heatsinks to cover the stepper driver IC.


For this easydriver, I use the normal surface mounted type heatsink. The size nicely matched.


For this one, I am using the TO220 heatsink, a little oversize, but the IC is well-covered.

Size comparison between two heatsinks are shown as follow, a dip 8 socket is put as benchmark.



The heat distribution of both easydrivers are as follow.

The temperature of surface mounted heatsink is much higher than the TO-220 heatsink. I took a closer picture on the first driver, the temperature is 107 Celsius (figure below).


For the second driver, it has much lower temperature and much better heat dissipation. The jumper wire blocking the thermal sensing. Anyway the hottest part is 85 Celsius.
I only left the easydriver on for 3 minutes and look at the temperature.

Imagine the temperature of easydriver without heatsink and you run it for half an hour.
So heatsink is crucial from stepper motor driver as it has low efficiency.

The selection rule for heatsink is the bigger, the better.

Monday, January 12, 2015

EasyDriver

Recently I got the some free time to try the easydriver I purchase from myduino, currently selling RM35, and I double check the element14, it sell the single A3967 ic for RM16.63. For hobbies, just use the easydriver cause it really worth the price, don't bother make one yourself, you cant beat the price and the time spent.

I have two stepper motors I purchased from cytron years ago (it is now obsolete).

The easydriver is for bipolar stepper motor but the one I brought from cytron is unipolar stepper motor which has 6 cables. Nevertheless, the 6 wires unipolar can be connected to easydriver by ignoring the centre point of each coil.

The guidance of connecting unipolar to easydriver is shown in Brian Schmalz website and he adds some detail descriptions on how to use the easydriver.

For the Minebea-Matsushita stepper motor I used, the 2rd (RED) and 5th (BLUE) wires are the centre point (can be ignored).


We can use the multimeter's ohm function to verify the centre point.
The resistance between BLACK and BROWN wires is equal to resistance between (black, red) plus resistance between (red, brown).

RBLACK_BROWN = RBLACK_RED + RRED_BROWN.

Same steps used to test the other coil wires (green, blue, purple).

One of the best things about easydriver is the control is very simple. From example, if your stepper motor has 200 steps, all you need to do is sending 200 pulses to stepper motor and it will rotate 360 degrees. If you send 100 pulses, then stepper motor turn 180 degrees.

The easydriver has microstepping function where you can choose 0, 2, 4, or 8 microsteps. By default, it is 8 microstepping. So the maximum controllable range is 8 times 200 (the stepper motor's steps) equal to 1600. 1600 pulses are needed to complete one cycle (360 degrees).

The connection of easydriver and stepper motor is as follow



I use 12v battery as power source, while the control part, the I use the msp430 launchpad (msp430g2553).

One of the things I noticed is the temperature of easydriver get extremely high after running it for 10 minutes (total current drawn is roughly around 400 mili amp). I would suggest extra heatsink for the easydriver.

The source code for this program is shared in github.