Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Slothery on July 30, 2010, 02:23:38 PM

Title: $50 Robot Servo Issues
Post by: Slothery on July 30, 2010, 02:23:38 PM
I have just programmed my board. Plugging the servo into the row which is closest to the capacitor causes it to spin quickly clockwise. Contrarily, plugging the servo into the second row causes it to spin slowly counter-clockwise. During the entire process I have no sensors plugged in; therefore, I would think that the else clause would execute causing the servos in both rows to spin at the same speed in opposite directions. However, this is not so... Would someone offer a solution or explanation to my situation?
Title: Re: $50 Robot Servo Issues
Post by: MrWizard on August 03, 2010, 06:22:21 AM
You will have to plug in sensors too. Then you can adjust the programming code so the servo's will turn at the same speed.
Title: Re: $50 Robot Servo Issues
Post by: Slothery on August 04, 2010, 10:39:27 AM
But without the sensors the servos should turn in opposite directions at the same speed. This is because in the first two conditions cannot execute if the sensor data is below a threshold value and because both sensors are unplugged both conditions will evaluate to false. Leaving the else statement to be executed which simply tells the servos to spin at the same speed in opposite directions.
Title: Re: $50 Robot Servo Issues
Post by: Razor Concepts on August 04, 2010, 11:02:26 AM
When sensors are unplugged, the ADC goes into an unpredictable state where they can return ANY value, since they are just reading noise. So you can't assume that the first two conditions will be false
Title: Re: $50 Robot Servo Issues
Post by: Mansoor on August 06, 2010, 01:57:33 PM
Without any sensors plugged in the code always goes to the third else for me like you suggested. to fix your problem I would suggest getting an osciliscope. that way you can see the voltage wave form directly in front of you. you can measure its width and everything. eliminating the chance that the problem is from the code. if the pulse-width is as it should be. the the problem is from the servo. what i mean is that each servo is a little different. i.e. servo is supposed to be right in the middle at 1500 us for example. but in reality it goes to center at a little higher or lower pulse width. so you have to calibrate each servo to get it perfect. However I do not think that this is the problem if the difference in speed is huge between the two cases. so check with oscilloscope and go from there. good luck!