585,996 active members*
4,504 visitors online*
Register for free
Login

Thread: dsPic-Servo

Page 3 of 9 12345
Results 41 to 60 of 172
  1. #41
    Join Date
    Aug 2008
    Posts
    573
    Has anyone tried connecting the encoder signals using opto isolators?

    I think a differential connection between encoder and servo would be better for most installations. Either using current loop with opto couplers, or differential drivers and receivers (like RS488).


    What do you think?

  2. #42
    Join Date
    Jun 2008
    Posts
    66
    In the following its designs I want to try to use optoisolators (HCPL-2631) and raise the voltage a chain signal А and B encoder before 12В. Itself encoder supply through 78L05.

    Also want to installation isolators ADuM1200 between MC (AtMega88) and Driver (IR2184) + separate winding transformers for power drivers. http://www.cnczone.com/forums/showthread.php?t=69640

  3. #43
    Join Date
    May 2007
    Posts
    106
    Quote Originally Posted by BillTodd View Post
    Has anyone tried connecting the encoder signals using opto isolators?

    I think a differential connection between encoder and servo would be better for most installations. Either using current loop with opto couplers, or differential drivers and receivers (like RS488).


    What do you think?
    you may like Analog's adum5202
    Integrated isolated DC/DC (500mW is far enough for an encoder), 2 digital signals isolated, 25MBps
    With 3 components (ADUM5202 + 2 caps) you've got your isolator
    Juste add a ADUM1100 if you want the INDEX signal.
    Those chips are a bit expensive, but in total it shouldn't be possible to make simething that reliable for this price.

    about differencial link, I don't really think it's necessary, as dsPICs have integrated noise filters on the chip. Also quadrature is quite tolerant to glitches, most of time the counter will go up and down back to the real value.
    But in any case, it's necessary to use a sheilded cable.

    About isolating the MCU to the MOSFET drivers, personally I do ne think it's a good option : you need those expensive high-speed optocouplers/iCouplers for precise transmission of the PWM signal, isolated DC-DC supply on the board, and you've got another problems with the current sense, wich should also be isolated

  4. #44
    Join Date
    Jun 2008
    Posts
    66
    ADuM management on voltage at the input, opto isolators - on current and they will be in given using more to noisestability (on Step/Dir and Encoder).
    I repeat If You use the engines with low voltage of the feeding, that requirement to noisestability much below. When use, on 110V, for instance, You recall about this. Beside me http://www.cnczone.com/forums/showthread.php?t=69640, for instance, when feeding from 20v no problems was not, but when has connected to 110V, appeared much problems because of noise from PWM. And it is necessary seriously to pertain to signal from encoder.

  5. #45
    Join Date
    Mar 2005
    Posts
    523
    hello
    Attached is a couple of jpg's with my proposed Mr. Lawrence Glaister's
    servo controller, modified for pwm mosfet outputs.
    I am unable to compile MR. Max-Mod's revised software.
    I get a zillion errors with the mplab's c30 compiler.
    I am not real good at the this 'C' language so it will take some time to
    figure out where my problems are.
    I have used the USB and current monitor chips in other circuits, BUT
    I have not tested the H_Bridge circuit with these driver chips yet.
    After i have the curcuit breadboarded and completely tested
    I will get some pcb's made. (early next year)
    Merry Christmas and Happy New Year to ALL !
    Attached Thumbnails Attached Thumbnails DSP_SRV_SCH.jpg   DSP_SRV_PCB.jpg  

  6. #46
    Join Date
    May 2007
    Posts
    106
    Hi there,

    I recently reinstalled Windows, MPLAB and C30 so I've got the same compiling problems. Maybe a problem with absolute path, I don't know yet. I'm working on it.

    PS: Your PCB is far better that way!
    Merry (late) Christmas & happy ny

  7. #47
    Join Date
    Sep 2007
    Posts
    22
    hello,

    very nice work everyone.

    if i can get the gerber files, i will import the pcb into altium and provide that version also.

    merry christmas and happy holidays.

    roger

  8. #48
    Join Date
    May 2007
    Posts
    106
    Okay so the problem for the compiling of my modified version of the code was in the project window:
    file p30f4012.h => replace with "C:\Program Files\Microchip\MPLAB C30\support\dsPIC30F\h\p30f4012.h"
    file p30f4012.gld => replace with "C:\Program Files\Microchip\MPLAB C30\support\dsPIC30F\gld\p30f4012.gld"
    you should also have a a problem with the content of "serial.c":

    replace the function "setup_uart" by:
    Code:
    void setup_uart( void )
    {
    	unsigned int uartmode;
    
    	uartmode = UART_EN & UART_IDLE_CON & UART_DIS_WAKE &
                   UART_DIS_LOOPBACK & UART_DIS_ABAUD &
                   UART_NO_PAR_8BIT & UART_1STOPBIT;	// use alternate i/o pins
    
        U1BRG  = (((FCY/THE_BAUD_RATE) /16) - 1);     /* baud rate */
        U1MODE = uartmode;  /* operation settings */
        U1STA = UART_TX_ENABLE & UART_TX_PIN_NORMAL;   /* TX & RX interrupt modes */
    	U1STAbits.URXISEL = 0;						/* rx intr every ch */
    	U1MODEbits.ALTIO = 1;	// Use alternate pins for UART 1 (COM port)
    
    	rxbuffptr = &rxbuff[0];
    	rxbuff[0] = 0;
    	rxrdy = 0;
    
    
    	IFS0bits.U1RXIF = 0;
    	IEC0bits.U1RXIE = 1;		// go live with serial rx intr
    }
    note you can use
    Code:
    U1MODEbits.ALTIO = 0;
    if you use primary UART's pins U1RX and U1TX.

    @tecfacet
    I'll post the gerber and preview of my 1-sided board (easy to make @ home )

  9. #49
    Join Date
    Sep 2007
    Posts
    22
    thank you max-mod.

    could you pm me with the corrected code so i may load it and check the compile on my system.

    i am currently working on a dspic project and would be interested to see if i can compile yours.

    what is the final size of the servo board?

    thank you,

    roger
    a.k.a. tecfacet

  10. #50
    Join Date
    May 2007
    Posts
    106
    here's attached the latest code.
    You'd prefer to use the latest MPLAB & C30 versions to be sure it compiles fine.

    Regards,
    Max
    Attached Files Attached Files

  11. #51
    Join Date
    Dec 2006
    Posts
    2
    Hi Max-Mod,

    sorry there are still many warnings

    Greeting Ronny



    Code:
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "encoder.c" -o"tmpencoder.o" -Wall -Os
    encoder.c: In function '_QEIInterrupt':
    encoder.c:36: warning:  PSV model not specified for '_QEIInterrupt';
       assuming 'auto_psv' this may affect latency
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "main.c" -o"tmpmain.o" -Wall -Os
    main.c: In function 'main':
    main.c:235: warning: dereferencing type-punned pointer will break strict-aliasing rules
    main.c: In function '_StackError':
    main.c:83: warning:  PSV model not specified for '_StackError';
       assuming 'auto_psv' this may affect latency
    main.c: In function '_AddressError':
    main.c:96: warning:  PSV model not specified for '_AddressError';
       assuming 'auto_psv' this may affect latency
    main.c: In function '_MathError':
    main.c:109: warning:  PSV model not specified for '_MathError';
       assuming 'auto_psv' this may affect latency
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "serial.c" -o"tmpserial.o" -Wall -Os
    serial.c: In function '_U1RXInterrupt':
    serial.c:49: warning:  PSV model not specified for '_U1RXInterrupt';
       assuming 'auto_psv' this may affect latency
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "timer1.c" -o"tmptimer1.o" -Wall -Os
    timer1.c: In function '_T1Interrupt':
    timer1.c:36: warning:  PSV model not specified for '_T1Interrupt';
       assuming 'auto_psv' this may affect latency
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "pwm.c" -o"tmppwm.o" -Wall -Os
    pwm.c: In function '_PWMInterrupt':
    pwm.c:39: warning:  PSV model not specified for '_PWMInterrupt';
       assuming 'auto_psv' this may affect latency
    pwm.c: In function '_FLTAInterrupt':
    pwm.c:44: warning:  PSV model not specified for '_FLTAInterrupt';
       assuming 'auto_psv' this may affect latency
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -c "DataEEPROM.s" -o"tmpDataEEPROM.o" -Wa
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "save-res.c" -o"tmpsave-res.o" -Wall -Os
    save-res.c: In function 'save_setup':
    save-res.c:64: warning: dereferencing type-punned pointer will break strict-aliasing rules
    save-res.c:71: warning: dereferencing type-punned pointer will break strict-aliasing rules
    save-res.c: In function 'restore_setup':
    save-res.c:105: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "pid.c" -o"tmppid.o" -Wall -Os
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "capture.c" -o"tmpcapture.o" -Wall -Os
    capture.c: In function '_IC1Interrupt':
    capture.c:49: warning:  PSV model not specified for '_IC1Interrupt';
       assuming 'auto_psv' this may affect latency
    capture.c: In function '_IC2Interrupt':
    capture.c:76: warning:  PSV model not specified for '_IC2Interrupt';
       assuming 'auto_psv' this may affect latency
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "test.c" -o"tmptest.o" -Wall -Os
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "commands.c" -o"tmpcommands.o" -Wall -Os
    commands.c: In function 'print_tuning':
    commands.c:48: warning: unknown conversion type character 0xd in format
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 -x c -c   "adc10.c" -o"tmpadc10.o" -Wall -Os
    Executing: "D:ProgrammeMicrochipMPLAB C30binpic30-gcc.exe" -mcpu=30F4012 "..tmpencoder.o" "..tmpmain.o" "..tmpserial.o" "..tmptimer1.o" "..tmppwm.o" "..tmpDataEEPROM.o" "..tmpsave-res.o" "..tmppid.o" "..tmpcapture.o" "..tmptest.o" "..tmpcommands.o" "..tmpadc10.o" -o"dspic-servo.cof" -Wl,-L"C:Program FilesMicrochipMPLAB C30lib",--script="D:ProgrammeMicrochipMPLAB C30supportgldp30f4012.gld",--defsym=__MPLAB_BUILD=1,--heap=175,--stack=200,--no-check-sections,--report-mem,-s

  12. #52
    Join Date
    May 2007
    Posts
    106
    Hi,

    The warnings about PSV models concerns Program Space Visibility.
    When no PSV model option is given to an ISR, it uses __auto_PSV__ so that PSV can be used in the interrupt.
    It is said in the manual that disabling PSV would reduce overhead (therefor latency) of ISR. In fact, I found that the difference is very small (<1µs), so I simply don't bother it and let the compiler add __auto_PSV__ to the ISR's options and warn me about that. This way, I am sure ISR will work. I used to mess with PSV and I remember debugging a program for hours before looking for PSV problems...
    If wou want these warning to be removed, add __auto_psv__ the ISRs' attributes:
    before
    Code:
    void __attribute__((__interrupt__)) _QEIInterrupt(void)
    after
    Code:
    void __attribute__((__interrupt__, __auto_psv__)) _QEIInterrupt(void)
    but it will do exactly the same.

    Code:
    save-res.c: In function 'save_setup':
    save-res.c:64: warning: dereferencing type-punned pointer will break strict-aliasing rules
    save-res.c:71: warning: dereferencing type-punned pointer will break strict-aliasing rules
    save-res.c: In function 'restore_setup':
    save-res.c:105: warning: dereferencing type-punned pointer will break strict-aliasing rules
    The calculation of the checksum addresses the pid struct as if it was an int array.I don't think there is any other way of doing CRC... The only thing you have to check is that pid struct's size is a multiple of int's size.
    To tell the truth, I didn't changed LG's code in this file... I'm assuming it's working (as it actually is working "IRL" )

    Code:
    commands.c:48: warning: unknown conversion type character 0xd in format
    About the last warning, it's strange... normally printf("%%"); outputs the percent (%) char, but my mistake printf("\%"); did the same

    change (line 48 in command.c)
    Code:
    printf("(m)ax Output = %.2f%rn",(double)pid.maxoutput);
    for
    Code:
    printf("(m)ax Output = %.2f%%rn",(double)pid.maxoutput);
    Regards,
    Max

  13. #53
    Join Date
    Dec 2006
    Posts
    2
    Hi Max,

    thanks, it work.
    0 Warnings and 0 Errors.

    Regards,
    Ronny

  14. #54
    Join Date
    Sep 2007
    Posts
    22

    dspic working??

    hello,

    i have been travelling and not had time to work much on the dspic servo controller.

    has anyone assembled a controller and tried running it?

    i would be very interested in purchasing a pcb and hearing about your success.

    thanks,

    roger

  15. #55
    Join Date
    Feb 2007
    Posts
    4553

    Talking Are you still working on a driverless model?

    MaX-MoD,

    Are you still working on a driverless model?

    Please keep us posted.

    Very good work!

    Jeff...

  16. #56
    Join Date
    Aug 2008
    Posts
    573
    Are you still working on a driverless model?
    Odd co-incidence I've just been looking at i, his V10 (see the French site).
    Bill

  17. #57
    Join Date
    Feb 2007
    Posts
    4553

    Unhappy

    Bill,

    I cant read French!

    Jeff...

  18. #58
    Join Date
    May 2007
    Posts
    106
    Hello Roger, Jeff and Bill

    I am currently wayting for parts to arrive to finish the driverless (10V) version.
    I should be able to grab a servo and an amp to test the 10V version in the next month. Unfortunately I don't have a machine (yet) to test IRL...
    First proto is DL PCB with most components in SMT (cause I love them and also cause I have a bunch of them ). I will do a full discrete version as multiple ppl are interested by the board on usinages.com
    The KICAD project is GPL, if you need mods to meet your needs, you can do it. But I'll be interested by knowing what is lacking in the current board

    I really want to get this English manual online but I cruelly lack of time, as i am also working on a 3 phase controller and YTT

    Speaking of that, YAPSC Tuning Tool should be finished in the next few days.

    the tool is Win/*nix (mac?) compatible, and makes it possible to monitor the servo's error and motor's current or to trace a response curve to ease the tuning of PID params.
    But to tell the truth, even if current limiting works quite good, shunt resistor current measure is quite inaccurate for output. So current monitor will rather be usefull to know when the controller is near max current
    Here's a little demo screen-shot:

    I think I'll publish the project somewhere like on SourceForge -but I don't really like the commercial license of SF- or elsewhere. Anyway I'll post it here soon.
    I'll also have to modify the dsPIC's code to actually send something to YTT

    One last word, I designed an optoisolated USB prog key, but I'm still waiting my FTDI chip to arrive. Yes, my new comp has no external RS232 port

    PS: I posted a pic here

  19. #59
    Join Date
    Aug 2008
    Posts
    573
    That looks superb Max-Mod
    Bill

  20. #60
    Join Date
    Mar 2005
    Posts
    523

    another pic

    Hello all
    I am also working on a 1 phase / 3 phase pic based controller and hope to have it tested and ready by the end of feb.
    With extra software this can also be used as a dc to ac converter.
    I will keep you all posted.
    Attached is a pcb pic and some pdf pages.
    Sorry the 6 page pdf file is to large to attach here.
    Reguards Garry
    Attached Thumbnails Attached Thumbnails DSP_SRV_3P_PCB.tif.jpg  

Page 3 of 9 12345

Similar Threads

  1. Replies: 0
    Last Post: 02-07-2014, 01:29 AM
  2. help me with dspic 30f4012 project
    By caligroup in forum Community Club House
    Replies: 1
    Last Post: 08-16-2010, 03:59 PM
  3. first steps with dsPIC + IRAMS AC servodrive
    By andy55 in forum Servo Motors / Drives
    Replies: 7
    Last Post: 07-10-2007, 07:55 AM

Tags for this Thread

Posting Permissions

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