Author Topic: Arduino Junkbot wheel issues  (Read 2089 times)

0 Members and 1 Guest are viewing this topic.

Offline schiz0idTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Arduino Junkbot wheel issues
« 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);
 }
}

« Last Edit: November 28, 2010, 03:54:44 PM by schiz0id »

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Arduino Junkbot wheel issues
« Reply #1 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?

Offline schiz0idTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Arduino Junkbot wheel issues
« Reply #2 on: November 28, 2010, 04:39:17 PM »
You mean fewer RPMs? Or fewer steps?

Offline schiz0idTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Arduino Junkbot wheel issues
« Reply #3 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.

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Arduino Junkbot wheel issues
« Reply #4 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.