go_away

Author Topic: $50 Robot only turns in circles  (Read 1784 times)

0 Members and 1 Guest are viewing this topic.

Offline hazardousracerxTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
$50 Robot only turns in circles
« on: April 23, 2009, 11:27:16 PM »
I completed the "$50" robot last night and got it flashed and come to find out that it only turns in circles.  One wheel rotates forwards the other backwards effectively immobilizing it while spinning in a circle.  I believe that it has something to do with the servos not being modified correctly, but it could also be a damaged photo resistor.  What other problems could cause this issue?  What is the most likely cause of this issue.  I am hesitant to take the servos apart again for fear of breaking them but will do so to re-adjust them if necessary.


some Background info:

I am using the ATmega168 instead of the ATmega8
I did not adjust the processor Freq in the Makefile


Doesnt belong in this section but does anyone have a .hex built for an ATmega168 to cause the servos to center themselves.  Preferrably with the source as I don't have access to a working O-scope to get the values myself.  Thanks.

Offline hazardousracerxTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
Re: $50 Robot only turns in circles
« Reply #1 on: April 24, 2009, 01:25:06 PM »
UPDATE:  Well after some testing I ruled out the servos.  The photoresistors seem to be ok too.  Their values between GND and Live are about 3 Ohms in bright light and probably close to 100k Ohms or higher when covered.  Both had the same values when tested.

I might have found a possible cause for the circling issue although I have had limited success with semi-proper function with the "sensors" attached.  Without either of the photoresistors attached, I am getting a 5 volt drop between pin 28 and GND and pin 23 and GND.  Pins 24-27 do not have this voltage on them, with values ranging from 0.05 volts to 0.15 volts.  I have already checked for continuity on those pins to the ports they correspond to, and those values were measured from the pin on the chip.  What is the value of the voltage on those pins supposed to be when functioning properly?

When I attach a sensor to pins 23-27 it has caused one or both servos to slow down considerably.  What could be the cause of this?  I have a 6.0 Volt NiMH battery pack and it was fully charged at time of testing.

One Last thing... I think...  I finally changed the Processor speed to 8MHz.  Does anyone have working speed numbers for the servos at that freq?  I believe this may be one of the causes for the problem, but multiplying them by 2.167 which is the difference between 8MHz and 3.69MHz (default according to the code) doesn't seem to help... actually I think it made the problem worse.  I changed the speed values back to original and had better success, but one of the servos... the right one... is rotating much slower than the left and got slower every time I re-flashed the chip.  Battery voltage shouldn't be the problem because the other servo is unaffected. 

Any help on these issues is much appreciated.

Offline galannthegreat

  • Supreme Robot
  • *****
  • Posts: 615
  • Helpful? 4
  • Blue-Lensed Blue LEDs?! What?! Impossible!!
Re: $50 Robot only turns in circles
« Reply #2 on: April 24, 2009, 01:32:16 PM »
Check ALL of your wiring, 80 percent of the time it turns out to be within the wiring.

ie. Make sure nothing is bridged where it shouldn't be... and so on.
Kurt

Offline hazardousracerxTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
Re: $50 Robot only turns in circles RESOLVED!!!
« Reply #3 on: April 24, 2009, 03:01:33 PM »
Checked, Doublechecked and Triplechecked wiring before I even plugged in the chip and then Checked again after adding the chip before connecting the batt.  In any event I got it working now.  It was a combination of the photoresistors not being equally adjusted at startup due to positioning and servo values in  code.  I changed the values in the source for the speed.

If anyone else is wondering I am currently clocked at 8MHz and the timings for the servos are as follows:

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

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

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



Never did figure out why the voltage drop on those pins though... havent tested to see if its still there...  It works for the moment so i will prolly not mess with any hardware until it stops working again or I add more stuff.
« Last Edit: April 24, 2009, 03:03:46 PM by hazardousracerx »

Offline galannthegreat

  • Supreme Robot
  • *****
  • Posts: 615
  • Helpful? 4
  • Blue-Lensed Blue LEDs?! What?! Impossible!!
Re: $50 Robot only turns in circles
« Reply #4 on: April 24, 2009, 03:05:25 PM »
Good job on that, got any pics or vids of your 'bot?
Kurt

Offline hazardousracerxTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
Re: $50 Robot only turns in circles
« Reply #5 on: April 24, 2009, 03:48:58 PM »
Thanks.  No pics or vids yet.  Will try to take some tomorrow and post them.  Im just glad i finished it at this point.  It took me aout 3.5 weeks to complete up to this point due to waiting on parts at various times during the build process.  I ordered everything at the same time, but things got here spaced about 2 weeks apart.  3 packages 1 day the 3 another 2 weeks later.

Actual time spent was probably about 15 hours.  Didn't keep a detailed log so that is prolly an under estimate.

 


Get Your Ad Here