Servo motor shakes wildly...

I am new to this community and this is my first inquiry. My apologies if I have chosen the wrong board.

Anyway, I set up the circuit in accordance with the directions in Chapter 5, the Mood Cue Project in the Arduino Project Book. I typed up the code and uploaded it successfully. However, when I connected the power, the Servo Motor started vibrating wildly and when I tried to control it with the potentiometer, it responded but the moment I let it go, it began to shake wildly again. I have compared my set up to others in several You Tube videos and I have read several accounts of difficulties with the Mood Cue set up, but I am still having difficulties. I have included several photos of my circuit and would like to know if anyone out there offer any assistance?

Also, I tried to post a video but received a message stating that the file was too large. Is there work around for showing videos of problems?

1 Like

This may be silly, but do you have a wire connecting your Arduino "GND" to the Ground bus on your prototype board?

You have included only one ridiculously large photo but it doesn't show all the wiring or the servo. Unless it's a very small servo then powering it from the 5V pin is a bad idea.

Please post the exact code that you are using (use the </> code tags - see "How to use this forum"). I don't know the Arduino Project Book but the code on what looks like the associated web page is useless because they forgot to write anything to the servo.

BTW what value are the capacitors and are you sure they're connected the right way round?

Steve

Weird wiring for your servo. Most servos have the wiring as GPS you have GSP. Have a part ID for it?

Have a different power source for the servo(s) such as 4 AA bats. Have all GNDs connected.

Definitly do not power a servo from the Arduino's 5V logic supply.

Its a servo (or servomechanism), not a servomotor. This is a servomotor: Servomotor - Wikipedia

it responded but the moment I let it go, it began to shake wildly again

Sounds like a loose connection on the pot.

@ CurtCarpenter: Yes

@ slipstick: I have attached a smaller image of the circuit with what I think is a better view of all the pins and I have copied the sketch below. The sketch was copied verbatim from the Arduino Project book that was sent to me from Arduino when I ordered the Arduino Uno kit from them. So I don't think the problem is in the code.

The decoupling capacitors are 100UF

#include <Servo.h>

Servo myServo;


int const potPin = A0;
int potVal;
int angle;


void setup() {
myServo.attach(9);

Serial.begin(9600);
}

void loop() {
potVal =analogRead(potPin);
Serial.print("potVal: ");
Serial.print(potVal);

angle = map(potVal,0,1023,0,179);
Serial.print(", angle: ");
Serial.print(angle);


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


}

@ justone: As for the servo's wiring, this is the way it came, which is different than the it appears in the the Arduino Projects Book... I did a lot of research and found that others had this problem as well. The fix is easy. Just a matter of reversing the wires and making sure they go to the right place.

@MarkT: With regard to the terminology, I am only using those terms that were given for the different components in the Projects Book given to me by Arduino. If you think they are using the wrong terms to describe this "servomotor" then it would probably be a good idea to address this directly to Arduino.

I am also using the 5V pin because that is what the instructions said to do.

@Grumpy-Mike: your explanation seems closest to the mark. I notice that if I press down on the pontentiometer hard enough while I turn it, the shaking subsides. What do you think I can do to improve the connection?

Where are my manners? Thank you to everyone who took a little time out to help me with this problem. I am truly grateful.....

Attached are the pages from the Arduino Project Book that explain the set up of the circuit.

1 Like

You have those Serial.prints in there so you should be able to tell if it is a problem at the pot because the "potval" values printed to the serial monitor will vary all over the place. Can you post some examples of the serial output 1. when you're not touching the pot and the servo is swinging wildly and 2. when you holding the pot and turning it slowly.

Steve

What do you think I can do to improve the connection?

The problem is that the connections on that sort of pot are not ideal for fitting on the Solderless bread board.

You could try moving the pot along another row. Or moving the wires in and out. It is likely to only be the center connection of the pot because a loose connector on the other two would just drive the servo to one end or the other.

The real answer would be to solder short wires into the pot connectors and put in the wires to the breadboard.

I am also using the 5V pin because that is what the instructions said to do.

The instructions were written by someone who does not understand that the 5V pin cannot safely power any motor or servo.

Do not follow those instructions, as you may damage the Arduino. Instead, use a 4xAA battery pack to power the servo, and connect the grounds.

1 Like