New to using Arduino so I apologize if this is an easy fix that I am overlooking. I am trying to replicate a project using the wii IR camera and a pan/tilt camera platform using two 9g micro servos. I have tested the wii camera with a separate blob tracking software and the camera identifies the blobs correctly. After I validate and upload the code to control the servos the servos do not respond as I would expect. As I move a light source in front of the camera the servos only move a tiny bit, but in the opposite direction. I searched online and found that it may be the following settings for the servos, but I am not certain. The post said that they may need to be modified and that I should "play" with them. Not entirely sure how to play with them though. I was going to post the entire code but was not sure how much space it would occupy. Thanks in advance for the help!
The names used in the #defines would seem to indicate that they relate to the speed at which the servos move rather than the position they move to. This in turn implies that continuous rotation "servos" are being used rather than normal ones.
What type of servos are you using and how are they powered ?
So it is likely a supply issue, but what about UKheliBob's comment about the type of servo? They are 9g(SG90) micro servos and nothing I can find online lists if they are continuous rotation or otherwise. If the code suggest that I should be using continuous rotation ones, are there any micro sized that will fit my pan tilt rig?
thanks all
what about UKheliBob's comment about the type of servo? They are 9g(SG90) micro servos
The online details that I can find make it almost certain that they are normal, real servos and as such can be commanded to go to a particular angle and stay there.
My query was because of the names and use of the #defined constants in the program. For instance
#define S1_LEFT_SLOW 1550
Effectively this means that wherever S1_LEFT_SLOW appears in the program it will be replaced with 1550
Somove_servo1(S1_LEFT_SLOW);becomesmove_servo1(1550);which in turn means that when
void move_servo1(int val)
{
servo1.write(val);
}
is executed it becomes servo1.write(1550);
Normally servo.write() takes a value between 0 and 180 to set the angle. It will accept values greater than that and will treat them as microseconds as if the writeMicroseconds() method had been used, but it is unusual to see it used that way instead of just using writeMicroseconds() in the first place.
So, the code will work to move the servo but the #defined names are still strange as the code does not change the speed of the servos, only their position, hence my query about the type of servos. So called continuous rotation servos cannot be moved to a defined angle rather the parameter passed to servo.write() determines the speed and direction of rotation which matches the #defined names better.
Using a normal servo and fixed values for servo.write() as the program does means that the servos could only move to fixed positions. Is that what is supposed to happen ?
Looking at the code I think you do need continuous rotation servos.
If it dosn't say continuous rotation servo in the description then it is not.
These types of servos are not common. I have seen one on spark fun's web site though so unless you are into modifying the servo you have then you need new ones.