continuous stepper motor?

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
wwischer
 
Posts: 37
Joined: Wed Jan 04, 2012 8:01 pm

continuous stepper motor?

Post by wwischer »

Hello, I am looking for a recommendation for a good continuous stepper motor? I am using an infrared sensor to detect movement and spin a disco ball. It stops when the movement stops and continues in the same direction as long as there is movement. I can use a continuous servo motor but they are loud and don't hold a lot of weight. (currently only moving a 2 lb. ball but that may increase in the future)
I am also using the arduino uno and the motor shield to run the stepper. I have everything working but when I set the stepper to go 360 degrees, there is a lag at each rotation rather than a continuous loop.
I am assuming that it is the motor itself which is the stepper motor from sparkfun 2 phase, 12v and 2.3kg holding torque. I am open to any motor suggestions or a code suggestion which I have included as well.
thanks in advance.

Code: Select all

#include <AFMotor.h>

AF_Stepper motor(48, 1);
int potPin = 0; //analog pin ued to connect the sensor
int val = 0;  //variable to read the value from the analog pin

void setup() 
{
  
  Serial.begin(9600); //for watching the speeds in the serial monitor

  motor.setSpeed(200);  // 200 rpm   

}

void loop() {
   val = analogRead(potPin);    // read the value from the sensor
    val = map(val,0,1023,0,179);
   if (val>60)
     
  motor.step(360, FORWARD, SINGLE); 
   else 
  motor.release(); 

   Serial.println("stop");
   delay(10);
}

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

Re: continuous stepper motor?

Post by adafruit_support_bill »

Your code stops the motor after every revolution to print "stop" and delay 10 ms.
If you want to do other things like reading sensors while the motor is running, you should either single-step the motor or use the AccelStepper library here:http://www.ladyada.net/make/mshield/download.html

wwischer
 
Posts: 37
Joined: Wed Jan 04, 2012 8:01 pm

Re: continuous stepper motor?

Post by wwischer »

Thanks - so simple, can't believe I overlooked the delay.
Much appreciated.

wwischer
 
Posts: 37
Joined: Wed Jan 04, 2012 8:01 pm

Re: continuous stepper motor?

Post by wwischer »

Hello, I looked at dowloading the AccelStepper library and noticed it has you rename it to the AFMotor file, does this replace the previous AFmotor file? and will that change any code with the old file?
Thanks, thought I would check first.

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

Re: continuous stepper motor?

Post by adafruit_support_bill »

:oops: Sorry about that. It should read: "Rename the folder to AccelStepper".
You will need both libraries.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: continuous stepper motor?

Post by adafruit »

fixed!

User avatar
edsonsoares
 
Posts: 1
Joined: Wed Nov 05, 2014 7:53 pm

Re: continuous stepper motor?

Post by edsonsoares »

Hi Guys, I'm starting a new project that relates to this post as I'll also be working with a Disco Ball. My doubt is on which motor should I buy If I'll be working with a 12 inch / 5 Pounds Ball? Any suggestion is appreciated. Thank you!

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: continuous stepper motor?

Post by Franklin97355 »

If the ball is rotating around the horizontal axis you should have no problem with a NMEA17 size motor because the stress will be supported by the balls mount and not the motor.

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

Return to “Arduino Shields from Adafruit”