Go Down

Topic: Servo motor only rotates once (Read 180 times) previous topic - next topic

hamodey

Hi everyone, first off I would just like to say I'm fairly new to Arduino and trying to get the hang of it.

Issue:

I currently am running a test on my Ultra Micro Servo Motor I bought from eBay 1.7g [linked below]. The code I am running is the example code shown everywhere online to rotate the motor from 0 to 180 and back to 0 in a loop. This works with the Servo Motor that comes with the Arduino Kit and also works for any other Servo Motor.

Now the Servo I have runs at 4.2v not 4.8v like the other two motors I have, so of course I was told to add a resistor to lower the V to 4.2v, disclaimer: I am not sure if this is correct as this is all running through a USB to my Laptop at 0.5A. The resistor I have is at 560 Ohms.

Any feedback would be greatly appriciated, again I would like to stress that the circuit and code is a simple online example from the Arduino book/website, so nothing too advanced. Any insight would be great.

Thanks

Servo: https://www.ebay.co.uk/itm/2-x-HK5320-Ultra-Micro-Servo-1-7g-0-04sec-0-075kg-torq-UK-seller/131117148447?hash=item1e8730e91f:g:C9AAAOxy0bRS~ddF:rk:10:pf:0

slipstick

That resistor will drop far too much voltage. Whoever suggested it had no idea what they were talking about.

Instead you would be much better using a diode between the 5V and servo to drop some voltage. Almost any basic silicon diode will do.

Steve

outsider

Might use a 6 Amp power (rectifier) diode though, TBOTSS.

slipstick

If those servos draw more than about 200mA they die. But overkill when choosing the diode won't do any real harm.

Steve

hamodey

That resistor will drop far too much voltage. Whoever suggested it had no idea what they were talking about.

Instead you would be much better using a diode between the 5V and servo to drop some voltage. Almost any basic silicon diode will do.

Steve
Hi Steve, thanks for the reply. The diode seemed to do the trick, however the rotation happens in one quick succession to 90 degrees, and then does not move. I then removed the power, rotated the Servo back to zero and plugged it back in, same thing, it rotates almost instantly to 90 and does not move.

Thanks  

outsider

#5
Dec 15, 2018, 01:35 am Last Edit: Dec 15, 2018, 01:36 am by outsider
Servos go to 90 degrees by default at startup, can you post your code?
Try this test sketch, servo connected to pin 9:
Code: [Select]
/*
 Try this test sketch with the Servo library to see how your
 servo responds to different settings, type a position
 (0 to 180) or if you type a number greater than 180 it will be
 interpreted as microseconds(544 to 2400), in the top of serial
 monitor and hit [ENTER], start at 90 (or 1472) and work your
 way toward zero (544) 5 degrees (or 50 micros) at a time, then
 toward 180 (2400).
*/
#include <Servo.h>
Servo servo;

void setup() {
  // initialize serial:
  Serial.begin(9600); //set serial monitor baud rate to match
  servo.write(90);
  servo.attach(9);
  prntIt();
}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    int pos = Serial.parseInt();
    pos = constrain(pos, 0, 2400);
    servo.write(pos);
    prntIt();
  }
}
void prntIt()
{
  Serial.print("  degrees = ");
  Serial.print(servo.read());
  Serial.print("\t");
  Serial.print("microseconds =  ");
  Serial.println(servo.readMicroseconds());



hamodey

Hi, thank you for this test code, it explained and helps me debug alot! It seems like the motor does not complete a full 180 degrees, it in-fact only capable of angles 24-165 degrees, and as my previous code had outside these boundaries (such as 180), it does not move. I have now adjusted my previous code to work with these limits, and it is working perfectly.

Thank you!

MarkT

That's normal, very few cheap servos do 180 degree movement, 120 degrees is more usual.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up