i need my stepper motor to continuously spin

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nick573
 
Posts: 45
Joined: Mon Jun 20, 2016 3:08 pm

i need my stepper motor to continuously spin

Post by nick573 »

i need my stepper motor to continuously spin until i tell it otherwise, i'm a complete noob and have been trying for ages using the example code to do this but the motor just seems to jump back and forth allot. I'm using the NEMA-17 stepper.

(code)

Code: Select all

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);


void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");
  

  AFMS.begin(100);  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
  
  myMotor->setSpeed(10);  // 10 rpm   
}

void loop() {

   myMotor->step(1, FORWARD, INTERLEAVE); 
}
Last edited by adafruit_support_bill on Mon Jun 20, 2016 4:04 pm, edited 1 time in total.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: i need my stepper motor to continuously spin

Post by adafruit_support_bill »

Which NEMA17 stepper? What are you using to power it? How do you have it wired? Please post a photo showing your soldering and wiring to the shield.

User avatar
nick573
 
Posts: 45
Joined: Mon Jun 20, 2016 3:08 pm

Re: i need my stepper motor to continuously spin

Post by nick573 »

adafruit_support_bill wrote:Which NEMA17 stepper? What are you using to power it? How do you have it wired? Please post a photo showing your soldering and wiring to the shield.
I'm using USB (Photographs) Adafruit Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA (https://www.amazon.co.uk/gp/product/B01 ... UTF8&psc=1)
Attachments
33.jpg
33.jpg (486.45 KiB) Viewed 215 times
11.jpg
11.jpg (449.06 KiB) Viewed 215 times
22.jpg
22.jpg (376.72 KiB) Viewed 215 times

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: i need my stepper motor to continuously spin

Post by adafruit_support_bill »

Powering by USB is not going to work well work well. With the VIN jumper installed, motor power comes from the Arduino VIN pin. But when powering from USB, the only power that gets to the VIN pin is whatever can leak backwards through the Arduino's voltage regulator.

Also, the motor is designed for 12v operation, and USB only supplies 5v. You will probably see much better performance with a power supply in the 9v-12v range.

User avatar
nick573
 
Posts: 45
Joined: Mon Jun 20, 2016 3:08 pm

Re: i need my stepper motor to continuously spin

Post by nick573 »

Ok thanks

User avatar
nick573
 
Posts: 45
Joined: Mon Jun 20, 2016 3:08 pm

Re: i need my stepper motor to continuously spin

Post by nick573 »

adafruit_support_bill wrote:Powering by USB is not going to work well work well. With the VIN jumper installed, motor power comes from the Arduino VIN pin. But when powering from USB, the only power that gets to the VIN pin is whatever can leak backwards through the Arduino's voltage regulator.

Also, the motor is designed for 12v operation, and USB only supplies 5v. You will probably see much better performance with a power supply in the 9v-12v range.


Do you have a link or something to where i can buy a uk power supply for the arduino? Thanks!

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: i need my stepper motor to continuously spin

Post by adafruit_support_bill »

You can check with some of our UK distributers: https://www.adafruit.com/distributors/

Something like this should do: http://uk.farnell.com/xp-power/vep36us1 ... dp/1861102

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”