17/20
www.rohm.com
© 2016 ROHM Co., Ltd. All rights reserved.
STEPMO_EVK_20x
Evaluation Board Manual
EUDC59-U-002 - Rev. 1.3
●
Library function description / FAQ
How to define the EVK version?
Before including the ROHM steppers library define which stepper motor IC your EVK model is using. E.g. in case of
STEPMO_EVK_206 use
#define BD63720AEFV
See Table 1 for the list of different EVK models.
How to initialize the motor shield?
In the sketch before the setup() function the motor shield is initialized by instantiating ROHM_Stepper class
Example with using the instance name “RS”:
ROHM_Stepper RS(BoardNumber);
BoardNumber depends on how many stacked boards you are using. Predefined values for BoardNumber:
ONE, TWO
See sketch examples for references.
How to enable the motor?
The motor driver ICs have two pins (PS, ENABLE) which must be set on HIGH level to enable the motor. This can be controlled with
the equivalent functions ENABLE(int en) and PS(int ps). For example use
[instancename].ENABLE(ACTIVE);
[instancename].PS(ACTIVE);
Predefined values as referenced in the IC datasheet are for en:
ACTIVE, OPEN
and respectively for ps:
ACTIVE, RESET
.
Both functions are similar as when the IC is set to OPEN with the ENABLE function or to RESET with the PS function the motor
driver outputs are set to high impedance and will not react on a clocking signal. The motor will no longer draw any current and thus
lose its holding torque.
The difference is that the static current consumption of the IC in PS=RESET mode is reduced but also the position of the stepper
motor is being re-initialized when setting PS=ACTIVE again.
If the driver was set to ENABLE=OPEN and then back to ACTIVE the motor driver outputs will go back to their latest values.
If the CLK() function is used directly after the PS(ACTIVE) command it is recommended to add a delay of 40us before clocking to
fulfill the motor driver’s timing requirements.
How to set up the stepping mode (full step, half step, etc)?
Use the method MODE(int mode). For example to set the stepper motor driver in quarter step mode use
[instancename].MODE(QUARTER_STEP);
Predefined values for mode:
FULL_STEP, HALF_STEP, HALF_STEP_A, HALF_STEP_B, QUARTER_STEP, EIGHTH_STEP,
SIXTEENTH_STEP
Default:
FULL_STEP
Note that not every stepper motor driver IC supports every stepping mode. See Table 1 and the IC datasheet for the available
modes.
How to run the motor for N steps
Use the method CLK(int clk) where clk is the number of steps.
Example1 (5 steps):
[instancename].CLK(5);
Example2 (5 steps):
for (i=0;i<5;i++)
[instancename].CLK(1);
Do not use negative values for clk. To change the direction use the method CW_CCW(int dir).
How to set clock speed and direction
Use the method CW_CCW(int dir) to change the direction of the stepper motor rotation from clockwise (CW) to counterclockwise
(CCW). Example for CCW direction:
[instancename].CW_CCW(CCW);
Predefined values for dir:
CW, CCW
There are two methods to change the stepping speed: setCLK_HP(unsigned int hp) and setCLK_Hz(unsigned int Hz), where the first
sets the half period of the clock in microseconds and the second sets directly the clock frequency in Hz. Both methods are effectively
equivalent. The default value for the half period is 1000us. This is equivalent to a clock speed of 500Hz. The stepper motor will
perform on step on each clock cycle. To give an example a motor with 200 steps per revolution running in continuous full step mode
will need 0.4s for one revolution by default.
Note: Do not set half periods longer than 16383us (or clock frequencies lower than ~30.5Hz) otherwise the speed will not be
accurate. If you need lower speed use the delay() function in your sketch to add pauses after each step.
Also note that if the clock speed is set too high the motor may not step accurately or appear to be stuck. The maximum clock speed
depends on parameters such as the motor specifications (current, phase inductance) and supply voltage etc. Please verify the
maximum clock speed your motor can work with.