Problems with angle controll Parallax 360 and Arduino Mega

Hello,

I'm using an Arduino Mega and the Parallax Feedback 360° Servo. I have tried everything that I 'm capable of, but I hit a wall. I'm a beginner (only stated with Arduino coding for about 2 months). The end goal is to use it for an compass in combination with the servo. I’ve to come across this particular servo, as it’s capable of 360° rotation with angle control via a hall sensor.

For the connection it’s like in the photo:

I tried using a condesator to possibly smooth the voltage.

The issue is that there is a dead zone. From about 36 to 360°, the servo is perfectly capable to position itself. However, if you try to hold the servo between 1 and 36°, the servo gets stuck in an endless loop.

Another issue is that once the servo is finished with its code, it keeps rotating clockwise. And when it gets to the dead zone it gets stuck again.

I tried reading the datasheet and from what I can see, the header file uses the exact same calculations as proposed in the data sheet. I’m using the following library:

I looked on this forum and, on the internet, but I’ve have yet to find the solution. I chose this servo because I need the angular positioning AND the 360° rotation.

The library I use is the following:

The Parallax datasheet is as follows:
https://www.robotshop.com/media/files/pdf/parallax-feedback-360-high-speed-servo-datasheet.pdf

The code is is as follows:

#include <Wire.h>
#include "FeedBackServo.h"

#define FEEDBACK_PIN 2  //Servo1 - Define feedback signal pin (Yellow wire)
#define SERVO_PIN 3  //Servo1 - Define control pin (White wire)

FeedBackServo Servo1 = FeedBackServo(FEEDBACK_PIN);  //Servo1 - Set feedback signal pin number

int Cycle = 0;
void setup(){
  Serial.begin(9600);  //Baud rate
  Servo1.setServoControl(SERVO_PIN);  //Set servo control pin number
  Servo1.setKp(1.0);    
}

void loop(){
  for (int i=360; i>40; i-=5){
    Servo1.rotate(i,1);// move servos to center position -> 90°
    Serial.println(Servo1.Angle());
    //delay(500);
  }  
}

If I leave the lower limit of the for loop above 40, it works just fine. But as stated, I need the full range. If you rotate through the deadzone, without stoping there, it also works fine. For example if you cycle though the angles from 0 to 180°, there is no issues.

Any help would be appreciated.

1 Like

Your Datasheet is suggesting a 40 wide deadzone around 1480...1520, your library/code is using a 60 wide deadzone around 1490 +-30 = 1460...1520 - try adjusting these to the datasheet values and investigate further (see in Parallax-FeedBack-360-Servo-Control-Library-4-Arduino/FeedBackServo.cpp at master · HyodaKazuaki/Parallax-FeedBack-360-Servo-Control-Library-4-Arduino · GitHub )

Without access to the hardware I cannot assert this further.

Thanks for the input, I will try it out and let you know if it helped.

Yes it's understandable. I did contact Parallax, but sadly they say they don't support the arduino.

I hear you are from MakerSpace in Munich, drop by with your Hardware and I can guide you to have a look and fix the issue, contact our frontdesk again for a meeting.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.