Controlling continuous servo motor

Good day everyone,

I am looking to control a continuous servo motor with my Nrf52840 Xiao, specifically the FS90R servo. I need it to map to an analog sensor so that as the analog sensor reads pressure data, the servo moves forwards and backwards accordingly. Previously I have been using a regular 180 degree servo motor and it was working fine (code below) but continuous servos don’t seem to have positional control so I’d greatly appreciate any guidance on similar topics or examples.

Thank you for your time!

Code for 180 degree servo:

#include <Servo.h>
#include <Wire.h>

Servo myServo;

int pressure;
int angle;
int i = -179;
void setup() {
  // put your setup code here, to run once:
  myServo.attach(A1);

  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  pressure = analogRead(A0);
  Serial.println(pressure);
  delay(50);

  angle = map(pressure, 0, 1023, -179, 179);
  //Serial.println(angle);
  //delay(50);

  myServo.write(angle);
  delay(50);

}

wELCOME…Continuous Rotation Micro Servo [FS90R] : ID 2442 : Adafruit Industries, Unique & fun DIY electronics and kits

Hi there,
I would agree with ,
" Continuous servos are misnamed. They are not servos, they are gearmotors that have their speed and direction controlled by a servo signal, only. Their positional feedback element is disconnected so they cannot know their position. They are no longer servos and cannot be set to a position . If you use timing to go to a position the timing for a certain position will change with motor supply voltage and/or load."
However, a Home position signal,It can be a switch with a cam, an IR sensor with a hole in a disk or reflector on a dark background, or a Hall Effect switch and a magnet… Something to let the Arduino know when the “thing” has reached the HOME position.

HTH
GL :slight_smile: PJ :v:

these are primarily used for forward and reverse, with some sort of limit switch.
Easy for a Xiao nRF52840 BLE, and for a Sense version if the the electronics is on the servo platform, onboard IMU for knowing Speed , Acceleration and direction could be utilized.

Hey PJ,

Thanks for the reply, so are you saying besides the fact that we can set a “home” signal with some kind of limit switch, there’s not much we could do? I am only realistically looking for setting 360 or max 720 degreee rotation, is there anything I could do?

Thank you

if you remove the stop but do not disable the pot you may be able to program it… just an idea… not sure

you may could break out the pot to a separate control feedback loop

Hi there,
Stepper motor or Encoder… Pretty much it for other options.
either is a good choice too. just depends on the torque and other stuff which way to go and the $$ cheese for said method as well.

GL :slight_smile: PJ
All very easy for a Xiao design though :+1:

According to the function you required, what you need is a step motor or a more advanced servo motor, not the servo.