586,068 active members*
3,716 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > KFlop controller to interface w/ Prototrak Servo amps
Page 1 of 2 12
Results 1 to 20 of 35
  1. #1
    Join Date
    Jun 2012
    Posts
    0

    KFlop controller to interface w/ Prototrak Servo amps

    Hi All!

    I need help interfacing Prototrak Servo amp with a KFLOP

    I picked up an Acer 3hp mill with Prototrak M2 controller at auction that looked to be in great shape except it had a big surprise: the computer had been pulled out of the pendant. Everything else existed on the machine including the CRT screen, front panel and servo units on the X and Y axis.

    Once discovered, I was left with a few options
    1. Buy a new prototrak pendant
    2. Use an aftermarket motion controller and interface with the existing encoders and servo amps
    3. Complete new system including motion controller and new amps

    option 1 was far too expensive (3k+) which left me to go for option 2 with a KFLOP, at least until the time I realize it is not worth the trouble and just buy new amps. Until then, I am hoping the community here can help me get this system working.

    The prototrak servo units are nice in that the encoder, amp, and motor is all housed in one case on the end of each axis. I took the covers off the housings and everything looks to be very clean. It doesn't mean much but at least there isn't anything obviously burnt out.

    I have done some poking around with a DMM to determine how the units are wired up.

    The servo amps have the following connections:
    120VAC (Hot and Neutral)
    PWM
    NPWM
    +5v
    Limit Switch
    Ground (digital)
    Ground (Chassis)
    Motor +
    Motor -

    The encoders are Avago HEDS-9000 that have the A and B channels going through a UA9638CP RS-422 Differential Line Driver back to the Pendant

    Based on the schematics, the PWM line should be pulsed for CW rotation and the NPWM should be pulsed for CCW rotation.

    I currently have the 4 lines from the Encoder being read by a 26LS32 line receiver. I am just using two of the 4 channels at the moment. One thing I need some clarity on is how to use the three state control on this chip.

    The KFLOP is setup such that:
    PWM is connected to JP6 Pin 5, NPWM is connected to JP6 pin 6
    Encoder Channel A from the 26LS32 is connected to JP7 pin7 and Channel B from the encoder is connected to JP7 pin8

    I have a separate 5v supply going to the servo amp and encoder.

    What do I need to do to setup the KFlop to
    1. read the encoders properly
    2. output PWM and NPWM signals

    Eventually I would like to use Mach3 to control the kflop but need to get the basics working first.

    and what else did I miss??? I am a mechanical engineer wearing my very rusty, EE and programming hat.

    Thank you in advance for your help!

  2. #2
    Join Date
    May 2006
    Posts
    4045
    Hi Waterdog5,

    Sounds like a nice project!

    Regarding the 26LS32 differential receiver: You would just want to permanantly enable the outputs. You can tie both the control inputs either high or low to do this. The Outputs could be connected to KFLOP JP7 pins 7 and 8 to KFLOP's Encoder 0 input.

    Regards
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Jun 2012
    Posts
    0
    Thanks Tom. I will tie both pins 4 and 12 high to enable them. Interestingly, the schematic for the EA-R8 cable has pin 4 high and pin 12 low.

    Once this is connected properly, I should be able to see the counts change on the axis screen, correct? Is there anything else I need to configure or change in the software for the encoder?

    how do I configure the PWM outputs in the software?

    Thank you
    Attached Files Attached Files

  4. #4
    Join Date
    May 2006
    Posts
    4045
    Hi Waterdog5,

    The chip has a positive true enable line and a negative true enable line that are "OR"ed together to enable the output. Either or both active will enable the outputs. So both Hi will activate one but not the other. Both low will activate one and not the other. Or as shown in the schematic both are activated. All three methods will have the same result in the output being always enabled.

    By default Axis 0 is configured as Encoder Mode using encoder #0 (InputChan0=0). So Encoder Position changes should be displayed on the Axis Screen as Axis 0 Position without doing anything. Check that the A and B signals are both toggling when the encoder moves slowly (Digital IO Screen and/or voltmeter). Move the encoder from one position forward and backward back to the same position and the displayed position should return to the same value.

    There is a C example called PWM1KHz.c that you can use to test the PWM0 output. It simply commands a fixed duty cycle at a fixed frequency to the PWM. This will pulse your PWM_Plus signal to hopefully drive your motor forward. I would start with a small Duty Cycle like 4% or 10 PWM counts. I don't know what frequency would work with your amplifier but to change to ~20KHz would be a pre-scale divisor of 2. To keep your PWM_Minus signal low connect it to IO27 and set that as an output which is low.

    I hope that making a mistake like setting one or both PWM Pins High will not blow out your amplifier and/or motor and/or damage your machine. There are pull down resistors on those IO pins so they should remain low on power up.

    Regards

    Regards
    TK
    http://dynomotion.com

  5. #5
    Join Date
    Jun 2012
    Posts
    0
    Right now, I am focusing on just getting the kflop to read the counts of the encoder. I would think that this would be simple and interfaceable with zero additional parts. The encoder only needs a Vcc +5v, and a ground to ouput on Channel A and Channel B

    I have been doing some additional testing on the various parts of the system. I had some concern that there were some connectivity problems since the signal had to pass through a lot of different hand-off points: encoder to ribbon cable to daughter board inside servo housing to 10 pin connector going out of servo to 14 pin circular connector to breadboard to differential signal receiver to breakout board to ribbon cable to kflop.

    Since I wasn't getting any reading on the kflop, I just skipped all of the points above and connected the kflop directly to the ChA and ChB coming out of the encoder and used an external lab power supply to give it the +5v and ground. Still nothing! I have tried putting the encoder outputs to other channels on the kflop and no response. The readings on the axis screen of the software show the other channels increasing with nothing attached to their pins.

    I have also tried attaching my setup to the other axis with the same results, no encoder reading.

    This is getting increasingly frustrating! I am either missing something small but important or the Board needs to be replaced.

    Any help is appreciated. Thank you!
    Attached Files Attached Files

  6. #6
    Join Date
    May 2006
    Posts
    4045
    Hi Waterdog5,

    What you are doing seems correct. But when something simple isn't working it is usually best to go to the basics. Like I asked before, check if the signals are toggling high and low at the KFLOP input pins (JP7 Pins 7 and 8). You can do this two different ways. Look at the Digital IO Screen and see if IO0 and IO1 are toggling high and low as the encoder moves slowly. The signals might be changing too fast to see every transition but both signals should sometimes be high and sometimes low. If they are not toggling high and low, check them with a voltmeter relative to a KFLOP GND. They should be going high (>2.4V) and low (<0.4V). If they are not then there is some problem with your encoder or wiring.

    You might also test the Encoder input of KFLOP. Disconnect everything from KFLOP except USB (and +5V). Cycle power on KFLOP. View the Digital IO Screen and the Axis Screen at the same time. Set IO bits 0 and 1 as outputs. Toggle the states of IO0 and IO1 in a quadrature manner (A high, B high, A low, B low, repeat). The Position Value on the Axis Screen should count.

    Please perform the tests and let us know what you find.

    KFLOP Encoder inputs are very high impedance CMOS inputs (meg ohms). If they are unconnected they may pick up random noise. This is of no consequence.

    HTH
    TK
    http://dynomotion.com

  7. #7
    Join Date
    Jun 2012
    Posts
    0
    Good News! The Kflop now reads the encoder positions correctly through all cables and differential sig converters.

    The issue was that the pinouts defined on your documentation is different than the convention. Whereas the pins on a dual row header are usually counted across the header longways and then go to the next row, you defined them in the opposite manner, across the pairs and then down the length of the header. I am surprised this hasn't come up before!

    So now that I understand the pinouts, I thought the PWM would be plug and play. Unfortunately, no such luck. I am running that 1khz example script with the npwm low but nothing happens. The signal seems to be making it fine to the amp so i dont think it is a connection issue. Do you think there would be some kind of enable or startup needed?

    Any other ideas for tests?

    Thank you!

  8. #8
    Join Date
    Dec 2003
    Posts
    24221
    Quote Originally Posted by wonderdog5 View Post
    The issue was that the pinouts defined on your documentation is different than the convention. Whereas the pins on a dual row header are usually counted across the header longways and then go to the next row, you defined them in the opposite manner, across the pairs and then down the length of the header. I am surprised this hasn't come up before!
    Every IDC header I have come across is numbered alternately across the row, not longitudinally down the header, this way it conforms to the ribbon cable wire number if ribbon is used.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  9. #9
    Join Date
    May 2006
    Posts
    4045
    Hi Wonderdog5,

    I think our numbering method is actually the most common convention. We also place a photo describing the pinout right below the pinout descriptions.

    Regarding the PWM signal: We only provide the PWM signal. It is entirely your responsibility to make it work properly with your specialized amplifier. We have never claimed to be Plug-and-Play with this type of amplifier. We are only trying to help you out.

    Regarding the schematic that you sent me off-line: It looks like your amplifier has a Limit SW input that needs to be connected to the 0V signal to enable the amplifier. Did you realize this? There is also a /SHDN (Shut down?) signal on TP16 that will indicate the drivers are disabled because of Limit SW or overcurrent. You could measure if that signal is low or high. The signal should probably be high to enable the output.

    Are you changing the parameters of the PWM1KHz.c example? 1KHz is probably much lower that he amplifier was designed to operate at. Too low of frequency might cause huge motor current ripple and possible damage. I would guess 10KHz would be a more reasonable frequency to begin testing if you can't get this information from your manufacturer.

    Regards
    Attached Thumbnails Attached Thumbnails JP7Photo.JPG  
    TK
    http://dynomotion.com

  10. #10
    Join Date
    Jun 2012
    Posts
    0
    No worries about the pinouts.

    I have now been able to get the PWM controller to respond to the 1khz test! It spins up and moves quickly.

    Now to get the servo loop and setting setup properly. Is there a manual section on how to set the PWM output? I cant get the step response screen to send any output on the PWM channel.

    Thanks Again!

  11. #11
    Join Date
    May 2006
    Posts
    4045
    Hi Wonderdog5,

    KFLOP doesn't directly support PWM output types because there are so many different PWM types. You will need to write a few lines of C code to continuously write the Axis Channel's Output to the PWMs. There is a standard example named OutputToPWM3Axis.c. But yours is special where two pins need to be pulsed. I've attached a program that may work for you (change file extension back to .c). Look it over and see how much you can understand.

    For testing the concept you can just run this program as a separate thread but eventually you would need to expand it to support however many axes you have. The loop can be added to the end of your Initialization program so it runs after your system has been initialized.

    Regards
    Attached Files Attached Files
    TK
    http://dynomotion.com

  12. #12
    Join Date
    Jun 2012
    Posts
    0
    Tom, thank you for that program!

    Not knowing the specifications of the PWM inputs for the amps has given me unpredictable results. After running your program with no modifications, the axis would servo but only in one direction. However, I noticed that there was some output in the other direction because I could hear the whine of the amplifiers as I turned the axis handle in the other direction. So the controller is outputting something but not enough of a signal to move the motors...I have confirmed that both the PWM and NPWM lines work properly on the amp so it is definitely a kflop configuration issue.

    I have noticed that the PWM amps do not want to run at low speeds at high frequencies so maybe the amps are spec'ed at lower frequencies than we thought (5khz?). I am going to do some more experimenting today with the PWM outputs

    Is the format of the chan[x].Output a 1-255 integer? I realize that I could just use the printf command but my rusty C programming isn't allowing me to output that variable in real time. I can print it out but if I do it within the loops, it happens too fast for the console screen to print out resulting in a output that is not real-time.

  13. #13
    Join Date
    May 2006
    Posts
    4045
    Hi Wonderdog5,

    Opps I see a bug in the program. Sorry about that. The "Output" from a servo axis is a floating point signed number limited to the range specified by the "MaxOutput" parameter (which you should have set to something like 240). This will then be a range from -240.0 to +240.0. We need to write the magnitude to the PWMs (and the sign tells us which PWM should be used). So we need to add a "-" sign when the Output is negative to make it positive. See the attached program.

    BTW one trick I sometimes use to watch a variable when printing it would slow things down and cause problems is to assign it to an unused axis variable that is displayed in the Axis Screen. For Example:

    ch7->Position = my_variable_of_interest;

    Regards
    Attached Files Attached Files
    TK
    http://dynomotion.com

  14. #14
    Join Date
    Jun 2012
    Posts
    0
    Aha! With this change the machine is in motion!

    Now on to tuning...

    One observation is that the P gain needs to be increased to see any motor motion as the frequency of the PWM pulses is increased(decrease of the PWMS_Prescale factor)

    I am currently on a prescale of 2 which should be about 30khz pwm frequency.

    I have been tuning the loop which has resulted in some numbers that I would have thought were quite large.

    I have also noticed that the results are not always consistent across tests with the same parameters. Sometime it oscillates and sometimes it doesn't (see attached outputs).

    Any suggestions on what I am missing here? Should I be playing with the deadband adjustment as well?

    Also, these tests are only 500 counts each way. When I do longer traverses, the results are worse.


    Thanks!
    Attached Thumbnails Attached Thumbnails P0.7_I0_D0.jpg   P0.8_I0_D0.jpg   P1_I0_D0.jpg   P23_I.013_D293.jpg  

    P23_I.013_D293_2.jpg   P23_I.013_D293_3.jpg   P23_I.013_D293_long traverse.jpg  

  15. #15
    Join Date
    May 2006
    Posts
    4045
    Hi Wonderdog5,

    Prescale of 2 should actually be about 20KHz pwm frequency.

    Regarding the Plots:

    You tuned off the display of the Output so we can't see what is being commanded to the PWM.

    You should set all the feed forwards to zero when tuning the servo parameters (PID and filters).

    No I would not put in any DeadBand at this point.

    It looks like the Max Output of 254 vs 250 makes a difference. I would use the 250 or even smaller. Some PWMs don't like to operate at 100%.

    With respect to large moves it appears you are commanding speeds that your motor/amplifier is incapable of. Short moves don't accelerate to a speed beyond your capabilities. You have max Velocity set at 120000 counts/sec. If you were to show the PWM output you will probably see that the PWM is saturated at max and the motor is moving at max speed but much slower than the Trajectory. You need to slow down the motion to something your system can actually do.

    Your acceleration is set extremely high also. Assuming your system can really move at 50000 counts per sec. An acceleration of 5e6 would require they motor to accelerate to full speed in 1/100th of a second.

    Your Jerk setting is set quite low (for that acceleration). This setting would take 1.25 seconds to apply full acceleration (torque). These type of motors can apply torque pretty quickly. But actually after you reduce the acceleration it might be a reasonable value. Normally set the Jerk to about 100X the Acceleration value.

    Because you are using so high of D gain the output will probably be very "spikey". In fact a single encoder count change (delta=1) multiplied by your D gain of 293 will saturate the PWM output of 250. Adding a low pass filter will help and smooth this out and make the D gain more effective. Set the third IIR filter as a 2nd order low pass filter at maybe 500Hz and Q=1.4. You will likely need to reduce other gains after you do this to have a stable system.

    Regards
    TK
    http://dynomotion.com

  16. #16
    Join Date
    Jun 2012
    Posts
    0
    Attached are the latest outputs reflecting the low pass 2nd order filter and reducing the maximum velocity and acceleration. I think the result is pretty good but the amp is still becoming saturated at times and the output overshoots by about 50 counts in each direction. At 0.00036" per count, that 50 count overshoot is 0.0018" over.

    What should I be aiming for in terms of performance?

    I have experimented with the max error, velocity and acceleration quite a bit. The settings shown are the only numbers I have found to output a stable system with decent output.

    The addition of the IIR filter has cut down on the spikiness of the output a bit as well.
    Attached Thumbnails Attached Thumbnails P6_I.011_D270.jpg   P6_I.011_D270_short.jpg  

  17. #17
    Join Date
    May 2006
    Posts
    4045
    Hi Wonderdog5,

    If the output saturates then you are attempting to move beyond the capabilities of your system. It is like trying to follow a car going 101MPH in a car that will only go 100MPH with the gas pedal to the floor. All we can do is hold the pedal to the floor while we fall further and further behind. Only when the target brakes to a stop will we catch up (and likely overshoot if it has slowed significantly by the time we catch up). If the faster car only goes a short distance and never gets to a speed faster than what we can go, there won't be a problem.

    The only solution is to lower your max velocity or somehow change your system to make it go faster (ie higher supply voltage).
    Something odd about the 2nd plot is that to move into final position (Time>0.8sec) the output is quite high (> 100 PWM counts). This would indicate that it is taking almost half of full supply voltage to move slowly the last few counts into position. Does your system have very high friction/stiction? Or do you have any other explanation?

    Regards,
    TK
    http://dynomotion.com

  18. #18
    Join Date
    Jun 2012
    Posts
    0
    I had reached out for more information on the PWM amps a while ago and just received a response that they operate at 15khz with a 10 bit signal. Good to know! Now, even though I have been able to operate the machine with unoptimized output from the KFLOP, should I change anything? Is the kflop even able to output a 10bit PWM signal easily?

  19. #19
    Join Date
    Jun 2012
    Posts
    0
    I had reached out for more information on the PWM amps a while ago and just received a response that they operate at 15khz with a 10 bit signal. Good to know! Now, even though I have been able to operate the machine with unoptimized output from the KFLOP, should I change anything? Is the kflop even able to output a 10bit PWM signal easily?

  20. #20
    Join Date
    May 2006
    Posts
    4045
    Hi Wonderdog5,

    I think you were running the PWMs at 20KHz so you might want to change to 15KHz by changing the PWM Pre-scale value to 3.

    KFLOP only has 8-bit PWMs. Since we are doing 8-bits positive and 8-bits negative that might be considered a 9-bit range. But regardless I suspect 8- bits of output resolution is adaquate. Servo output is integrated over time so it is possible to control position/velocity with much higher precision than the Output resolution. A classic example is that room temperarature can be controlled pretty well with just 1 output bit.

    Regards,
    TK
    http://dynomotion.com

Page 1 of 2 12

Similar Threads

  1. KFLOP+Kanalog Analog Velocity Servo tuning
    By bradodarb in forum Dynomotion/Kflop/Kanalog
    Replies: 9
    Last Post: 07-01-2012, 01:19 AM
  2. aniulam 3300mk servo amps. for a servo transformer
    By Dave Rothermel in forum HURCO
    Replies: 1
    Last Post: 05-10-2012, 04:23 AM
  3. New Interface board for KFLOP by Umbrella Technologies
    By TomKerekes in forum Dynomotion/Kflop/Kanalog
    Replies: 1
    Last Post: 04-18-2012, 02:54 PM
  4. Amps to Motors interface
    By Ben Colby in forum CamSoft Products
    Replies: 7
    Last Post: 12-11-2010, 08:47 PM
  5. Prototrak MX2 Interface with Computer
    By dsoltis in forum Uncategorised MetalWorking Machines
    Replies: 0
    Last Post: 01-03-2008, 07:52 PM

Posting Permissions

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