586,103 active members*
3,274 visitors online*
Register for free
Login

Thread: dsPic-Servo

Page 8 of 9 6789
Results 141 to 160 of 172
  1. #141
    Join Date
    Apr 2006
    Posts
    56
    Hi Max,

    Can I use USB 2.0 TO RS232 adapter instead ProgKey to write dSPic?
    I have it and I want to know if I can to use it.

    Tanks,
    Moraru.

  2. #142
    Join Date
    May 2007
    Posts
    106
    Yes you can. the ProgKey is a USB to RS232 adapter with isolation and TTL levels.
    So you will need a MAX232 or similar chip, and additional optocouplers for maximum safety.

    Best regards
    Max

  3. #143
    Join Date
    Mar 2005
    Posts
    11

    yapsc_merged

    Hi Max,
    I have a couple of questions about the code in YAPSC_MERGED. They are probably pretty dumb but I like to understand how things work!

    In timer1.c line 89 cmd_posn is set to POSCNT+1. Why +1?

    Step and direction inputs use input capture ISRs (IC1 and IC2). I am thinking of using CN0 (pin 12) for direction change and T2CK (pin 11) to count on every edge for step input (need to change UART to pins 17 and 18). This would eliminate ISR overhead on step pulse. Counter would be used to update cmd_posn and be cleared on direction change and in servo loop interrupt.

    What do you think of this? I do not have a lot of experience coding dsPIC!

    What are the differences between DEMOBOARD and YAPSC V1

    It seems that pwm.c is set up for all n channel mosfet h-bridge and for high-side p channel mosfet I should change high-side output polarity to active low. Is this correct?

    Many thanks for your consideration.

  4. #144
    Join Date
    May 2007
    Posts
    106
    Hi Xcad,

    Honestly I don't remember why I put POSCNT+1. I know I had to do so to fix an offset problem but I have not kept a trace of this problem so I won't be able to explain it.
    maybe I'll have some time to look back at it this week end.

    The step and dir inputs would probably work with the timer input and the CN pin.
    Although I investigated this solution at the beginning I didn't kept it because
    1) the original code from Glaister was using quadrature input; it's still possible to revert the STEP/DIR change back to quadrature if required
    2)I found little use of it cause I could get a lossless 1MHz (!) STEP input
    3) I wanted to have the PGx lines and UART accessible at the same time, MUCH easier while debugging
    4)Timing. Checking the DIR line status in the STEP ISR gives easier STEP to DIR timing much more forgiving.

    Concerning "hybrid" P&N H-bridge, well "active" means "the associated transistor is blocked and current passes trough it"
    Depending on your driving circuit you may have to change the PWMxH output polarity, but not necessarily.

    Hope I've helped

    Best regards
    Max

    PS:
    Demoboard has some differences with the actual V1 PCB, including reversed STEP and DIR inputs. The #defines are here to handle this easily.
    for V1 PCB, use none of #define DEMOBOARD nor #define YAPSC10V.

  5. #145
    Join Date
    Mar 2005
    Posts
    11

    YAPSC_MERGED

    Hi Max,
    Thanks for the reply. I hadn't thought of the PGx and debugging issue - good point.

    I will have to change high-side polarity. For interest I have attached circuit diagram of my h-bridge; should be good for about 90v 10 amp. My test board shows nice clean output on the scope.

    Best regards

  6. #146
    Join Date
    May 2007
    Posts
    106
    errr

    tell me if I'm wrong but seems to me that when turning ON the P mosfets current will flow from +48V (90V?) into D5, R4 and U2 to the ground.
    So there will be 48-12 = 36V at the 100Ohms resistor leads. This resistor dissipates 12.96W...
    Why are you using P mosfet instead of N mosfets? The IR2110 is a bootstrapped driver so a simple scheme like this will do:
    Just keep the PWM output in the 0-99% range for the bootstrap cap to recharge and it's all right

  7. #147
    Join Date
    Jan 2009
    Posts
    334

    180V DC Supply

    Max

    Are you looking for a ready built unit or do you want to design from scratch?
    I found this on ebay.
    http://cgi.ebay.com/LOT-3-POWER-ONE-...item414adc4fc2

    Also, check this out, http://www.mpja.com/prodinfo.asp?number=18074+TR

    It is not isolated, but with a few components it would make a great HV DC power supply.

    Hope this helps.

    Iron-Man

  8. #148
    Join Date
    Mar 2005
    Posts
    11

    YAPSC_MERGED

    Sorry Max, attached the wrong file version. I "discovered" the TVS mistake with some magic smoke in the first prototype. Correct file attached. I am using the Ps because I had a supply of them and high-side only switches on direction change so switching losses and speed not big problem.
    Best regards
    Attached Files Attached Files

  9. #149
    Join Date
    Mar 2005
    Posts
    11

    YAPSC_MERGED PWM

    Hi Max, another question; this time about PWM setup. I cannot see where the mode is set in the PTMOD bits of PTCON. At reset they are set to 00 which is free running mode so I assume this is the mode the module remains in in the setup. Is this assumption correct?

    Looking at the code for function set_pwm (), I cannot work out how the upper opposite leg of the h-bridge get turned on. It appears that each pin pair is set to complimentary mode and depending on the state of temp_dir either is toggled according to the associated PDC setting or off (PDC set to zero). May be that the circuit has different connections but I cannot see from the code how, for example PWM_PIN2H and PWM_PIN3L are turned on together to drive a motor connected to the legs of an h-bridge. Can you explain what I have missed? May be I am not understanding what complimentary mode really means.
    Many thanks
    Best regards

  10. #150
    Join Date
    May 2007
    Posts
    106
    Thanks for the link iron-man!
    I'm designing the PSU myself. I plan on doing 120-200V adjustable PSU with overvoltage, overcurrent and overpower limit. 1KW or more.
    Thought it will take some time, I'll learn some more on High-Power electronics


    Hey xcad!
    The new schematics are much better!
    except for R7 and R8.
    If the 48V is fed but not the IRF power, R7 and R8 will put both Q3 and Q4 ON state. The problem is also that the VDS voltage will be equal to the threshold VGS. It can cause some serious problems in some cases.
    The best is to remove them.

    There is another thing you have to consider:
    The bootsrtrap cap dischanges itself. If the BS cap is discharged, the higher MOS are turned OFF.
    To avoid this, you have to switch the high side MOS to OFF from times to times to allow the BS cap to recharge.

    the proper PWM operation is the following:
    0% PWM = "lower MOS turned ON and higher MOS turned OFF"
    100% PWM = the opposite.

    You cannot go over 95-99% PWM otherwise the BS cap will discharge.

    So, to choose the output polarity, one bridge is at 0%PWM (ie 0Volts) and the other is 0-95% PWM (0-95% * 48V).
    To reverse the polarity, swap the two PWM values.

    This is what being done in PWM.C. First is to determine the output polarity required:
    If positive, feed PWM2 with 0 (0% PWM = 0V) and PWM3 with le PWM output wanted.
    If negative, same but reverse PWM2 and PWM3.

    Il PWM.C, line 108 is
    Code:
        PWMCON1 = (PWM_MOD1_COMP & PWM_MOD2_COMP & PWM_MOD3_COMP &	// complementary outputs
    these are helper #defines for the PWM configuration:
    PWM_MODx_COMP means "PWMx is set for complementary PWM"

    is it OK now?

    best regards,
    Max

  11. #151
    Join Date
    Mar 2005
    Posts
    11
    Hi Max, many thanks for your reply. I think I understand but I am a slow learner! It si probably because you are ~21 and I am ~65. We have much to learn fron you guys.

    "Hey xcad!
    The new schematics are much better!
    except for R7 and R8.
    If the 48V is fed but not the IRF power, R7 and R8 will put both Q3 and Q4 ON state. The problem is also that the VDS voltage will be equal to the threshold VGS. It can cause some serious problems in some cases.
    The best is to remove them."


    I will take the risk to achieve faster switching on high-side P-channel mosfets

    "There is another thing you have to consider:
    The bootsrtrap cap dischanges itself. If the BS cap is discharged, the higher MOS are turned OFF.
    To avoid this, you have to switch the high side MOS to OFF from times to times to allow the BS cap to recharge."

    No bootstrap caps this is P-channel high-side can turn on 100%

    "the proper PWM operation is the following:
    0% PWM = "lower MOS turned ON and higher MOS turned OFF"
    100% PWM = the opposite."

    Ah-ha is this because of complimentary; anything >0% = PWM on high-side and lock-out of low-side but reverse at 0%

    "You cannot go over 95-99% PWM otherwise the BS cap will discharge.

    So, to choose the output polarity, one bridge is at 0%PWM (ie 0Volts) and the other is 0-95% PWM (0-95% * 48V).
    To reverse the polarity, swap the two PWM values.

    This is what being done in PWM.C. First is to determine the output polarity required:
    If positive, feed PWM2 with 0 (0% PWM = 0V) and PWM3 with le PWM output wanted.
    If negative, same but reverse PWM2 and PWM3."


    Because of P-channel high-side, I want to PWM low-side and turn on or off as appropriate high-side. Can I just swap dsPIC output pins PWMxL and PWMxH? or do I have to play with SFR?


    Many thanks again Max. I have learned more from you that all Microchip documents.
    Best regards

  12. #152
    Join Date
    Jan 2009
    Posts
    334

    HV Power Supply Design

    Max

    I believe that I have found the best site for power supply design, with sim software.
    Check out these links, especially this one: http://www.poweresim.com/index.jsp

    and

    http://www.smps.us/

    I will also be starting my power supply design soon.


    Iron-Man

  13. #153
    Join Date
    May 2007
    Posts
    1

    FF0 and FF1

    Hi Max-Mod

    What good are ff0 and ff1. How to set ff0 and ff1 in the PID loop. Best regards. Zeljko

  14. #154
    Join Date
    Mar 2005
    Posts
    11
    Quote Originally Posted by zbosiljkic View Post
    Hi Max-Mod

    What good are ff0 and ff1. How to set ff0 and ff1 in the PID loop. Best regards. Zeljko
    ff0 and ff1 are feed forward compensators. If you look at the header explanation in pid.c you will see that this algorithm was adapted by Lawrence Glaister from the Enhanced Machine Controller project ( see http://www.linuxcnc.org) which in turn was initially developed by the good men a NIST. Somewhere in the documentation, I think at the URL quoted is an explanation of the pid and the feed forward compensators. There is also a mailing list that might be helpful referenced on the website.
    Hope this helps.

  15. #155
    Join Date
    Jan 2009
    Posts
    334

    Iron Man Servo Amps

    I should have posted sooner but lots of work, etc. Here are some pictures of my latest work. I changed out the SMD 35V caps because of problems, bad batch from Digi-Key and replaced them with 35V 4700uf. These are first generation boards, which will be corrected in version 2, spacer between OPA 549 and heat sink, board dimensions, etc. The heat sinks will be powder coated, mirror black. Servo reducers will be powder coated candy red. I purchased my powder coat kit system from Columbia Coatings. As a side project I am still working on the F28335 DSP for AC/BLDC servo motor control. For now, I just want to finish conversion of the Sherline Mill and start making chips. Some of the pictures might seem a bit rough with the indicator, but the only iron part of the Sherline is the column which makes it difficult to place the indicator base.
    Let me know if I need to start a new thread.

    Hope you enjoy the pictures.

    Iron-Man
    Attached Thumbnails Attached Thumbnails Iron Man Servo Amp 1a.jpg   Iron Man Servo Amps 3.jpg   Iron Man Servo Amps 3a.jpg   Sherline cutting heat sink.jpg  

    Sherline cutting reducer.jpg   Clifton Reducer 1.JPG  

  16. #156
    Join Date
    Aug 2008
    Posts
    1
    hi, me need help.....
    I have realized a card for YASPC v1 but I have some problem.
    When I give power the motor it is free in a sense and jammed in the other sense, I don't understand how come, help

    hi
    Attached Files Attached Files

  17. #157
    Join Date
    Jan 2009
    Posts
    334

    YAPSC 10V

    Check out Max-Mods work at http://www.cnczone.com/forums/showthread.php?t=74532

    Please provide more information, pictures of your set-up etc. Post to the link above. Max will be able to provide better information on the YAPSC.

    Iron-Man

  18. #158
    Join Date
    May 2007
    Posts
    106
    Hi,

    generally the motor behaves this way if you have fried MOS or gate driver.
    Possible too is that you have a bootstrap capacitor too small.

    Also I've seen something a bit annoying on one board, very high parasitic sensitivity (indeed, conduced parasites from the H-bridge). I think it depends on the optocouplers brand. In fact you can see on YTT that even thought the STEP input is disconnected, the command from PC keeps on augmenting as the motor turns.

    You can try adding a MKP/ceramic 0.1uF capacitor soldered directly between pins 5 and 8 of the optos (the power supply)
    For that special board it solved the problem.

    BR & GL
    Max

  19. #159
    Join Date
    Jul 2008
    Posts
    1
    Hi,
    Very good project, my compliments!!!
    I want to make it, but i have some IR2184 and i have not IR2101.
    The IR2184 have only one pwm input and it have two output, one direct and one inverted.
    It's possible use it, if I connect only two dspic's pwm outputs (only the two high sides for example)?

    Sorry for my bad english!

    Thank You
    Marco

  20. #160
    Join Date
    May 2007
    Posts
    106
    Yes. /SD pin should be at 0V then.

    good luck.

    Max

Page 8 of 9 6789

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
  •