Programming Servo

Hello, I am relatively new to coding and I was wondering if this following scenario os possible. Would it be possible to control a continuous servo motor via an electrical input i.e. if voltage is 2 volts servo turns 360 degrees, 3 volts turns to 420 degrees, and 4 volts turns back to 0 degrees. Would something along this line be possible? I have tried many types of sample code combinations with added analog read for the voltage input using a conversion as well to convert the analog input to volts, but have been unable to make it work. Any suggestions?

Servos need ppm signals. So you'd have to have something like Arduino to read the voltages and send commands to the servo.

Continuous rotation servos do not have angular control. You can only tell them to go this way or that way but not where to stop. So no, what you want isn't possible with a continuous rotation servo unless you add some method of feedback so your program can detect its position.

In order to turn a continuous rotation servo a given number of degrees, position feedback will be required. The input to such a servo controls its speed and direction, not its position

Measuring the input voltage is relatively easy by comparison

If you want a servo that will go to specific positions and still travel more than 360 degrees then you probably want a sail winch servo like an HS785HB not a continuous servo.

It's relatively easy to use analogRead() to get values relating to voltages. And then once you have the values it is not difficult to translate them in the positional values that you need to write to a sail winch servo to send it to a particular position.

Steve

I think you need a geared stepper motor to control positions beyond 270 degrees. As mentioned above, a continuous motion servo doesn’t have position control, and standard servo’s don’t move much further than 180-270 degrees. With a stepper motor you can control its movement to any number of full rotations. It does however lack positional feedback, which may or may not be necessary depending on your application, but that can be added if you get one with an encoder. You need an encoder if there is any chance the load applied causes slippage or missed steps. Without an encoder, you assume no slippage caused by excessive load, and zero its position at some starting point with a switch or optical sensor.

Northof49:
I think you need a geared stepper motor to control positions beyond 270 degrees. As mentioned above, a continuous motion servo doesn’t have position control, and standard servo’s don’t move much further than 180-270 degrees.

But a sail winch servo has full positional control over usually 6-8 full turns. Which makes it MUCH easier to use.

Steve

slipstick:
But a sail winch servo has full positional control over usually 6-8 full turns. Which makes it MUCH easier to use.

Steve

My mistake, sorry. Might be just what he needs.

I believe you’re right Steve! Do you know where I can find a basic coding sample for that motor?

acdavis1999:
I believe you’re right Steve! Do you know where I can find a basic coding sample for that motor?

If you're talking about a sail winch servo then the standard IDE Sweep and Knob examples work fine.

The Knob example is very close to what you want except it is the voltage from a potentiometer that controls the servo rather than whatever your voltages come from. If you change it to use .writeMicroseconds() instead of .write() that will give you more accurate positioning.

Steve

Awesome, thank you!!