Hi everyone an RC beginner here. I am using a hitec digital servo HS-7235MH with an Arduino Uno. The digital servo is powered externally by 6v and the board via usb, as seen in the image. Although in reality, I connect two two-3v battery holders in series to get 6v:
I wanted to test the moving the servo horn to a set position and have it remain there. I used this code I found online:
void setup ()
void loop ()
The code worked for the angle range 20-160 degrees. I am uncertain why for 0-20 degrees it did not work( The servo remained in the former position and did not move at all, setting it to 0 degrees did not do anything) . I would appreciate any advice. Thanks
@johan09, your topic has been moved to a more suitable location on the forum. I'm not sure why you though that this relates to avrdude, stk500 or bootloader.
In future, please use code tags when posting code. You can modify your post, select all code and click te </> button; next save your post.
If that’s really how it’s wired, you’re lucky anything happened at all !
Where’s the common ground/0 V between everything?
I’m guessing you’ve been using USB to power the Arduino, that’s ok, but all components mus be on the same ‘page’ electrically.
BTW, servos rest at approximately 90 degrees, you have to specifically ‘send’ them to zero, or other required position.
P.S. Don’t use frizzy diagrams, or yellow wires on white !
Heh,Heh I wrote a similar response and then realized the Brown wire IS the common ground
This page says that the stock version has a travel of 121° (not 180).
You could try servo.writeMicroseconds()
Lastly the servo position is defined by the length of the pulse at the input of the servo. Nominally this is 1000 ... 2000µs. Many servos also react on pulses a little bit shorter or longer. The servo lib maps the degrees ( 0...180 ) to a pulse length. By default in a range of 544µs to 2400 µs. This is far too short or too long for many servos. Digital servos don't even react on pulslength outside of their range. This is why your servo ignores writes in a range <20 or > 160 degrees.
It is possible to set the minimum/maximum puls length ( = the values for 0/180 degrees ) as parameteres in the attach method. So you can adjust to your servo. But the servo will not really do a 0 to 180 degree sweep.
My apologies for that mistake, I will do so in future. Not sure how that happend
Hi, I believe it is as @cherk says with the brown wire coming from the arduino as the common ground.
Can you please elaborate whats meant by servos resting at 90 degrees?
Sorry this is not my diagram or code, I took it from the tutorial I followed : Arduino : How to Use a Servo Motor With an External Power : 5 Steps (with Pictures) - Instructables Ill keep that in mind though if I make my own
Hi @MicroBahner . I checked the specs for the servo and it says max pwm signal range : 750-2250μsec . To confirm with your input, is this the reason for the servo not being able to reach 0 degrees cause the pulse length for that angle is lower than the min range?
So did you try
Hi @Wawa thanks,I have not yet, but shall do so abit later
Yes, it is. Pulse width shorter than 750µs ( and longer than 2250 ) will be ignored by your servo. You could use
myServo.attach(servoPin, 750,2250 );
to set the max/min pulselength according to your servo.
On the original page for the wiring picture, at least when you zoom in you can see where the yellow wire goes…
Same in that page's code, pin 9.
Thanks for the confirmation
@alto777 thanks for the checking out the link. I forgot to mention I connected the signal wire to pin 3
@Wawa thanks I had a try at it just now and that worked for 750us and 2240us.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.