Unipolar stepper motor operation library
Dependents: LAB04_Oppgave1 test_stepper Stepper_Motor_Demo StepperMotorUni_Hello ... more
Unipolar stepper motor library
This library generates pulses on 4 digital output pins of the mbed. The pulses are generated by mbed's ticker function.
The mbed pins cannot drive the stepper motor directly. So it requires driver stage for the motor. The circuit may be like following diagram.
The driver stage should be chosen by requirement for the stepper motor.

The mbed generates pulses on 4 output pins for external driver stage.
This library can generate 3 types of pulses.
1 phase drive (wave drive)

2 phase drive

1-2 phase (half step) drive

Components pages
Components pages are available for bipolar and unipolar motor libraries
Revision 2:6835e719ff96, committed 2015-04-21
- Comitter:
- okano
- Date:
- Tue Apr 21 14:33:20 2015 +0000
- Parent:
- 1:5de3a9848490
- Child:
- 3:0eec6148e739
- Commit message:
- ramp control function enabled
Changed in this revision
| StepperMotorUni.cpp | Show annotated file Show diff for this revision Revisions of this file |
| StepperMotorUni.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/StepperMotorUni.cpp Mon Apr 13 21:10:56 2015 +0000
+++ b/StepperMotorUni.cpp Tue Apr 21 14:33:20 2015 +0000
@@ -277,8 +277,8 @@
//printf( "%d>>>%d\r\n", current_pos, target_pos );
if ( speed_rate != 1.0 ) {
-// t.detach();
-// t.attach( this, &StepperMotorUni::motor_maintain, ((1.0 / (float)pps)) / speed_rate );
+ t.detach();
+ t.attach( this, &StepperMotorUni::motor_maintain, ((1.0 / (float)pps)) / speed_rate );
}
if ( target_pos == current_pos ) {
--- a/StepperMotorUni.h Mon Apr 13 21:10:56 2015 +0000
+++ b/StepperMotorUni.h Tue Apr 21 14:33:20 2015 +0000
@@ -234,7 +234,17 @@
*/
void set_steps_per_rotate( int steps );
+ /** Setting for ramp control
+ *
+ * This function enables the ramp-up and ramp-down of the motor behavior
+ *
+ * @param initial_speed_rate speed rate. if the pps was set to 50pps and
+ * initial_speed_rate is given like 0.1, the ramp-up-start and ramp-dowm-end
+ * speed will be 5pps (= 0.1 * 50pps)
+ * @param ramp_steps the steps for ramp-up and ramp-down.
+ */
void set_ramp_control( float initial_speed_rate, int ramp_steps );
+
private:
Ticker t;