Shop OBEX P1 Docs P2 Docs Learn Events
Small servo controller dip — Parallax Forums

Small servo controller dip

Special_KSpecial_K Posts: 162
edited 2007-02-10 22:36 in BASIC Stamp
I need a very small servo controller to interface with the Basic stamp II. I
was going to use a picaxe 08M but it can only control 1 servo continually.

I have looked at the www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=323977
but I have not found any pBasic code for it. Does anyone have code for this product (EDEFT639)?
Has anyone used this before? And is there any servo controller even smaller.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-28 01:43
    Have you looked at the PWMPAL? <http://www.parallax.com/detail.asp?product_id=28020&gt;

    It mounts under a 24-pin DIP Stamp and could control up to 4 servos although the corresponding Stamp pins would not be usable (they're required to be inputs so they don't interfere).
  • ZootZoot Posts: 2,227
    edited 2006-10-28 03:23
    What's wrong with the chip you mentioned above? I downloaded the datasheet -- looks like a cool chip, actually. Seems that operation is pretty straightforward -- SEROUT to the Rx pin of that chip to send a given servo channel to a given position.

    And it's one-wire serial so you don't need a clock line.


    Positional Commands:
    To send a positional command to the individual
    servos, two bytes must be sent. The first byte
    sent contains the lower nibble of the position
    byte and the second byte sent contains the upper
    nibble of the position byte. The lower byte
    command must be sent before the upper byte
    command. The formats for the bytes are:
    Lower Byte = 0sssxxxx
    Upper Byte = 1sssyyyy
    sss = Servo number:
    000 = servo 1
    001 = servo 2
    010 = servo 3
    011 = servo 4
    100 = servo 5
    xxxx = the lower nibble of the position
    byte
    yyyy = the upper nibble of the position
    byte

    So if you wanted to send servo channel 2 to some position, you would:



    
    
    SEROUT Tx, Baud, [noparse][[/noparse]$1F\$9F]
    
    'Which would send a position of 255 ($FF) to channel 2.
    'Not sure why this chip requires the MSB of the upper byte to be 1 and the MSB of the lower byte to be 0, but there you go.
    'You could use some tricks to keep your head straight on the formatting:
    
    ServoPos   VAR   Byte    '0-255
    ServoChan  VAR   Nib     'servo channel 0-4 only
    ServoSnd   VAR   Word   'what gets sent
    
    
    ServoSnd.HIGHBYTE = ServoChan << 4 + $80 | ServoPos.HIGHNIB
    ServoSnd.LOWEBYTE = ServoChan << 4 + $00 | ServoPos.LOWNIB
    SEROUT Tx, Baud, [noparse][[/noparse]ServoSnd.LOWBYTE\ServoSnd.HIGHBTE]
    
    
    
    



    Though the baud rate for this chip is a bit low....
    I would buy two or three of these if you use them -- seems like an obscure chip? And it might not be available in 5 years if you need a replacement.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • Special_KSpecial_K Posts: 162
    edited 2006-10-29 01:47
    I was not sure that anything as wrong with the chip I just looked on the Forums and did not see anyone having used it. So I thought there might be a better choice.
    Thanks a lot for posting the code that was really my big concern. I will test it when the chips get here.
  • ZootZoot Posts: 2,227
    edited 2006-10-29 02:07
    Well, the fact that it's not hard to use doesn't mean there isn't a better choice smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • Special_KSpecial_K Posts: 162
    edited 2006-11-03 04:36
    got the chip today. Verrry tired but want to make it work before I go to bed.
    tried this code it will not compile
    what should be TX be set to. should it be the serve number?
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    'SEROUT Tx, Baud, [noparse][[/noparse]$1F\$9F]
    
    'Which would send a position of 255 ($FF) to channel 2.
    'Not sure why this chip requires the MSB of the upper byte to be 1 and the MSB of the lower byte to be 0, but there you go.
    'You could use some tricks to keep your head straight on the formatting:
    baud CON 2400
    ServoPos   VAR   Byte    '0-255
    ServoChan  VAR   Nib     'servo channel 0-4 only
    ServoSnd   VAR   Word   'what gets sent
     tx VAR Byte
    tx= 2
    ServoSnd.HIGHBYTE = ServoChan << 4 + $80 | ServoPos.HIGHNIB
    ServoSnd.LOWEBYTE = ServoChan << 4 + $00 | ServoPos.LOWNIB
    SEROUT Tx, Baud, [noparse][[/noparse]ServoSnd.LOWBYTE\ServoSnd.HIGHBTE]
    
  • Special_KSpecial_K Posts: 162
    edited 2006-11-03 05:12
    found this going to take a apart to see how exactply how the code for servo control is used


    Pbasic program:
    
    'Program: PhotoBot'This is the control program for the robot "PhotoBot". It uses the 
    
    'FT639 chip. Basic values are set with constants.
    
    'The program assumes the servos can be adjusted to stop with the position
    
    'command of 128 (i.e. the pot can be accessed)
    
    'These constants are used by the FT639
    
    pin    con    0
    
    baud    con    16780
    
    header con    108
    
    pulse    con    85
    
    pause 5000    'wait 5 seconds
    
    gosub setup    'these steps initialize the FT639
    
    gosub setpulse    '
    
    gosub setheader    '
    
    gosub setactive    '
    
    'This is the main portion of the program.
    
    gosub trimservos    'allows centering of servos - both big yellow LED's ON
    
    gosub ledtest    'turns on all the LED's (just for fun)
    
    gosub seeklight    'initiates slow turn - phototropic behavior
    
    end
    
    '***SUBROUTINES***
    
    halt: serout pin,baud,[noparse][[/noparse]0,136,16,152] 'stop the bot
    
    return
    
    seeklight:    high 14    'illuminates the red LED
    
    low 15    'extinguishes the yellow LED
    
    serout pin,baud,[noparse][[/noparse]12,135] 'starts L (no. 1) servo fwd slowly
    
    serout pin,baud,[noparse][[/noparse]24,152] 'starts R (no. 2) servo fwd quickly
    
    Look:
    
    if in7 = 0 then foundlight 'pin7 changes state when light is seen
    
    pause 100 
    
    goto Look    'keep looking for light
    
    foundlight:    low 14    'extinguishes the red LED
    
    high 15    'illuminates the yellow LED    
    
    serout pin,baud,[noparse][[/noparse]0,128]    'L (no. 1) servo fwd full
    
    serout pin,baud,[noparse][[/noparse]31,159] 'R (no. 2) servo fwd full
    
    runtolight:
    
    if in7 = 1 then seeklight    'pin7 changes back to 1 when light is lost
    
    pause 100
    
    goto runtolight    'keep running until pin7 changes
    
    return
    
    trimservos:    gosub halt
    
    high 11    'illuminates both large yellow LEDs
    
    high 12
    
    pause 15000    'now turn pots to stop servo movement
    
    low 11    'extinguishes both LEDs
    
    low 12
    
    return
    
    ledtest:    high 11    'the high command turns on all the LED's
    
    high 12
    
    high 13
    
    high 14
    
    high 15
    
    pause 1000
    
    low 11    'and the low command extinguishes them
    
    low 12
    
    low 13
    
    low 14
    
    low 15
    
    return
    
    'Subroutines used to set up the FT639
    
    setactive:    serout pin,baud,[noparse][[/noparse]117]    'sets active mode
    
    return
    
    setup:    serout pin,baud,[noparse][[/noparse]122]    'sets setup mode
    
    return
    
    setpulse:    serout pin,baud,[noparse][[/noparse]pulse]    'sets pulse length
    
    return
    
    setheader:    serout pin,baud,[noparse][[/noparse]header] 'sets header length
    
    return
    
  • ZootZoot Posts: 2,227
    edited 2006-11-03 08:12
    In my code example Tx is the PIN of your Stamp hooked up to the serial I/O pin of the servo chip.

    In your code example, I don't think "pin" can be used as a constant, but not sure. Regardless, the baud needs to be set to match your desired baud rate for the given Stamp. See the manual. I think I remember that your servo chip has either 2400 or 9600 baud?

    Also double check your bytes that you're sending on your serouts -- those are decimal so it's harder to tell, but I'm not sure they are quite right. What pins of the servo chip do you have the servos hooked up to (channels)?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • Special_KSpecial_K Posts: 162
    edited 2007-02-02 22:25
    need some more help with this. the EDEFT639 8 pin dip I was using will not control a standard mini servo (from HiTec). The problem is that the servo controller only gives you 4 preset positions. None of these positions will make the servo swing to it full leftward position. Can any one help??
    Should I just got for a different solution?
    turleft:
      SEROUT svcom,baud,[noparse][[/noparse]32,160] 'right
    RETURN
    turhllft:
      SEROUT svcom,baud,[noparse][[/noparse]33,163] 'L
    RETURN
    turcntt:
      SEROUT svcom,baud,[noparse][[/noparse]41,171] 'L
    RETURN
    turright:
      SEROUT svcom,baud,[noparse][[/noparse]47,179] 'L
    RETURN
    


    I think I may go back to trying to use the picaxe as a servo control. has anyone done this before?
    I am really looking for a small DIP PIC or IC that will just keep sending the servo information. I would really hate to junk the custom board I made for this project.
  • Steve JoblinSteve Joblin Posts: 784
    edited 2007-02-03 00:20
    The PICAXE-18A enables servo control using the servo command on all 8 outputs... seems pretty straight forward...
  • ZootZoot Posts: 2,227
    edited 2007-02-03 03:13
    Special K -- are you sure you are commanding this chip correctly? I looked over the documentation again and it seems pretty clear that you can send a servo to any position (albeit 8-bit -- 256 positions or approx .7 degrees).

    The default for the chip is 90 degrees of servo travel. You have to send the correct config bytes to turn on 0-180 (1ms-2ms) pulse widths.

    That would at least explain failure to turn as far as you want in either direction. What leads you to believe you can only use 4 preset positions? Or am I misunderstanding your post?
    Somebody said...
    1. Header length--this will allow
    adjustment of the starting position of
    the servo. The default setting is 12.
    2. Servo pulse length--this allows
    positioning control of the servo between
    0 to 90 degrees with the shorter pulse
    length or positioning control of the
    servo between 0 to 180 degrees with the
    longer pulse length. The default setting
    is short pulse length.
    3. Initial setup of the servo positions--the
    FT639 will not send positioning pulses
    to the servo in Setup mode. However,
    positioning commands can be sent to
    the FT639 while in setup mode to allow
    the servos to energize in a known
    position. The default setting is position
    0.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • Steve JoblinSteve Joblin Posts: 784
    edited 2007-02-03 14:57
    I thought this sounded familiar... I purchased one of these from Ferretronics about 5 years ago... never was able to get it to work... they were not able to help me... they have been out of business for quite some time...

    You might be best served using the PICAXE... and the 18A is $4 cheaper!
  • Special_KSpecial_K Posts: 162
    edited 2007-02-10 05:47
    got this code from steve joblin.
    it should move a servo through all the possible positions.. NO GO!!!!
    man this thing is nuts.
    the new code will send the servo to it's far right position and about 45% to the left (from center) but not fully there.

    Post Edited (Special_K) : 2/10/2007 5:54:25 AM GMT
  • Special_KSpecial_K Posts: 162
    edited 2007-02-10 08:58
    If I got the above code from Steve Joblin and he was not able to make it work.. I think I am stuck again
    Does anyone have the program that I would run on a picaxe to turn it into a small dip servo controller. ohh and also the communication code for the BS2.
    If not anyone know a good book on picaxe programming.
    There really should be a simple one IC that can control 1-8 servos for those of us working on small bots or just want to off load the servo refreshes (is that a word?) so the BS 2 can do more important work.
  • LarryLarry Posts: 212
    edited 2007-02-10 09:32
    I wouln't try to use a picaxe purely as a servo controller.

    If you read the documentation on the Picaxe SERVO command, you will see that it is temporarily disabled during SERIN, SEROUT, and DEBUG commands in your code, defeating your whole intent of using it as a slave processor. In addition, the SERVO command isn't very happy if you try to change the setting any faster than every 40 mSec or so...The standard PULsOUT method is better for quick changes.

    a better choice, if you are going to use a Picaxe to take the load off your stamp would be to use an 08M for each servo and use the PULSIN command on the 08M

    The stamp would use PULSOUT, but only once for each change of direction or speed.
    The Picaxe would command the servo to hold a position (or speed) With the SERVO command operating in background while waiting for a new pulse with the PULSIN command in a loop.

    Of course, the easier way is to spring for the PSC, which has a lot more flexibility for several servos.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-02-10 13:19
    Special_K -

    Are either of these what you're looking for in an R/C servo controller:

    http://www.awce.com/ppak8.htm

    http://www.awce.com/pak8.htm

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Steve JoblinSteve Joblin Posts: 784
    edited 2007-02-10 17:57
    It is a bit bigger than you want, but the Pololu Servo Controller works very well... easy to use and excellent customer service along with a reasonable price puts this as my top recommendation! Check out http://www.pololu.com/products/pololu/0207/
  • Special_KSpecial_K Posts: 162
    edited 2007-02-10 21:20
    Bruce have you used this chip before? I kind of want to use chips others have used successfully. I bought 5 of the EDEFT639.. That's like 60 bucks blown (well not a total loss it does a fine job of controlling the continuous rotational servos).
    Steve Joblin I looked at the pololu site I have that unit on another bot i am working on..tried it out on this project but it does not fit. I checked online looks like people are using a PIC16F628A for servo control. Pololu sell one with serial 8-servo controller firmware for $17.00 any one used this?
    www.pololu.com/products/pololu/0276/

    I think I am a little stuck since I have soldered most of my custom-built board. I can expand the space that the EDEFT639 was going to use but I am kind of stuck with the pic/ dip format.. Unless I want to redo all the soldering. shakehead.gif
  • LarryLarry Posts: 212
    edited 2007-02-10 21:50
    Just so you don't get bored , here's another choice for you.

    www.kronosrobotics.com/downloads/EZServo1DS.pdf

    You will note I gave you the datasheet.

    READ it before you order. Make sure you understand what it does and you know how to hook it up and use it before you buy.
    There's a BS2 example in the datasheet. If you don't understand how it works --Don't buy it!

    You should do that with any controller you choose. That way you won't waste your money.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-02-10 22:36
    Special_K -

    I have used many of the Al Williams chip sets in the past and been very happy with them. However, that's not to say I've used them in the same way that you intend to use them. I also didn't go back through the existing messages here to see why these existing servo controller chips were failing to meet your needs.

    If these are new chips, I can see no reason why you can't return them, and just say that they don't meet your needs or expectations. If you didn't purchase them from E-Lab then check with them both for assistance and return privledges if that becomes necessary. Any of these chips should work in ordinary R/C servo duty.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
Sign In or Register to comment.