Society of Robots - Robot Forum

Mechanics and Construction => Mechanics and Construction => Topic started by: crunchies23 on June 11, 2010, 02:56:03 PM

Title: $50 Robot Completed Question
Post by: crunchies23 on June 11, 2010, 02:56:03 PM
Hi all,

This is my first time building a robot and so I went with the $50 robot to start. I followed every step and completed everything and powered on the robot to only find the photovore rotating in a clockwise direction instead of moving around like it should.

I have a gut feeling it has something to do with the programming because i checked all the electrical components to make sure nothing was shorted out or disconnected or connected where it shouldn't.
 
1. I uploaded the hold servo hex file and adjust the pot till it stopped moving to modify the servo sucessfully.
2. I also uploaded the hex file received from the photovore_v1.c file using PonyProg2000 to the atmega8 (Note: I did not modify the code in anyway, I just compiled and upload it to the MC)
3. After the program have been successfully loaded into the MC, i plugged in both the sensors and servos to find one rotating clockwise and the other counter-clockwise resulting in the robot turning clockwise in a circle and not moving anywhere. Without the sensors plugged in the bot does go in a straight line

Any idea as to what the problem is? Thanks in advance
Title: Re: $50 Robot Completed Question
Post by: Choco_liger on June 11, 2010, 08:05:39 PM
There a few things I need to ask,

Have you made sure that the pot of the servo has been secured with superglue or something?

Also, try switching the sensors around to the opposite ports or switch the servos around.

Also what type of ATmega8 are you using? I used the ATmega8-16PU and I needed to make some modifications to the code.

Title: Re: $50 Robot Completed Question
Post by: crunchies23 on June 12, 2010, 03:34:15 PM
Hi,

Thanks for the reply. I used the AVR 28 Pin 16MHz 8K 6A/D - ATMega8 from sparkfun.com and yes the pot are securely in place and the servos are modified the correct way im 100% sure.

Ok so I did the following,

I switched the servos and it ended up rotating counterclockwise so im assuming switching servo ports would only change the orientation of the rotating. Through some persistent testing I manage to find that in a lit room the robot spins in a circle but when put in a dark room it managed to move straight so I think that the robot actually is afraid of light and is spinning because it cant find a dark spot to go to (a photophobe instead of a photovore). To further confirm this I put my finger close to the sensor and the robot actually followed it. So to make it a photovore I switched the sensor ports around and find that the robot stopped rotating and is moving around but it doesn't seem to be confined to a light box like the video that was on the website. I further put the robot in a fairly dark room and found that it is moving straight and when i point a flash light directly at the sensors, the robot actually followed the flashlight. When i  removed the flashlight, the robot continue to move in a straight line

Im guessing the problem now is how to reproduce to a similar extent what the photovore robot on the website did. In other words how to trap the robot in a box of light and make it turn away from dark areas. I have yet to change any code around
Title: Re: $50 Robot Completed Question
Post by: waltr on June 12, 2010, 05:29:33 PM
It almost sounds as though the light sensors are too sensitive. Check the voltage from the sensors to the processor. Is the voltage at a reasonable level? If not then you may need to adjust the values of a resistor in the sensor circuit.

Good luck and have fun.
Title: Re: $50 Robot Completed Question
Post by: Conscripted on June 12, 2010, 06:32:50 PM
There is a threshold value specified in the programming. If you adjust it you may get the behavior you are looking for. I think perhaps the sensors aren't balanced. That would explain why it works differently in dim and bright light.

The difference between a photovore and a photophobe is whether it turns into or away from the light.

good luck
Conscripted
Title: Re: $50 Robot Completed Question
Post by: Choco_liger on June 13, 2010, 12:07:18 AM
OH! I just remembered I had this problem too!
I'm not sure how I fixed it but try this,

1. Make sure that your sensors aren't busted. If one is busted the reading would be different.
Check Razors assumption as well.

2. Conscripted could be on the right track possibly too. Try changing the threshold value and possibly the servo values.

Hopefully these will help and good luck. :)
 
Title: Re: $50 Robot Completed Question
Post by: OitaFish on June 13, 2010, 07:40:17 AM
I just got my $50 robot working the other day.  It does the same thing -- when I turn it on, it just spins in circles.  The problem is that the sensors don't read the exact same and even when there is the same amount of light in both of them, the difference in the reading is greater than the threshold.  I could get it to kind of work by increasing the threshold but it would still favor turning one way rather than the other.

Here is how I fixed it:
Added code to detect if the robot is spinning in a circle (just count then number of times in a row it turns left or turns right).
If it is -- go into a calibration routine.
The calibration routine spins the robot in a circle while reading the sensors many times. 
I take the difference of the average of the readings of the sensors and use that as an offset for the sensor readings.
Apply 1/2 the offset to the right sensor and 1/2 to the left.

After adding that, it works like its supposed to.

Let me know if you want me to post the code.
Title: Re: $50 Robot Completed Question
Post by: Selenaut-14 on July 05, 2010, 12:12:49 AM
Here is how I fixed it:
Added code to detect if the robot is spinning in a circle (just count then number of times in a row it turns left or turns right).
If it is -- go into a calibration routine.
The calibration routine spins the robot in a circle while reading the sensors many times. 
I take the difference of the average of the readings of the sensors and use that as an offset for the sensor readings.
Apply 1/2 the offset to the right sensor and 1/2 to the left.

After adding that, it works like its supposed to.

Let me know if you want me to post the code.


In a one-word answer, yes. This creates a MUCH larger margin for error... in a good way.