Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

[FIXED IN FW 4.2.2] Simple Question about Servo


Best Answer Jean-Martin, 10 January 2013 - 12:05 AM

Fixed on FW version 4.2.2

Go to the full post


  • Please log in to reply
8 replies to this topic

#1 Jean-Martin

Jean-Martin

    Member

  • Members
  • PipPip
  • 18 posts
  • Location[FR], Montreal, Canada

Posted 07 January 2013 - 04:36 PM

Why i need to Send a duration of 5.0 ms to have full right of my servo every place i read said about 1ms to 2ms but mine require 5 ms here is the servo  https://www.sparkfun.com/products/9347 (edit bad product) https://www.sparkfun.com/products/9065and the code i have a Netduino plus 2 firmware 4.2.1. 
Thx for your explaintion
Note : I use an External Power Suply 6v with grond liked together.
Jean-Martin
    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 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

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



#3 Jean-Martin

Jean-Martin

    Member

  • Members
  • PipPip
  • 18 posts
  • Location[FR], Montreal, Canada

Posted 07 January 2013 - 06:47 PM

Sorry my mistake is this servo https://www.sparkfun.com/products/9065



Jean-Martin


#4 Thomas Rankin

Thomas Rankin

    Member

  • Members
  • PipPip
  • 26 posts

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 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

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



#6 Thomas Rankin

Thomas Rankin

    Member

  • Members
  • PipPip
  • 26 posts

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 Jean-Martin

Jean-Martin

    Member

  • Members
  • PipPip
  • 18 posts
  • Location[FR], Montreal, Canada

Posted 10 January 2013 - 12:05 AM   Best Answer

Fixed on FW version 4.2.2



Jean-Martin


#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 January 2013 - 02:37 AM

Hi JMiljours, Okay, great
Fixed on FW version 4.2.2
Awesome. 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 Jean-Martin

Jean-Martin

    Member

  • Members
  • PipPip
  • 18 posts
  • Location[FR], Montreal, Canada

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 !!!



Jean-Martin





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.