Skip to content

Servo Documentation

CaliW edited this page Feb 9, 2019 · 26 revisions

Servos!

The servos are HS-645MG's from HiTec. The hexapod has 18; each node is labelled 1-6, and from center they are designated a, b, and c respectively.

A Servos

The top servos. For control:

  • 0: Low limit, all the way clockwise.

  • 90: Straight out from center.

  • 180: Upper limit.

  • pulse limit min for servo shield: 125

  • pulse limit max for servo shield: 900

B Servos

The middle servos. For control:

  • 40: Low limit, if the C servo is tucked in to about 110.
  • 80: horizontal.
  • 90: 10 degrees above horizontal.
  • 170: vertical.
  • 180: Upper limit.

C Servos

The bottom-most servos. For control:

  • 0: Lower limit. Stretched straight out.
  • 90: Perpendicular downwards.
  • 130: Upper limit. Tucked under robot.

PWM Values

The servos require a PWM value of 140 at the minimum angle of 0 degrees, and 520 at the maximum angle of 180 degrees.

  • PWM = 1.05556*theta + 140
  • Servos B & C on legs 4-6 are reversed, requiring a PWM value of 520 at the minimum angle of 0 degrees, and 140 at the maximum angle of 180 degrees.
  • Some servos are slightly offset; the following offsets represent actual angle - desired angle, centered on 90 degrees (such that servo B is horizontal at 90 degrees):
Leg 1 Leg 2 Leg 3 Leg 4 Leg 5 Leg 6
Servo A 0 10 10 -5 0 -2
Servo B -3 20 5 10 0 8
Servo C -1 13 8 9 10 6

How to Hack the Servo Potentiometer

Servo motors have no potentiometer feedback that we can use. Below are instructions on how to access the potentiometer to gain real-time feedback on the servo motors orientation.

  1. Take out the 4 screws on the bottom of the servo and then remove the bottom piece. This will let you access the PCB. Do not lose the screws.
  2. Find the solder blob that connects to the potentiometer. You can do this using a multimeter and measuring each blob against ground. The potentiometer blob value will change when you twist the servo horn/arm.
  3. Solder a wire to the solder nub you found, preferably one that isn't the same color as any of the servos original 3 wires.
  4. Drill a hole in the bottom cap of the servo. You need to access the potentiometer through the wire you just attached, so be careful and triple check your measurements before drilling. Putting small scratch marks on the inside of the cap may help.
  5. Fit the wire through hole in the cap and rescrew the cap to the motor. Make sure the cap is orientated correctly.
  6. Attach the servos original 3 wires to your microcontroller normally(ground, power, signal), then connect the new potentiometer wire to an analog pin. Then you can include the pin in your code and analogRead() the values.
  7. Analog read potentiometer pin to find range limits of the servo. These will fluctuate slightly so choose the minimum and maximum values that you will use to be slightly inside the extreme range.
  8. Make an equation to convert analog read numbers to degrees. This is necessary because the current code controls servo movement by inputting degrees.

Ex: My min and max values I found using analogRead were ~56 & ~377. I chose to use 65 and 360 as my range. Then I made the analogRead() value to degree conversion equation: degree = (analog - 65) / 1.64

For more information and visual aids go to : https://www.instructables.com/id/Servo-Feedback-Hack-free/

History

9/19/18 Wrote code to test the limits of the servos.

9/26/18 Began testing the servos

9/28/18 Labeled the servos

Finished testing the servos on the hexapod with these results:

Servo 1 Status
1 - A Working
1 - B Working
1 - C Working
Servo 2 Status
2 - A Working
2 - B Working
2 - C Working
Servo 3 Status
3 - A Working
3 - B Working
3 - C Working
Servo 4 Status
4 - A Working
4 - B Working
4 - C Working
Servo 5 Status
5 - A Working
5 - B Working
5 - C Working
Servo 6 Status
6 - A Working
6 - B Working
6 - C Working

Last edited by david tarazi 9/28/18