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?
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?
@ 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.
@ 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?
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.
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.