-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
743 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Demo / test acceleration parameters | ||
* | ||
* Copyright (C)2015-2017 Laurentiu Badea | ||
* | ||
* This file may be redistributed under the terms of the MIT license. | ||
* A copy of this license has been included with this distribution in the file LICENSE. | ||
*/ | ||
#include <Arduino.h> | ||
#include "BasicStepperDriver.h" | ||
|
||
// Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step | ||
#define MOTOR_STEPS 200 | ||
|
||
// Since microstepping is set externally, make sure this matches the selected mode | ||
// 1=full step, 2=half step etc. | ||
#define MICROSTEPS 16 | ||
|
||
#define DIR 5 | ||
#define STEP 9 | ||
|
||
// 2-wire basic config, microstepping is hardwired on the driver | ||
BasicStepperDriver stepper(MOTOR_STEPS, DIR, STEP, 10); | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
|
||
stepper.begin(120, MICROSTEPS); | ||
|
||
/* | ||
* LINEAR_SPEED profile needs the acceleration and deceleration values | ||
* in full steps / s^2. | ||
*/ | ||
stepper.setSpeedProfile(LINEAR_SPEED, 1000, 1000); | ||
|
||
Serial.println("START"); | ||
stepper.startRotate(360); | ||
} | ||
|
||
void loop() { | ||
static int step = 0; | ||
unsigned wait_time = stepper.nextAction(); | ||
if (wait_time){ | ||
Serial.print(" step="); Serial.print(step++/2); | ||
Serial.print(" dt="); Serial.print(wait_time); | ||
Serial.print(" rpm="); Serial.print(stepper.getCurrentRPM()); | ||
Serial.println(); | ||
microWaitUntil(micros() + wait_time); | ||
} else { | ||
stepper.disable(); | ||
Serial.println("END"); | ||
delay(3600000); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Multi-motor control | ||
* | ||
* Move two or three motors at the same time. | ||
* | ||
* Copyright (C)2017 Laurentiu Badea | ||
* | ||
* This file may be redistributed under the terms of the MIT license. | ||
* A copy of this license has been included with this distribution in the file LICENSE. | ||
*/ | ||
#include <Arduino.h> | ||
#include "BasicStepperDriver.h" | ||
#include "SyncDriver.h" | ||
|
||
// Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step | ||
#define MOTOR_STEPS 200 | ||
|
||
// X motor | ||
#define DIR_X 5 | ||
#define STEP_X 9 | ||
|
||
// Y motor | ||
#define DIR_Y 8 | ||
#define STEP_Y 6 | ||
|
||
// If microstepping is set externally, make sure this matches the selected mode | ||
// 1=full step, 2=half step etc. | ||
#define MICROSTEPS 32 | ||
|
||
// 2-wire basic config, microstepping is hardwired on the driver | ||
// Other drivers can be mixed and matched but must be configured individually | ||
BasicStepperDriver stepperX(MOTOR_STEPS, DIR_X, STEP_X); | ||
BasicStepperDriver stepperY(MOTOR_STEPS, DIR_Y, STEP_Y); | ||
|
||
SyncDriver controller(stepperX, stepperY); | ||
|
||
void setup() { | ||
/* | ||
* Set target motors RPM. | ||
*/ | ||
stepperX.begin(30, MICROSTEPS); | ||
stepperY.begin(90, MICROSTEPS); | ||
} | ||
|
||
void loop() { | ||
|
||
controller.rotate(90*5, 60*15); | ||
delay(1000); | ||
controller.rotate(-90*5, -30*15); | ||
delay(1000); | ||
controller.rotate(0, -30*15); | ||
delay(30000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name=StepperDriver | ||
version=1.0.6 | ||
version=1.1.0 | ||
author=Laurentiu Badea | ||
maintainer=Laurentiu Badea | ||
sentence=A4988, DRV8825 and generic two-pin stepper motor driver library. | ||
paragraph=Control steppers via a driver board providing STEP+DIR. Microstepping is supported. Supported drivers are A4988, DRV8824, DRV8825, DRV8834. | ||
paragraph=Control steppers via a driver board providing STEP+DIR. Microstepping is supported. Acceleration is supported. Supported drivers are A4988, DRV8824, DRV8825, DRV8834. | ||
category=Device Control | ||
url=https://github.com/laurb9/StepperDriver | ||
architectures=* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.