Grove Starter Kit For Arduino --- Stepper Motor & Driver

Grove Starter Kit For Arduino --- Stepper Motor & Driver © LGPL

Teaches you how to use the Stepper motor and driver in the Arduino Grove Starter Kit.

  • 8,376 views
  • 11 comments
  • 13 respects

Components and supplies

Apps and online services

About this project

Setup:

For hardware connections plug the potentiometer into A0:

The motor into the driver:

And the driver into the board.

Code

Stepper CodeArduino
adjust the potentiometer to change the speed of the Motor
#include <Stepper.h>
int t =0;
const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor


// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

int stepCount = 0;  // number of steps the motor has taken

void setup() {
  Serial.begin(9600);
}

void loop() {
  // read the sensor value:
  int sensorReading = analogRead(A0);
  // map it to a range from 0 to 25:
  int motorSpeed = map(sensorReading, 0, 1023, 0, 25);
  // set the motor speed:
  if (motorSpeed > 0) {
    myStepper.setSpeed(motorSpeed);
    // step 1/100 of a revolution:
    myStepper.step(stepsPerRevolution / 25);
  Serial.println(motorSpeed);//print how fast the motor is going in the serial monitor
  }
}

Schematics

Stepper motor setup
Full setup with potentiometer, driver, and motor
Dscn4057 an5kmq2hrk
Close up on ports
Dscn4055 dhwomdyaps
Close up on motor and driver
Dscn4053 dpv6szi0qk
driver connections
Driverconnections gtifnptk0k

Comments

Similar projects you might like

Grove Starter Kit For Arduino --- RGB LCD

by Grant

  • 6,322 views
  • 2 comments
  • 7 respects

Grove Starter Kit for Arduino: Touch sensor

by Grant

  • 816 views
  • 1 comment
  • 2 respects

Motor controlled with Arduino

by Benjamin Larralde

  • 18,257 views
  • 20 comments
  • 48 respects
Add projectSign up / Login