+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 35

Thread: QuickStart Servo Tester

  1. #1

    Default QuickStart Servo Tester

    I made a little program for testing servos with a QuickStart board. I explained what it does in the comments which I'm pasting here.

    Code:
      This program uses the QuickStart's touchpads to control up to 12 servos.
      The 8 servos will use pins 8 through 15 (between the pad pins and
      the LED pins).  These are referred to as "static servos" because they
      do not continuously move.  Their position must be adjusted using
      pads 0 and 1.
      There are also four "oscillating servos" starting at pin 24 (after the
      LED pins).  The period of oscillation is controlled using pads 2 and 3.
      The period uses servo refresh cycles as units.  At a 50Hz refresh rate,
      an oscillation period of 100 will be two seconds.  Increasing the
      period will make the servos oscillate slower.
      The lower pulse length end point may be adjusted using pads 4 and 5.
      The upper end point may be adjusted using pads 6 and 7.
      The higher number pad always increases the parameter while the lower
      number pad decreases the parameter.
      The end points are used by both the static servos and the oscillating
      servos.
      The amount the parameter changes increases the longer the pad is pressed.
      The parameters are displayed in a terminal window and also using the
      QuickStart's LEDs.
      The static servos' position is displayed (with LEDs) in binary with
      the center position zero.  Pulse lengths shorter than 1500us are
      displayed with the least significant bit on the right.  Pulse
      length longer than 1500us are displayed with the least significant
      bit on the left.  All the LEDs will be off when the pulse length is
      1500us (centered).
      The end point parameters use the same system or least significant
      bits as the static servos position.
      The end point parameters and oscillation parameters are displayed with the
      LEDs only while they are being changed and for a short time afterward.
      The period parameter has the least significant bit on the right.
    I made a demo video which I uploaded to YouTube.



    I want to caution people about powering servos from the QuickStart board. In general it's not a good idea. The servos I used in the demo were very small servos. I added a 1000uF capacitor across Vin and Vss to help with smooth out the power supply. The QuickStart board kept on resetting when the servos would move without the capacitor. It's a good idea to have a separate power supply for the servo(s). Just make sure you have a common ground connection between the two power sources.

    There are details explained in the comments that I didn't mention in the video. I thought I was making a short video but it ended up longer than five minutes.

    I hope this program is useful to some of you.

    Previous Version: Touch ButtonServo12011h - Archive [Date 2012.01.11 Time 21.03].zip (23.7kb, 179 views)

    Attached Version: TouchButtonServo130716a on July 16, 2013
    Last edited by Duane Degn; 07-16-2013 at 11:03 PM. Reason: Video Ready on YouTube

  2. #2

    Default Re: QuickStart Servo Tester

    Here is a picture of a QuickStart board with the pad functions labeled.



    I also labeled the pins used by both the static servos and the oscillating servos.

    The original photograph can be found on the QuickStart product page.
    http://www.parallax.com/Store/Microc...8/Default.aspx
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	QsServoTester.png‎
Views:	1609
Size:	518.5 KB
ID:	88515  
    Last edited by Duane Degn; 01-12-2012 at 01:25 PM. Reason: Added instuction photo

  3. #3

    Default Re: QuickStart Servo Tester

    One more reserved.

  4. #4

    Default Re: QuickStart Servo Tester

    Great job, Duane! I can see this being a useful tool.

    I like the "Servos Gone Wild" part of the video!
    MOV OUTA, PEACE

    ... Rick


    I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!

    "Forth is FUN!"

    Introduction to TACHYON Forth


    PropFORTH Wiki

  5. #5

    Default Re: QuickStart Servo Tester

    Very nice Duane!

    Thanks for the well documented code.
    Infernal Machine

  6. #6
    prof_braino's Avatar
    Location
    Between the pit of man's fears and the summit of his knowledge
    Posts
    4,006
    Blog Entries
    8

    Default Re: QuickStart Servo Tester

    Cool stuff. Although I imagined 14 pins on the bottom of a perf board, and 12 sets of 3 pins on top for all the servos. I guess your code controls one static servo, and one oscillating servo? Would is be do-able to select which servo is being controlled by cording multiple pads or something?

    If we did try to connect all twelve servos and a separate power supply, would we only need a cap between power and ground for the servo power, or would it take more parts?

    Did you notice any issue with the end stops on the servos? I had only micro servo on the quickstart, and using 3.3 volts it would chatter at the limit, but when
    I tired 5 volts it blasted through, and now it is a sort of continuous rotation servo

  7. #7

    Default Re: QuickStart Servo Tester

    Quote Originally Posted by prof_braino View Post
    Cool stuff. Although I imagined 14 pins on the bottom of a perf board, and 12 sets of 3 pins on top for all the servos.
    Yes, I suppose that would work. I personally don't see where it would be useful to use all 12 servo outputs at the same time. The main reason there are pins for 12 servos is because those pins weren't being used for anything else.

    Quote Originally Posted by prof_braino View Post
    I guess your code controls one static servo, and one oscillating servo? Would is be do-able to select which servo is being controlled by cording multiple pads or something?
    There are two groups of output pins to control the servos (as shown in post #2). All twelve pins are being driven whether or not a servo is attached. If you attached the data line from twelve (powered) servos, all twelve servos would move. Eight would move together as pads 0 and 1 were pressed and four would oscillate in unison.

    I would be posible to change the program to select servos by cording multiple pads. I almost used this technique to change modes but decided I didn't want to spend the time it would require to program it.

    Quote Originally Posted by prof_braino View Post
    If we did try to connect all twelve servos and a separate power supply, would we only need a cap between power and ground for the servo power, or would it take more parts?
    I think all that would be required is a separate power supply. If you didn't want to use the LEDs you could add eight more servos. The servo object used can control up to 32 servos at once. I limited it to 12 because of the pins. I wanted pins to be available for LEDs, touchpads and PC communication. I also left the I2C pins alone since I'm not sure how they would behave at start up with a servo attached to them.

    Quote Originally Posted by prof_braino View Post
    Did you notice any issue with the end stops on the servos?
    The micro servos I have, have a small physical stop on the final gear. It appears this stop hits a neighboring gear at its full throw. I worried I might damage the servos but I didn't worry much since these servo cost only a few dollars from HobbyKing.

    Quote Originally Posted by prof_braino View Post
    I had only micro servo on the quickstart, and using 3.3 volts it would chatter at the limit, but when
    I tired 5 volts it blasted through, and now it is a sort of continuous rotation servo
    I was using 5 Volts from the QuickStart's Vin pin. One of the reasons for the rat's nest of wires in the video was to split the 5V out to the two different servos. Fortunately the servos survived just fine (I think).

    If one wanted to be more cautious, they could change a couple of constants to limit the end point limits.

    These are the constant settings used in the program I posted.

    Code:
      _AbsoluteMaxPulse = 3000
      _AbsoluteMinPulse = 300
    Safer values would be:

    Code:
      _AbsoluteMaxPulse = 2500
      _AbsoluteMinPulse = 500
    Saver still would be:

    Code:
      _AbsoluteMaxPulse = 2000
      _AbsoluteMinPulse = 1000
    But that would also be pretty boring. The little servos I used only had about 90 degrees of rotation using end points of 1000us and 2000us. After changing the end points, the servos almost had a full 180 degrees of motion.

    I personally thought it was fun to watch the servo oscillate while changing both the end points and period. Those little servos can really get moving. It really makes me want to make some sort of walking robot with those little servos.

  8. #8

    Default Re: QuickStart Servo Tester

    Hi All,

    Is there any limit also how many servo can propeller can handle??
    as i have listen from senior that Atmega can handle on one servo (i.e. PWM)...

  9. #9

    Default Re: QuickStart Servo Tester

    The object Servo32v7 can control 32 servos but then you wouldn't have any pins left for input.

    I explain why I limited the tester to 12 servos in post #7.

    With some extra chips, the Prop can control up to 144 servos.

    BTW, I'm pretty sure Atmega chips can control more than one servo.

    I'm not sure if you know about servo control or not, but the term PWM isn't really an accurate way of describing the timing pulse a servo needs. You don't use PWM like you would use it to control a motor or a LED.

    There some information, starting around page 102, about servos in What's a Microcontroller.

  10. #10

    Default Re: QuickStart Servo Tester

    Hi ,

    Today i was using the propeller with servo...I was using simple waitcnt , delay sataement as we used in blinking LED on Board itself.
    While changing delay from max to min all value to servo was not working it just start move and stop while code RUN and i have notice the servo was sounding in it!!!
    For controlling servo is there different code to build??

  11. #11

    Default Re: QuickStart Servo Tester

    A lot of the problems I've had with servos have been do to using power supplies that were too weak.

    Make sure you have a good power source (not USB power from QuickStart!). A good 4.8V to 6.0V power supply might help. Make sure the grounds from the servo power and the QuickStart power are connected.

    There should be lots of servo control options with the Propeller. I'd suggest using "servo propeller site:forums.parallax.com" at Google. The "site:" feature of Google is a lot better than using the forum's search feature.

    Also look in the "Demo" folder of the Propeller Tool v1.3's library for the Servo32v7 demo there.

    JonnyMac also has a some servo control software.

  12. #12

    Default Re: QuickStart Servo Tester

    A lot of the problems I've had with servos have been do to using power supplies that were too weak.

    Make sure you have a good power source (not USB power from QuickStart!). A good 4.8V to 6.0V power supply might help. Make sure the grounds from the servo power and the QuickStart power are connected.
    I forgot to add that I am using 5V supply 7805(max 1amp) with 12V 2A adapter....and i have connected GND to GND.

  13. #13

    Default Re: QuickStart Servo Tester

    Quote Originally Posted by RITESH KAKKAR View Post
    I forgot to add that I am using 5V supply 7805(max 1amp) with 12V 2A adapter....and i have connected GND to GND.
    I'd suggest adding a 1000uF cap as well. Servos can draw a lot of current when they first start moving. I've had setups where I was sure I had good power but spikes of current kept dropping the voltage enough to reset the Prop.

  14. #14

    Default Re: QuickStart Servo Tester

    I have used capacitor but i want help on there working according to which code are used brief hint..

  15. #15

    Default Re: QuickStart Servo Tester

    Here's a simplified version of the demo program.

    Code:
    CON
        _clkmode = xtal1 + pll16x                           
        _xinfreq = 5_000_000                                'Note Clock Speed for your setup!!
        _Pin8 = 8                                        
    OBJ
      SERVO : "Servo32v7.spin"
    PUB Servo32_DEMO | temp
      SERVO.Start                 'Start Servo handler
      waitcnt(clkfreq / 20 + cnt)
      repeat
        SERVO.Set(_Pin8,1500)     'Move Servo Center
        waitcnt(clkfreq * 2 + cnt)    ' wait 2 seconds
        SERVO.Set(_Pin8,1000)     'Move Servo Clockwise (at least for most servos) 
        waitcnt(clkfreq * 2 + cnt)
        SERVO.Set(_Pin8, 2000)     'Move Servo Counterclockwise  
        waitcnt(clkfreq * 2 + cnt)
    This code uses pin 8 to control the servo. Does this help?

    Edit: I attached the Spin file.
    Attached Files Attached Files

  16. #16

    Default Re: QuickStart Servo Tester

    I have found most of code contain object to call (as Servo32v7) ...

  17. #17

    Default Re: QuickStart Servo Tester

    Quote Originally Posted by RITESH KAKKAR View Post
    I have found most of code contain object to call (as Servo32v7) ...
    It's in the library folder of the Propeller Tool version 1.3. It is also in the OBEX (I think). Here's where it is on my computer.



    I don't know what demon is possesing me that I behave so well.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	Servo32v7.PNG‎
Views:	1096
Size:	78.0 KB
ID:	88734  

  18. #18

    Default Re: QuickStart Servo Tester

    Hi there,

    I am using this servo and this code to control it..!! the problem is that how to move the servo at what timming, and i am confused how to find time cycle in this code?

    Code:
    Con                              {  move servo hooked to p8  }
    
      _clkmode = xtal1 + pll16x      'set to run @ 80Mhz 
      _xinfreq = 5_000_000           ' "   "  "  "   "
       
      srv1 = 8                       'srv1 = p8         propeller i/o pin servo hooked to
              
    Obj
    
      srv : "servo32v5"              'servo object  - 32 servo capabilty
      
    Var
        
    Pub main 
     
      srv.set(srv1, 1500)            'set servo to middle position
      srv.start                      'start servo object
    
      repeat                         'keep repeating servo movement
      
        srv.set(srv1, 1000)          'move servo to one end
        
        waitcnt(clkfreq + cnt)       'wait for servo to move
        
        srv.set(srv1, 1500)          'move servo to middle position
        
        waitcnt(clkfreq + cnt)       'wait for servo to move
        
        srv.set(srv1, 2000)          'move servo to the other end
    
        waitcnt(clkfreq + cnt)       'wait for servo to move

  19. #19

    Default Re: QuickStart Servo Tester

    Hi Ritesh,

    I don't think I understand your question. The timing of when to move a servo and to what position will depend on what you want it to do and when.

    What do you mean by "time cycle in this code"? How often the servo is moved? Or to which position it is moved?

    It looks like your code should work fine to move the servo once a second.

  20. #20

    Default Re: QuickStart Servo Tester

    Hi,

    Different servo have little bit diff pulse duration so, when i run this code it work but i want some help how to move it in both direction....I confused with servo working.
    if i have 360* servo so, at what pulse duration and how to find the duration i.e. duty cycle and fre from this code??

+ Reply to Thread

Similar Threads

  1. $3 Servo Tester
    By erco in forum General Discussion
    Replies: 14
    Last Post: 03-03-2013, 03:06 AM
  2. Modified QuickStart Demos and QuickStart Projects.
    By Duane Degn in forum Propeller 1 Multicore Microcontroller
    Replies: 35
    Last Post: 03-02-2012, 06:20 PM
  3. 12 channel servo tester, the Servo Boss
    By W9GFO in forum Propeller 1 Multicore Microcontroller
    Replies: 4
    Last Post: 07-24-2009, 10:26 AM
  4. Looking for Forum Servo Tester/Exerciser Schematic
    By Twisted Pair in forum General Discussion
    Replies: 6
    Last Post: 01-09-2009, 01:32 AM
  5. Simple servo tester
    By Archiver in forum BASIC Stamps Archive
    Replies: 0
    Last Post: 10-17-2000, 08:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts