Hi,
I have a Feetech FR5317M connected to a Metro Mini and wonder how I can implement what you explain in your servo with feedback tutorial https://learn.adafruit.com/analog-feedb ... g-feedback.
The servo's feedback pin outputs a voltage from the potentiometer inside, not a PWM signal.
The feedback has to be calibrated first by rotating the servo to two known positions, but obviously, that cannot be done out of the box with a continuous rotation servo.
Any ideas?
Continuous rotation servo with feedback - how to run?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Systembolaget
- Posts: 335
- Joined: Wed Mar 08, 2017 1:01 pm
- adafruit_support_bill
- Posts: 88088
- Joined: Sat Feb 07, 2009 10:11 am
Re: Continuous rotation servo with feedback - how to run?
Send a known pulse width to the servo. Then measure the position. It is now a 'known' position. Then you can measure the voltage on the feedback lead to correlate with that position.
- Systembolaget
- Posts: 335
- Joined: Wed Mar 08, 2017 1:01 pm
Re: Continuous rotation servo with feedback - how to run?
Thanks, if I use with value ranging from 500 to 2500, the servo won't stop in a position, it only rotates forwards or backwards, slower or faster, so I can't measure anything meaningful on the feedback lead.
Any other ideas?
Code: Select all
myservo.writeMicroseconds(value);
Any other ideas?
- adafruit_support_bill
- Posts: 88088
- Joined: Sat Feb 07, 2009 10:11 am
Re: Continuous rotation servo with feedback - how to run?
The guide you referenced is for servos with an external lead for the analog feedback such as this one: https://www.adafruit.com/product/1404
The FR5317M - like most continuous rotation servos does not have any external feedback. In fact, even the internal feedback has been disabled. So by definition, they are not even servos: https://learn.adafruit.com/adafruit-mot ... vo-2875539
Parallax makes a continuous rotation servo with digital feedback: https://www.adafruit.com/product/3614
The FR5317M - like most continuous rotation servos does not have any external feedback. In fact, even the internal feedback has been disabled. So by definition, they are not even servos: https://learn.adafruit.com/adafruit-mot ... vo-2875539
Parallax makes a continuous rotation servo with digital feedback: https://www.adafruit.com/product/3614
- Systembolaget
- Posts: 335
- Joined: Wed Mar 08, 2017 1:01 pm
Re: Continuous rotation servo with feedback - how to run?
It sure has a (fourth) feedback wire, also says so in the spec sheet. I made a typo, it's FB5317M, not FR5317M.
How about hooking it up, feedback wire to A0, and then manually turning it to two positions, noting down the value at A0 for both positions?
How about hooking it up, feedback wire to A0, and then manually turning it to two positions, noting down the value at A0 for both positions?
- adafruit_support_bill
- Posts: 88088
- Joined: Sat Feb 07, 2009 10:11 am
Re: Continuous rotation servo with feedback - how to run?
Not familiar with that model. Looks like it uses an AS5600 hall-effect encoder for the feedback.
Most (but not all) servos will disable active control in the absence of a control signal. If that is the case with the FB5317M, you should be able to power the servo with the control signal disabled and manually rotate it to known positions for calibrating the feedback.
Most (but not all) servos will disable active control in the absence of a control signal. If that is the case with the FB5317M, you should be able to power the servo with the control signal disabled and manually rotate it to known positions for calibrating the feedback.
- Systembolaget
- Posts: 335
- Joined: Wed Mar 08, 2017 1:01 pm
Re: Continuous rotation servo with feedback - how to run?
The blurb says not Hall-effect sensor (like Parallax, for which there's feedback code), but good ol' potentiometer tapping.
I think I'll give the manual rotation method a whirl. If that works, one could augment the tutorial, because a calibrated continuous rotation servo (with feedback from a pot) one can rotate to an angle and then stop it there with 1500 milliseconds would be nifty.
I think I'll give the manual rotation method a whirl. If that works, one could augment the tutorial, because a calibrated continuous rotation servo (with feedback from a pot) one can rotate to an angle and then stop it there with 1500 milliseconds would be nifty.
- adafruit_support_bill
- Posts: 88088
- Joined: Sat Feb 07, 2009 10:11 am
Re: Continuous rotation servo with feedback - how to run?
The Feetech site (translated) says: "AS5600 feedback line"
https://feetechrc.com/multi-mode-operat ... ction.html
The AS5600 is a hall-effect encoder that can do either analog or PWM output.
https://ams.com/documents/20143/36005/A ... 5_5-00.pdf
https://feetechrc.com/multi-mode-operat ... ction.html
The AS5600 is a hall-effect encoder that can do either analog or PWM output.
https://ams.com/documents/20143/36005/A ... 5_5-00.pdf
The AS5600 is a Hall-based rotary magnetic position sensor
using planar sensors that convert the magnetic field
component perpendicular to the surface of the chip into a
voltage.
- Systembolaget
- Posts: 335
- Joined: Wed Mar 08, 2017 1:01 pm
Re: Continuous rotation servo with feedback - how to run?
All right, with the below, I obtain feedbackMin 0 and feedback Max 690 (values from 688 to 692 on multiple trials).
Now I have to write code that continuously compares feedback to a desired Min or Max value, and then stops the servo's rotation with, when that value is reached.
Now I have to write code that continuously compares feedback to a desired Min or Max value, and then stops the servo's rotation with
Code: Select all
myServo.writeMicroseconds(1500);
Code: Select all
#include <Servo.h>
const byte pinServo = 6;
const byte pinFeedback = A0;
int feedback = 0;
int feedbackMin = 1023;
int feedbackMax = 0;
Servo myServo;
void setup()
{
Serial.begin(1200);
myServo.attach(pinServo);
while (millis() < 7000)
{
myServo.writeMicroseconds(2000);
feedback = analogRead(pinFeedback);
if (feedback > feedbackMax) // Seek maximum
{
feedbackMax = feedback;
}
if (feedback < feedbackMin) // Seek minimum
{
feedbackMin = feedback;
}
}
myServo.writeMicroseconds(1500);
Serial.print("Min: "); Serial.println(feedbackMin);
Serial.print("Max: "); Serial.println(feedbackMax);
}
void loop()
{
}
- adafruit_support_bill
- Posts: 88088
- Joined: Sat Feb 07, 2009 10:11 am
Re: Continuous rotation servo with feedback - how to run?
You will probably want to slow it down as you approach your setpoint to avoid overshoot. A PID algorithm is commonly used for that. Brett Beauregard's has an excellent PID library for the Arduino.
http://brettbeauregard.com/blog/2011/04 ... roduction/
http://brettbeauregard.com/blog/2011/04 ... roduction/
Please be positive and constructive with your questions and comments.