Sunday, August 3, 2014

ArrBot: Dual Servo Calibration

Here's the process we'll use to calibrate the servos.  In phase 1, we'll do this the simplest way possible. There's two reasons for this:
  • Practically, we're coding the first iteration in a limited amount of time.  Tending towards simplicity is a good thing at this time.
  • For teaching purposes, it's good to have a couple of small single-purpose programs.  Later we'll combine everything into one program and put a cross-platform GUI.
Measure the Left Servo

Load the  Basic ArrBot Servo Tester.  There's a couple of values we're trying to find.
  • Find the midpoint where the servo is stopped.  Write down this value as MID.
  • Increase the value until the servo is at its maximum speed. Write down this value as HI.
  • Decrease the value until the servo is at its maximum speed in the other direction.  Write down this value as LO.
  • Calculate SPAN as HI - MID.
  • Hopefully, SPAN = MID - LO as well.  If not, choose the lower balue.

Measure the Right Servo

Get MID and SPAN for the right servo as above.

Write the Calibration Data to the Arduino
  • Grab the Basic Servo Calibrator.
  • Fill in MID and SPAN for the left and right servos.
  • Don't worry about REVERSE.  You may need to set that later.
  • Run the program and the calibration data will be written to the EEPROM.
  • Watch the serial monitor and it will confirm.
Now we're going to switch things up a bit.  First, we want to start thinking of motor speed in terms of percentage.
  • -100% = maximum speed reverse
  • 0% = full stop
  • 100% = maximum speed forward
And we want to see if  if the two servos are working well together, i.e. if -100%,0%,100% produces the same speed on both motors.  We'll modify our servo test in two ways:
  • Add a second servo control.  Now we can test the left and right servos at the same time.
  • Change the control values to percentages.

Assemble the Enhanced Servo Tester

Start with the ArrBot Servo Tester. Duplicate the connections, so you have this configuration:
  • left servo: RAW, GND, Pin 9
  • right servo: RAW, GND, Pin 10
This will be the basic ArrBot configuration.

Test the Two Servos Together

Run the ArrBot Dual Servo Tester (coming!)  It has the following controls.
  • v -- variable sweep from -100% to 100%
  • c -- set 0%
  • j, k -- subtract, add 1%
  • r -- cycle through channel reversal combinations

blogodex = {"toc" : ["ArrBot", "ArrBot Syllabus"], "idx" = "Servo Calibration"};

4 comments:

  1. I recently came accross your blog and have been reading along. I thought I would leave my first
    comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep
    visiting this blog very often. I am an Glassware calibration lab in Chennai.
    I feel great after reading this information. Please make update I will be regular rss to this site.
    Mass Calibration Lab in Chennai

    ReplyDelete
  2. Mark, the BasicServoCalibrator includes files ArrServos.h & ArrHeader.h, but I didn't see these mentioned anywhere. Where should I get & store them so I can run the calibration?

    Thanks!

    ReplyDelete
    Replies
    1. To set up the libraries...

      unzip this file:

      https://github.com/marhar/arrbot/archive/master.zip


      then in Arduino app:

      Sketch / Import Library / Add Library

      and select (from the unzipped files):

      ArrHeader
      ArrServos
      ArrNunchuck

      (you have to repeat 3 times, once for each folder)

      Delete
  3. Got it, there is a newer post that explains how to do this at http://eastbay-rc.blogspot.com/2014/08/arrbot-downloading-and-setting-up.html

    Thanks Mark!

    ReplyDelete