Asked — Edited

Rotating A Servo

I recently got my EZ-B and have started working on some of my planned projects. One thing that I noticed is that when rotating a servo (a standard servo) from EZ_B.Servo.SERVO_MIN to EZ_B.Servo.SERVO_MAX, it is not exactly 180 degrees that it rotates (I noticed this with ARC also). I have several questions about using the servos:

  1. How many degrees is an increment of 1 when using the SetServoPosition method?
  2. When I attach the servo attachment (before connecting the EZ-B to the servo and computer), how do I know what position it is in? I need to know this so that I know what position to attact the attachment in.

I am asking these questions because my software needs to know the start and current positions of each servo are, as well as what angles to attach the servo attachments at. Thanks.


ARC Pro

Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

United Kingdom
#9  

Yes, basic maths. Do it for each make & model of servo.

So, for instance, if the EZ-Robot Standard servo rotated 185' (I haven't measured, that probably isn't right, if it is it's a coincidence) from 0 to 100 it is as simple as dividing 185' by 100 steps so each step would be 1.85' and to work out how many steps to move 90' it's just 90' divided by 1.85' = 48.6 so 49 steps.

#10  

Min and Max are constants, to which you can change accordingly, however they can be used to limit the amount of steps available through the rotation of the servo. So you have a 180 deg servo so the num of deg per step = x. x/180 = min/max. you choose to have min of 1 and max of 100. x/180 = 1/100; so x = 180/100; x=1.8 thus each step will produce a rotation of 1.8deg. If you change the min or max you will change the amount of deg per step that is produced by your 180deg servo.

United Kingdom
#11  

You can change the min and max from a min of 1 and max of 100 but doing so will not increase the steps between the new min and max.

I.E.

Min = 1 Max = 100 Rotation = 180 Steps = 100 Degrees per step = 1.8

NewMin = 11 NewMax = 90 NewRotation = 180 - (20x1.8) = 144 NewSteps = 80 Degrees per step = 1.8

The degrees per step will always remain the same.

At least that's how I've always thought it is... please, correct me if I am wrong though.

#12  

by changing the min and max you would effectively increase the amount of rotation per step as the defualt of min =1 and max=100 is the highest resolution you can obtain. Perhaps it may not work this way but by setting 11 as your min 0deg and max to 90 being 180deg the amount of deg per step would increase. If this is how DJ has the PID setup for the servo signal generation otherwise the min and max would effectivly only shorten the sweep range of your servo if it works the way you are describing it.

United Kingdom
#13  

I was lead to believe that the min and max were positions, i.e. if min is set to 11 the software will not attempt to move the servo in to positions 1 to 10. Therefore the degrees per step will always remain the same. I may be wrong but I'm pretty confident that I'm not.

#14  

DJ does state it in his standard servo description as being position so you maybe correct. If this is the way it works then you do only have a set 1.8deg per step, for a 180deg servo, and by changing the min max you would be shorting the sweep range of your servo. I could see its use but I know the resolution for the steps is usually what I am more concerned about when programming my own servo signals using other microprocessors.

#15  

I think I have solved my problem. I found out what value makes it turn 180 (which ended up being 86) by trying several estimated values. I then came up with the following equations to convert between value and angle:

angle=(36/17)*(value-1) value=((17/36)*angle)+1

As for attaching the servo attachment at the right angle, I guess you just need to do something like rotate your servo to a known value (such as the minimum) and then attach the attachment at the angle you want it to be at for that value. Using these equations and techniques I have been able to rotate my servos to the desired angle with no trouble. Problem solved! Thank you all for your help!

United Kingdom
#16  

I always use the ARC software, add the servo to one of the digital ports, add the servo control, set it to 50 (mid way) and fit the servo horn if it needs to be exactly in position.

I also always calibrate the servos and centre them when I get any new ones by running the attached script in ARC.

ServoFullRangeWarmup-634899825363427735.ezb