Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: silent069 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.
-
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.
-
also, try messing with the threshold variable.
-
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
-
here is a pic of the bot, lemme know if the servos look like they are mounted correctly.
(http://i280.photobucket.com/albums/kk194/silent069/S6000174.jpg)
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.
-
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?
-
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
-
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.
-
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.
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.
-
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.
-
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.
-
//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.
-
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
-
ok so here is the reading from the 2 photoresistors under the same light
first is reading 4.50
second is 6.15
-
Try looking at this - and see if it helps.
http://www.ceruleanplains.com/Documentation/Worksheet2.pdf
-
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
-
That would be in k ohms.
and that pdf is awesome!
-
how did you end up fixing the varying resistance levels? Software-wise or electronics-wise
-
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!
-
its moving quicker b/c its prob running at a faster oscillator
-
"and that pdf is awesome! "
thanks! ;D
-
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 . . .