Servo Assistance - Please

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
chipfryer27
Posts: 223
Joined: Fri Jun 06, 2014 3:53 pm
Contact:

Servo Assistance - Please

Post by chipfryer27 »

Hi

Never had cause to use a servo before so I'm completely new to the subject. I obtained a few MG90S a while back and I'm only now starting to play.

My understanding of how a servo operates, and if I am wrong please correct me, is that it needs a train of pulses to set/hold its position and the position is dependent on the width of the pulse. From datasheets and forums I believe the pulse width to be 1mS - 2mS, corresponding to minimum and maximum rotation accordingly (1.5mS would have it in the mid position).

Fair enough and armed with the above I downloaded the example code which simulated exactly as I expected. The servo moved a total of 180 degrees. The datasheet for the MG90S implies that it operates as above and has a maximum rotation (from minimum) of 180 degrees so I connected things up in hardware.

I checked the output with a scope (before connecting to the servo) and all good. It was outputting a pulse of expected width and this could be adjusted between limits using the Pot (note I set the controller minimum and maximum to 1mS and 2mS from default).

I then connected the servo. However when I adjust the Pot to vary the output from 1mS to 2mS, I get a maximum rotation of only 90 degrees not the expected 180 suggested in the datasheet or in simulation.

Am I (yet again) doing something stupid or have I completely misunderstood things?

Aware that sending incorrect pulses can damage servo's, but not caring as these little units are so cheap and it's fun to break things anyway, I set off at a different angle (pun intended). I first modified the component to output a maximum of 3mS, sent it to the chip and noted what happened. I would get rotation up to a pulse width of 2.6mS. Anything above and it didn't move, and anything below caused it to rotate in the opposite direction. From that I took it to be that the maximum rotation is achieved at 2.6mS. Similarly I lowered the minimum value and found the minimum pulse width to be 500uS.

With these values entered into the component the simulation again gave 180 degrees rotation and when downloaded the servo now moves ~180 degrees. So why the huge discrepancy from datasheet and example code? Is it that the servo is just too cheap to be accurate (I got five for under a tenner delivered), actually uses different pulse widths to that expected or am I completely misunderstanding things?

Regards

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9100
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Servo Assistance - Please

Post by medelec35 »

The datasheet shows ~1ms to ~2ms.
By definition ~ means weak approximation.
I have also found in the past that for full 180 deg pulse width is from .5ms to 2.5ms

Just make sure servos don't hit their end stop.
If they do not only will excessive current flow, but they will also become damaged.
Martin

chipfryer27
Posts: 223
Joined: Fri Jun 06, 2014 3:53 pm
Contact:

Re: Servo Assistance - Please

Post by chipfryer27 »

Hi Martin

Thanks for your reply and advice, appreciated as always.

Regards

User avatar
Jay Dee
Posts: 397
Joined: Tue Aug 18, 2009 6:42 pm
Contact:

Re: Servo Assistance - Please

Post by Jay Dee »

Agreed, both the SAVOX SW 0231MG and DS 3218MG servos both need the full 500 to 2500 pulse period to achieve the stated 180 degree range.

FYI, I've seen some odd behavior with the chinese DS3218 but the Savox (twice the price) has behaved flawlessly so far.
I have noticed that for some servos if you send a period value beyound that acceptable, it will not respond; as such I advise creeping up on your max values. For example, one servo would only respond to signals greater than 550ms.
J.

chipfryer27
Posts: 223
Joined: Fri Jun 06, 2014 3:53 pm
Contact:

Re: Servo Assistance - Please

Post by chipfryer27 »

Hi Jay Dee

Thanks to both you and Martin for your replies. Never having used one I thought at first I was so very off in my understanding.

Yesterday I set the component to give me two channels, connected up and didn't like what took place. Instead of motion I had two motors "stuttering". It didn't take too long to figure out what was wrong as luckily I still had a scope attached to channel 1 and could see straight away two pulses.. Although telling the component to have two channels I'd forgotten to actually set the second port...Duh...!

I'm enjoying playing with these servos and whilst these cheaply sourced ones I bought are great to experiment with, I don't think they will have too great a reliability. I can see myself using servos in a few projects that I've been meaning to build (guess I could write a book on that) and will probably look for something more robust so thanks for your info regarding the Savox motors, their website is very interesting.

Regards

Post Reply