Society of Robots - Robot Forum

Mechanics and Construction => Mechanics and Construction => Topic started by: schiz0id on November 28, 2010, 03:40:15 PM

Title: Arduino Junkbot wheel issues
Post by: schiz0id on November 28, 2010, 03:40:15 PM
A friend challenged me to build a robot with things lying around my house, claiming I couldn't do it. I decided on an arduino-powered one-wheeled robot which would sit idle until something was placed in front of its sharp IR rangefinder, then due to only one wheel turn in circles. The wheel is driven by a stepper motor I got from an old scanner. What follows is my actual problem.

As this is a junkbot and I have no wheels lying around I am forced to use cardboard discs, similar to what was done in the $50 robot tutorial. The motor will turn, and even turn the wheel, but as soon as I put it on the ground the friction causes the motor to stall. Any suggestions? Has my friend finally beat me?

Here's my code:

Code: [Select]
#include <Stepper].h>

#define STEPS 100

Stepper stepper(STEPS, 8, 9, 10, 11);

int Val = 0;
int irReader = 1;
int irMax = 100;
int beepPin = 2;

void setup()
{
  stepper.setSpeed(75);
  pinMode(irReader, INPUT);
  pinMode(beepPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  Val = analogRead(irReader);
  if(Val >= irMax){
    digitalWrite(beepPin, HIGH);
    stepper.step(-200);
 }
}

Title: Re: Arduino Junkbot wheel issues
Post by: madsci1016 on November 28, 2010, 04:11:18 PM
I'm not sure how the Arduino stepper library works, but if you have a stepper motor that is stalling, chances are it's too small for what you are trying to do, or you are stepping too fast. Did you try slowing the stepping down?
Title: Re: Arduino Junkbot wheel issues
Post by: schiz0id on November 28, 2010, 04:39:17 PM
You mean fewer RPMs? Or fewer steps?
Title: Re: Arduino Junkbot wheel issues
Post by: schiz0id on November 28, 2010, 04:41:39 PM
If that question was stupid (it probably was) please note this is my first encounter with a stepper.
Title: Re: Arduino Junkbot wheel issues
Post by: madsci1016 on November 28, 2010, 08:13:25 PM
Quote
You mean fewer RPMs? Or fewer steps?

Err, both. The speed (or RPMs) is the number of steps during some length of time.

I guess this

Code: [Select]
stepper.setSpeed(75);
Sets the speed in RPMs, or steps per second; or something like that. Try lower numbers.