Go Down

Topic: Bipolar Stepper Motor with Gecko Drive 201X (Read 142 times) previous topic - next topic


Hi All

Completely new to all of this, and having to pick up half completed projects. I am using the Arduino to control me motor and gecko drive 201X. I have the script written and proven, but I cannot seem to increase the speed of the motor through the pot on the gecko drive. The motor is to turn clockwise until a limit switch is triggered, and then begins to turn counter-clockwise, and so on.

Anyone out there that can review the script and advise as to where the speed or RPM's can be amended??

const int stepPin = 9;
const int dirPin = 8;
const int topPin = 4;
const int bottomPin = 5;
int topValue = 1;
int bottomValue = 0;

void setup()
pinMode(topPin, INPUT_PULLUP);
pinMode(bottomPin, INPUT_PULLUP);
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(dirPin, HIGH);

void loop(){
    digitalWrite(stepPin, HIGH);
    digitalWrite(stepPin, LOW);

topValue = digitalRead(topPin);
bottomValue = digitalRead(bottomPin);
if((topValue == 1)&&(bottomValue == 1))
else if((topValue == 1)&&(bottomValue == 0)){digitalWrite(dirPin, HIGH);}
else if((topValue == 0)&&(bottomValue == 1)){digitalWrite(dirPin, LOW);}



Mar 08, 2019, 01:29 am Last Edit: Mar 08, 2019, 01:31 am by groundFungus
where the speed or RPM's can be amended??
Code: [Select]
digitalWrite(stepPin, HIGH);
    digitalWrite(stepPin, LOW);

This code sets the speed of the stepper.   The length of the delays set the speed.  Reduce the delays to speed the motor up.

Robin2's simple stepper code shows how to adjust the speed of a stepper.  It is written for the A4988 or DRV9925 drivers but should work fine with your driver.   Note that the pulse high time is constant (20us) and the time between steps is adjusted to set the speed.

Go Up