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:
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 !
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.
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?
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.