[FIXED IN FW 4.2.2] Simple Question about Servo
#1
Posted 07 January 2013 - 04:36 PM
Note : I use an External Power Suply 6v with grond liked together.
public class Program { static PWM servo = new PWM(PWMChannels.PWM_PIN_D10, 20000, 1500, PWM.ScaleFactor.Microseconds, false); public static void Main() { servo.Start(); // write your code here servo.Duration = 5000; // Full Right Thread.Sleep(1000); servo.Duration = 1000; // Full Left Thread.Sleep(1000); servo.Duration = 2500; // Full Center Thread.Sleep(1000); } }
Jean-Martin
#2
Posted 07 January 2013 - 06:18 PM
Bonjour Jean-Martin,
I think you may be confusing standard servos with the continuous rotation servos like you have from Sparkfun. Most standard servos are limited to 180 degrees of rotation and will often need a pulse for a specific duration to send to to the far right, far left, or stay at centre. A continuous rotation servo is not limited in its motion and can continually rotate a full 360 degrees. And as such it has a different behaviour than the other servos.
For the continuous rotation servo you may find (and results vary depending on servos) that if you send a pulse of 2.5ms every 20ms, it will stay at the centre, or not rotate. Then anything higher than 2.5ms will actually increase the speed of the servo in a clockwise direction, up to a maximum value, in your case 5ms. So at 5ms your servo will rotate at its fastest speed towards to right, or clockwise direction. If you send a pulse of 3ms, it will still rotate to the right, but slightly slower.
If you want it to go counter clockwise, or left, you send it a pulse less than 2.5ms, with the fast speed at 1ms.
Hopefully this helps you out a little and gets you up and spinning. For a little more information on what's happening you can check out an earlier post I wrote on using a continuous rotation servo for the Netduino Go Shield Base.
Cheers,
Steve
- M8in likes this
Twiiter: https://twitter.com/Gutworks
#3
Posted 07 January 2013 - 06:47 PM
Sorry my mistake is this servo https://www.sparkfun.com/products/9065
Jean-Martin
#4
Posted 08 January 2013 - 03:50 AM
Admittedly I'm still wrapping my head around what the hardware does with a period of 20000 and a duration of 2500. My tests show that I needed to double my durations when my period is set @ 20000. The documentation that you read indicating position should not be nebulous, with your statement of 1ms or 2ms. Typically there is a very specific pulse for a very specific position.
I've yet to figure out why I have to double my pulses to get the levels that I expect.
My understanding is that a period of 20000 means 20ms from pulse to pulse... and 1.5 ms duration means how long. The question really for me is whether it is supposed to be a ratio of the period, or an amount of time.
I pulled NETMF 4.2 driver code from the forum, but I pulled my hair a bit until I realized that I got exactly the results that I expected when I doubled my durations from the tech spec, but the example code all showed similar boundaries to what I was expecting.
So.. either my servo (HS-322HD Deluxe) is very different from others in the example or the example code has never been tested on the N+2.
Tech spec shows pulse widths of 600 to 2400 for 180 degree motion with a 20ms pulse cycle.
No answers really just more questions.
#5
Posted 08 January 2013 - 04:36 AM
Hi Thomas,
There are odd things happening with the PWM of the Netduino Plus 2 at the moment. I've noted some things in this post. So perhaps some of the confusion is being caused by these oddities. Chris has confirmed that they have been fixed on the NP2 and the new firmware is currently being tested. I'm not sure when it will be released, but I don't suspect it will be long.
Cheers,
Steve
Twiiter: https://twitter.com/Gutworks
#6
Posted 08 January 2013 - 02:42 PM
Ahh Steve thanks.. I haven't done much server or PWM work before so it was pretty easy to doubt my understanding. I ran through several tests and verified that changing the period does not have any effect on the position with a given duration, so I feel better that it's not related to some magic number ratio.
Thomas
#7
Posted 10 January 2013 - 12:05 AM Best Answer
Fixed on FW version 4.2.2
Jean-Martin
#8
Posted 10 January 2013 - 02:37 AM
Fixed on FW version 4.2.2Awesome. Thanks for the bug report, and for following up to let us know that the fix is working for you. Please let us know if you run into any other troubles. Chris
#9
Posted 10 January 2013 - 05:21 PM
Hi JMiljours, Okay, greatAwesome. Thanks for the bug report, and for following up to let us know that the fix is working for you. Please let us know if you run into any other troubles. Chris
Thanks go to you, your team and this awsome comunity !!!
- Thomas Rankin likes this
Jean-Martin
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users