continuous servo/motor speed control

Hi

I am really new to Arduino coding and am currently building Pintograph with Arduino.

There are two servos required. One servo rotates in fixed speed while the other rotate in different speed.
Has anyone built pintograph with arduino, if so, is it wiser to use two motors than two continuous servos?

Without using potentiometer, can i program Arduino so that I can change the speed of the servo?/b]

You can control motors direct from the Arduino,
you can read a potentiometer from an analog input if you want,
you can control the motors from that analog value if you want, or not...
Many things are possible.

If you want repeatable positioning of the motors then you either
need servos, or some other motor (a continuous rotation servo is
a motor, not really a servo) plus an encoder or other means of sensing
rotational position.

Servos have all the position sensing and feedback loop built-in,
but most hobby servos only do about 150 to 180 degree rotation range.

1 Like

Seems to me that two continuous rotation "servos" would do the trick if it's a simple speed setting you need. Added bonus is that they turn both ways, if that is of any advantage in that project.

Without using potentiometer, can i program Arduino so that I can change the speed of the servo?

Well a pot is an easy way of you telling the thing how fast to go, but yes you could change the speed in the code. You could for example:

  • Have some buttons that set say slow, medium fast
  • Base the speed on time elapsed since the Arduino reset or some button was pushed
  • Use random() to change the speed every now and then

Not sure why you don't want to use a pot, since it's an easy way for the user to control the machine.

Without using potentiometer, can i program Arduino so that I can change the speed of the servo?/b]

You could control the speed/direction from the pc keybosrd via the serial monitor, or if you had an ethernet card the speeds could be controlled from a web page. Below is some servo test code for use with the serial monitor.

// zoomkat 3-28-14 serial servo incremental test code
// using serial monitor type a character (s to increase or a 
// to decrease) and enter to change servo position 
// (two hands required, one for letter entry and one for enter key)
// use strings like 90x or 1500x for new servo position 
// for IDE 1.0.5 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

#include<Servo.h>
String readString;
Servo myservo;
int pos=1500; //~neutral value for continous rotation servo
//int pos=90;

void setup()
{
  myservo.attach(7, 400, 2600); //servo control pin, and range if desired
  Serial.begin(9600);
  Serial.println("serial servo incremental test code");
  Serial.println("type a character (s to increase or a to decrease)");
  Serial.println("and enter to change servo position");
  Serial.println("use strings like 90x or 1500x for new servo position");
  Serial.println();
}

void loop()
{
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }
  if (readString.length() >0) {
    if(readString.indexOf('x') >0) { 
      pos = readString.toInt();
    }

    if(readString =="a"){
      (pos=pos-1); //use larger numbers for larger increments
      if(pos<0) (pos=0); //prevent negative number
    }
    if (readString =="s"){
      (pos=pos+1);
    }

    if(pos >= 400) //determine servo write method
    {
      Serial.println(pos);
      myservo.writeMicroseconds(pos);
    }
    else
    {   
      Serial.println(pos);
      myservo.write(pos); 
    }
  }
  readString=""; //empty for next input
}

It's a basic CNC type setup.
If you're using servos you don't so much control the speed, you just control where you send them and when.

For example: if you send a signal to move them by 90 degrees, they'll pretty much do it straight away, but if you send them 90 separate commands to move 1 degree, with a small lag between each command, they'll still move 90 degrees, but in the time that you want it to take them.

KenF:
If you're using servos you don't so much control the speed, you just control where you send them and when.

But it's clear from what she asks, and from the pic, that the whole idea is to have two motors spinning at different speeds. Looks to me that the pattern of the pen depends on the (lack of) synch between the motors.

One servo rotates in fixed speed while the other rotate in different speed.

It's the (relative) speed that's important, not the position.

JimboZA:
But it's clear from what she asks, and from the pic, that the whole idea is to have two motors spinning at different speeds. Looks to me that the pattern of the pen depends on the (lack of) synch between the motors.

One servo rotates in fixed speed while the other rotate in different speed.

In that case you send one motor new instructions to move a set distance at regular intervals
While the other one you send signals at varying times to suit it's desired varying speed.

I'd consider using stepper motors for this, or some kind of speed/position feedback on the motors. Otherwise, if one motor slows down a little because of increased resistance at some angles, it will mess up the pattern.

Things like the Spirograph rely on the various oscillations being at rigidly fixed phase velocity relative to each other. Continuous rotation servos won't give you that.