I've spend about 5 days trying to control a Hitec Servo HS-311. I've tryied the standard library Servo, the SoftwareServo library and some codes that simply send the pulse using an analog pin. With all my servo only turns at same direction. I've a 360º (manipulated as shown in a lot of tutorials) and a normal servo. In both cases they only turn to same direction. One of them (360º) I can control it starts to run and stop and with the normal one when it arrives to 180º position stops and try to go again to 180º position.
Some one can write a short code to run for example 1 second forward and 1 second reverse to test if the problem was me or the servos?
Some idea about whats the problem?
Thanks a lot
Did you try running the Sweep example sketch with the standard Servo library? This moves the servo from one extreme to the other in 2 ½ seconds. Try it and let us know what your unmodified servo does when run with this sketch.
Once you get the standard servo going it will be easier to test the modified servo
Yes, I've tryed sweep example, and the standard servo only moves in one direction. It is a new servo and I supose it is working fine.
What hardware and software version are you using?
If you can make a video of your setup showing what happens when you run the sweep sketch it may help identify what is causing your problem.
The hardware is an Arduino Duemilenove buyed 3 days ago, and I conect the wire red and black direct to a 4 AA batterie pack rechargable 1800 mAh and the yellow to the pin of arduino. The movement is: If I move manually the servo to 0º In I send an order to move 180º it moves to that. When it arrive that position goes fast 15º yo 0º and returns to 180º. The full rotation moves all time to same direction in steps beetwen 10 and 15º. Tomorrow morning I0ll try to take a video.
Thanks a lot
In the sweep sketch try changing this line:
myservo.attach(9);
to
myservo.attach(9, 1000, 2000)
Which Arduino version are you running and what operating system are you using?
Arduino version is 00017 and the operating systen is windows XP sp3
I'm sorry but Carles
you never stated if you have the two grounds hooked up?
You need to connect the ground of the battery to the ground of the Arduino. That can cause a circuit to.. either not work, or work halfway.
The problem was the GND. The battery was conwcted direct to motor without common GND connection.
Thanks to all
damn.. the common GND issue got me debugging for days too, they should stress this in the Knob and Sweep examples for complete noobs like me ! :-/
thanks btw
I completely agree. I suggested a while ago that the reference should include the following text:
“servo motors can draw considerable current and an external power supply may be required to drive more than one or two servos. When using external power, the ground of the supply must be connected to Arduino and servo grounds”
See: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1250070061
Perhaps you can nudge mellis in the “bugs and suggestions” thread to make the changes to the servo reference page.