Spring 2016 Pathfinder: Arxterra Servo Control for Pan and Tilt

IMG_3244

By:

Xiong Lee (Mission, System and Test)

Table of Contents

Objective:

After test and calibrating our servos from the earlier blog post found here, we then needed the servos to run through the arxterra app.  The arxterra app already has a built in button to control panning and tilting. All we need to do is have the code turn our servos when arxterra is sending the command to pan and tilt. After configuring the code to do these actions, we were able to control the pan and tilt servos.

Equipment:

  1. Arduino (we used the Mega but the uno can suffice)
  2. Servo Driver (PCA 9685)
  3. Battery (we used 7.4 v)
  4. Arduino IDE
  5. Servos
  6. Phone

Code:

After wiring up circuit, we have to use the servo code to control our servos found on blog post above. From the code you see at the blog post, we have to convert pulse length to degrees. So when we’re getting the commands from the arxterra, we can convert the numbers to degrees depending on the servo max and min. The only way to control these servos are through the arxterra control panel.

else if (cmd == CAMERA_MOVE){

     pulsedegree = map(data[4], 0, 180, SERVOMIN, SERVOMAX);

     pwm.setPWM(9,0, pulsedegree);

     pulsedegree = map(data[6], 0, 180, SERVOMIN, SERVOMAX);

     pwm.setPWM(8,0,pulsedegree);  

     delay(1000);   

     }

The data[4] and data [6] are the turn degrees that arxterra sends. Data 4 pertains to the pan degrees and data 5 is the tilt degrees.

Conclusion:

In conclusion we were able to control the servos for the pan and tilt with the control panel on the arxterra app. With the command line above, we were able to convert our servos to degrees and have it turn accordingly. The code above is on the command page with the move command.