PMDC SERVO MOTOR WITH quadrature encoder DRIVE ?


Closed Thread
Results 1 to 38 of 38

Hybrid View

  1. #1
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105

    Default PMDC SERVO MOTOR WITH quadrature encoder DRIVE ?

    Did any idea how to command PMDC SERVO MOTOR with quadrature encoder and after end of way stop in moment with no more movement ?
    I need idea or sample of pulse diagram fro drive and stop conditions.
    I dont need pbp source that part I will write...
    Simple if I drive motor with PWM how to stop motor in moment and break it
    electrical with no more movement to next move command ?
    Maybe simultan change left right direction as break ???
    I will use H bridge.
    Regards and sorry for bad english.
    Robert

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Here are some threads talking about how to work with the encoder.
    http://www.picbasic.co.uk/forum/show...rotary+encoder
    http://www.picbasic.co.uk/forum/showthread.php?t=1552
    http://www.picbasic.co.uk/forum/showthread.php?t=9700

    As far as stopping goes...
    Does the motor have a built in brake for holding? It can be stopped by shorting the leads but how fast it stops that way depens on the speed it is running when the leads are shorted.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105


    Did you find this post helpful? Yes | No

    Unhappy

    I was probe to stop motor and all work good.
    But now I have another problem:
    All examples from forum for read quadrature encoder with A and B outputs
    at 5V are confused for my head, I was probe PBP examples but is to slow
    and I think that for read quadrature encoder is needed ASM or some INT rutine becouse when motor work on ~ 3000 rpm rutine must be ultra speed
    and background proces....
    My head is like baloon ...

  4. #4
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105


    Did you find this post helpful? Yes | No

    Default

    All other info about my probe is now in PicBasicPro FORUM in:
    Probe to read quadrature encoder with DT_INT need help
    After my success I will post all here on FORUM.
    If any help and good idea pls write.
    Many thanks to all good peoples here!
    Best regards Robert

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    I recommend you take a look at the 18F2431 series PIC. It has a motion feedback module built in that can be set up to keep track of an incremental encoder. It also has a lot of other goodies specifically targeted at motor control applications.

    /Henrik.

  6. #6
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson View Post
    I recommend you take a look at the 18F2431 series PIC. It has a motion feedback module built in that can be set up to keep track of an incremental encoder. It also has a lot of other goodies specifically targeted at motor control applications.

    /Henrik.
    I was buy today 18F4431 and will move to it.
    At moment I looking for examples for it.
    Thanks and regards Robert

  7. #7
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105


    Did you find this post helpful? Yes | No

    Thumbs up hard way to finish of idea of own uhu wuth friends from these forum

    Here is success probe with count encoder from 0 to 2000 for one turn of shaft of motor.
    Code:
    ' Pic 18F4431 @ 20MHz true XTAL
        define osc 20
        DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
        DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
        DEFINE HSER_SPBRG 64  ' 19200 Baud @ 20MHz, 0.16%
        DEFINE HSER_CLROERR 1 ' Clear overflow automatically
        ADCON0=0 'Turn of ADC
        ANSEL0=0 'Make Port A inputs Digital
    
        PortA = 0
        PortB = 0
        PortC = 0
    
        TRISA = %011100                'QEI pins as inputs.
        TRISB = %00000000
        TRISC = %10000000              'USART RX pin as input.
    
        QEICON=%11001100
        DFLTCON = %00111000            ' enable error filter for all capture inputs
        MAXCNTL = %11001111           'lowbyte = 207
        MAXCNTH = %00000111           'highbyte = 7 but after math: highbyte * 256 = 1792 + 207 = 1999
    'QEICON = %00010100                   'Setup QEI, 4X mode, reset on index. 
        PosLow VAR BYTE                          'Storage for the low byte of encoder count
        PosHigh VAR BYTE                         'Storage for the high byte of encoder count
        PosTemp VAR BYTE                        'Temporary storage for low byte of encder count
        Position VAR WORD                      'Actual encoder position, 16bit word.
        POSCNTL = 0                            ' clear lowbyte of counter for start
        POSCNTH = 0                            ' clear highbyte of counter for start
    CLEAR
        
    Main:
        Gosub GetPosition
        HSEROUT [dec position]
        Pause 100
    Goto Main
    
    GetPosition:
    'Since the position counter isn't double buffered we can get to situations
    'where the lowbyte overflows between readings of the high and the low byte. This
    'is prevented by reading the low byte two times and compare the two readings.
    'If they are the same then we're fine, if not re-read the registers.
      
        PosHigh = POSCNTH                       'Get high byte of counter
        PosLow = POSCNTL                        'Get low byte of counter
        PosTemp = POSCNTL                       'Get low byte again
        
        If PosLow - PosTemp = 0 then Goto Done      'Compare, if equal we're done.
        
        PosHigh = POSCNTH                           'If not, get values again.
        PosLow = POSCNTL 
    
    Done:
        Position = POSHIGH * 256 + PosLow           'Put high and lowbyte together.
    RETURN
    END
    Will continue...
    Robert

  8. #8
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105


    Did you find this post helpful? Yes | No

    Thumbs up Little more probe from me...

    Now little about PMDC breaking.
    1.H-bridge drive of PMDC:
    Name:  H bridge move PMDC.jpg
Views: 3677
Size:  15.4 KB
    2.Slow DINAMIC break by short with same polarity of power supply.
    Bad idea for fast servo PID control.
    Name:  Slow dinamic break PMDC.jpg
Views: 3718
Size:  16.4 KB
    3.Fast RECUPERATIVE break good for PID control but must use high frequency of PWM.
    The best is ~ 15-20KHZ.
    Work for me good , but you need good DIODE in H-bridge for EMS breaking.
    Name:  Fast recuperative break PMDC.jpg
Views: 3364
Size:  15.7 KB
    Thank's and regard's Robert
    Last edited by phoenix_1; - 5th September 2009 at 22:53.

Similar Threads

  1. Quadrature encoder and ASM Interrupts. questions..
    By godfodder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th March 2013, 14:45
  2. Best quadrature encoder for buck?
    By jrprogrammer in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd June 2009, 13:58
  3. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  4. saving RCREG to word
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th September 2008, 13:51
  5. encoder wowes
    By wallaby in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 6th December 2005, 21:56

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

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