go away spammer

Author Topic: robot just wants to spin  (Read 4428 times)

0 Members and 1 Guest are viewing this topic.

Offline silent069Topic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
robot just wants to spin
« on: June 26, 2008, 08:30:02 AM »
Hi all,

i finally got my robot all together now and im having one last bottleneck thats holding me back from completion.  All it wants to do right now is spin in a circle when i have my photo resistors installed. So i thought maybe i damaged them when i was soldering them together. Replaced my photoresistors with smaller ones so id get a smaller reading. 11k to 15k is what i was reading with the photoresistor in light and dark. So the square root of that should be something like 12.82 once u multiply 11x15. The resistor im currently using is a 10k resistor as i didnt have a 12k. could this be causing the robot to spin? Another note. It will only spin ina  circle if both are plugged in. if i just have one plugged in it doesnt spin.

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: robot just wants to spin
« Reply #1 on: June 26, 2008, 08:36:02 AM »
You should stick plain resistors in the place of the photoresistors in order to make the bot think that the light on each side of it is equal. Then it should go forward.

If it does go forward then you know its your photoresistors, if it still turns its your code, your sevos or your wiring.
Imperial College Robotics Society
www.icrobotics.co.uk

Offline bukowski

  • Robot Overlord
  • ****
  • Posts: 219
  • Helpful? 0
Re: robot just wants to spin
« Reply #2 on: June 26, 2008, 11:27:44 AM »
also, try messing with the threshold variable.

paulstreats

  • Guest
Re: robot just wants to spin
« Reply #3 on: June 26, 2008, 05:07:05 PM »
This prolem usually occurs when the servos are placed wrongly on the chassis (not anything to with electronics).

Did you follow the diagrams and flip one of the servos (as in if they are orientated so they look mirrored then they are wrong)? if not then it will go in circles

Offline silent069Topic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Re: robot just wants to spin
« Reply #4 on: June 26, 2008, 08:16:49 PM »
here is a pic of the bot, lemme know if the servos look like they are mounted correctly.


seems to be that whatever is connected to pin 28 does not do anything. Pin 27 always has an effect on the direction the robot will spin (even when the photo resistors are swapped).   If i put light onto it the photo resistor the bot will spin in the opposite direction. I begining to wonder if one of them is on backwards, although i really dont see how.

Offline bukowski

  • Robot Overlord
  • ****
  • Posts: 219
  • Helpful? 0
Re: robot just wants to spin
« Reply #5 on: June 26, 2008, 08:21:50 PM »
Nah, they are on correctly. I had this problem also, tested the photoresistors and found that the values between the two we waaay different in the same light. Tweeking the threshold value helped some, but it isnt a good fix. Rather than mess with it, I just upgraded with the IR rangefinder... I wonder if using photo transistors instead would give a more consistant voltage?

Offline silent069Topic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Re: robot just wants to spin
« Reply #6 on: June 26, 2008, 08:35:20 PM »
i see what u mean, just tested them side by side and i one is 5k and the other is 9k.  ill see what i can do here

Offline dsheller

  • Full Member
  • ***
  • Posts: 72
  • Helpful? 0
Re: robot just wants to spin
« Reply #7 on: June 26, 2008, 08:51:14 PM »
Test if the 4kOhm offset is linear throughout light ranges, if it is you could throw a 4kOhm resistor in series with the other photoresistor.

Offline silent069Topic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Re: robot just wants to spin
« Reply #8 on: June 26, 2008, 09:21:18 PM »
im really new to coding and such, but couldnt a new code be written so that you would only need 1 photo resistor to do basic avoidance.  Im not sure how it would be done if it could, but maybe its something i can look into for an upgrade.

basicly thinking something along the lines of:

if light level drops below a certain rating turn left.

Quote
Test if the 4kOhm offset is linear throughout light ranges, if it is you could throw a 4kOhm resistor in series with the other photoresistor.

before i read this i managed to find 2 photoresistors that were almost identical. only problem is i have to have the robot in a completely dark room for it to work properly or it will just spin like crazy.

Offline dsheller

  • Full Member
  • ***
  • Posts: 72
  • Helpful? 0
Re: robot just wants to spin
« Reply #9 on: June 26, 2008, 09:52:09 PM »
The only thing that really makes sense to me is that you have the servos backward somehow. If this was a motor I'd say just switch power and ground, but I doubt that will turn out great with a servo.

Offline silent069Topic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Re: robot just wants to spin
« Reply #10 on: June 26, 2008, 10:18:35 PM »
it actually seems to want to avoid light altogether, and wants to crash into objects (move to where its dark) now that really confuses me. and it still seems that one of the photo resistors doesnt want to do anything at all.

Offline bukowski

  • Robot Overlord
  • ****
  • Posts: 219
  • Helpful? 0
Re: robot just wants to spin
« Reply #11 on: June 26, 2008, 10:28:11 PM »
Code: [Select]
//detects more light on left side of robot
if(sensor_left > sensor_right && (sensor_left - sensor_right) > threshold)
{//go left
servo_left(44);
servo_right(44);
}

//detects more light on right side of robot
else if(sensor_right > sensor_left && (sensor_right - sensor_left) > threshold)
{//go right
servo_left(25);
servo_right(25);
}

//light is about equal on both sides
else
{//go straight
servo_left(25);
servo_right(44);
}

See? if your photoresistors are not giving similar readings (eg difference > threshold [8]) then all your robot would do is turn. Try making the photoresistor divider again with the best matching resistors. Also, try using an aligator clip or something as a heat sink (clip it on the wire between the resistor and where you will be soldering), heat can damage the resistors.

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: robot just wants to spin
« Reply #12 on: June 26, 2008, 11:32:50 PM »
Its definitely the photoresistors , measure their resistance levels in the same light and you will see how different they are. Post up those values and we can tell you different way to correct that problem
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline silent069Topic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Re: robot just wants to spin
« Reply #13 on: June 27, 2008, 10:19:43 AM »
ok so here is the reading from the 2 photoresistors under the same light

first is reading 4.50
second is       6.15




Offline ceruleanplains

  • Full Member
  • ***
  • Posts: 57
  • Helpful? 0
  • Got Wumpus?
    • Project Log
Re: robot just wants to spin
« Reply #14 on: June 27, 2008, 10:38:03 AM »
Try looking at this  - and see if it helps.

http://www.ceruleanplains.com/Documentation/Worksheet2.pdf

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: robot just wants to spin
« Reply #15 on: June 27, 2008, 11:15:52 AM »
ok so here is the reading from the 2 photoresistors under the same light

first is reading 4.50
second is       6.15





Is that in k ohms or 10k ohms

See the values are different so you'll have to fudge the values a little bit , I like to refer to it as sensor biasing
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline silent069Topic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Re: robot just wants to spin
« Reply #16 on: June 27, 2008, 03:17:07 PM »
That would be in k ohms.

and that pdf is awesome!

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: robot just wants to spin
« Reply #17 on: June 28, 2008, 10:03:40 PM »
how did you end up fixing the varying resistance levels? Software-wise or electronics-wise
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline silent069Topic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 0
Re: robot just wants to spin
« Reply #18 on: June 28, 2008, 10:55:42 PM »
well im currently stil working on that, what ive found was that the room i was in had a little too much light and not enough shadow for how i had it set up. I uped the threshold to 15 (from 8 ) and that made a difference as well. I also swapped out the atmega168 and through in one of my new atmega8 and believe it or not it seems to make a difference as well. Robot actually is moving a little quicker. Im gonna keep tinkering with the code and ill see what happens!
« Last Edit: June 29, 2008, 11:16:06 AM by silent069 »

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: robot just wants to spin
« Reply #19 on: June 28, 2008, 11:03:11 PM »
its moving quicker b/c its prob running at a faster oscillator
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline ceruleanplains

  • Full Member
  • ***
  • Posts: 57
  • Helpful? 0
  • Got Wumpus?
    • Project Log
Re: robot just wants to spin
« Reply #20 on: June 29, 2008, 08:20:26 AM »
"and that pdf is awesome! "

thanks! ;D

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: robot just wants to spin
« Reply #21 on: July 05, 2008, 08:08:51 AM »
Using a UART to output exactly what the robot's doing is very useful in robot debugging . . .

But outside of that, directly blocking light with your finger on just one photoresistor, and/or shining a light on the other, should tell you what is/isn't working . . .

 


Get Your Ad Here