586,521 active members*
3,496 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Board.
Results 1 to 12 of 12
  1. #1
    Join Date
    Jul 2004
    Posts
    240

    Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Board.

    Greetings all,

    Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Board. I have wire in incremental Encoders before.
    Is there documentation as to how to wire a Quadrature Incremental Encoder with a Ref+ and Ref- also?

    Thanks so much!

    - Jeff
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  2. #2
    Join Date
    May 2006
    Posts
    4047

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Hi Jeff,

    Encoder Ref Marks are handled in KFLOP/Kogna Software so can be connected to any available input. Differential signals can be connected to any unused A or B differential encoder input. Normally Kanalog JP2 is available. See Kanalog JP1/JP2 Differential Inputs.

    For examples of how to home with index pulses see Axis Homing and Indexing.
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Jul 2004
    Posts
    240

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Thanks Tom... looks good to me! Will give it a go!!

    - Jeff
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  4. #4
    Join Date
    Jul 2004
    Posts
    240

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Next thing I am wondering?

    How can I scale an analog input. The input is 7 to 1907. As wired with a potentiometer. I want that input to be scaled to 0 - 100. How can I do that?
    Thanks!
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  5. #5
    Join Date
    May 2006
    Posts
    4047

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Hi Jeff,

    What is the input used for? That would be (input - 7.0) * 100.0 / (1907.0 - 7.0)
    TK
    http://dynomotion.com

  6. #6
    Join Date
    Jul 2004
    Posts
    240

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    I am using 3 different Potentiometers as inputs. I will use 1 analog output to supply the 10vdc to the three pot's.
    Then the first pot. and analog input will be used to scale the dwell time after the bend on the press brake... 1 - 5 seconds.
    Then the second pot will scale an offset to be put into the gain of the axis two. This will be anywhere from 0 - 250 thousands of an inch.
    The third will be used to control the pressure setting of the press at 1 - 100 percent.

    I will have a program running on the Kflop. No computer hooked up for running the machine, once dial in.

    Thus I need to scale what ever the pot's are reading. I am using 10 turn pot's for accuracy.
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  7. #7
    Join Date
    Jul 2004
    Posts
    240

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Greetings,

    Making progress. Have built an all new control. Wired up the valve system. Attached is the file I am running the machine with. As well as the init____.c file I am using. Not complete yet.

    I am so far using jog... to limit switches. Down Button, Up Button, Down Foot Peddle. I have encoder feedback for both axis. Two hydraulic cylinders. Valve control for fast down, slow down, and fast return.
    I have done step response tuning.... and able to get a profile move 2000 counts. And it moves pretty good on a single axis.

    So I can jog, like Jog(0, 2000); Jog(1, 2000); and this moves down Pressing reasonably good. When it hits the switch it returns to the top. I have even tested some jogging to a ch0->Position and then reacting to this, which can be useful.
    What I don't have... is closed loop motion... I am probably missing something... I have encoders that are 5080 cnts/inch. I can get action via the tuning... but not with a move command like this??? MoveRelAtVel(0, -5080, 2000); //MOVE UP ONE INCH

    The code is debugged, but don't have that newest copy here. Another problem... with Jog... is that I have to Zero(0); Zero(1); both axis so that I can get them to move right away when commanded to jog.
    As well the DEST does not match the Position.... the Dest is just running on and on... and the position of course is matching the linear encoders... for axis 0, 1. Most likely related to no closed loop???

    Thanks for your help!




    #include "KMotionDef.h"

    // Press Brake Run Version 4.0.3
    // ADDED RAPID
    //120mm/s Approach
    //10mm/s Pressing
    //100mm/s Return

    enum { HOME, RETURN1, RETURN2, IDLE, DOWN, DOWNFAST, UP, DELAY, BOTTOM, TOP, RETURN}; // states
    #define CLOSE 136
    #define OPEN 137
    #define RAPID 140
    #define TOP 139
    #define BOTTOM 138
    #define SLAVE 1

    int state = IDLE;
    int slow = 2000; //2000 for pressing 40000 High Speed
    int medium = 20000;
    int fast = 20000;
    double DelayTime;
    int offset; //OFFSET
    int Y3 = 144;
    int Y5 = 145;
    int A0; //PRESSURE
    float a10; //Dwell calculation
    int a12; //Dwell calculation
    int dwell; // Bend Delay
    int cnt1 = 0; //Pressure OFF after count
    int automode = 0; //Auto Mode
    int position = 0; //Destination Position for leveling

    main()
    {
    for (; //forever loop
    {
    switch (state)
    {
    //WAIT FOR COMMAND TO MOVE
    case IDLE:
    if (!ReadBit(BOTTOM) && ReadBit(CLOSE)){ SET_OFFSET(); state = DOWNFAST; } //SET_OFFSET();
    if (!ReadBit(TOP) && ReadBit(OPEN)){ ZERODEST(); state = UP; }
    cnt1++;
    Delay_sec(0.01);
    if (cnt1 >= 2){ V_IDLE(); } //PUT PRESS VALVES INTO IDLE MODE AFTER 2 10THS OF A SECOND.
    break;

    //GOING DOWN FAST
    case DOWNFAST:
    if (ReadBit(RAPID)){ V_APPROACH(); Jog(0, fast); Jog(1, fast); state = BOTTOM; } //FAST CLOSE //RAPID REVERSED FOR EXTERNAL SWITCH ACTIVATION.
    if (ReadBit(BOTTOM)){ Jog(0, 0); Jog(1, 0); SET_DWELL(); state = DELAY; }
    break;


    //GOING DOWN
    case DOWN:
    if (!ReadBit(BOTTOM) && !ReadBit(RAPID)){ V_PRESSING(); Jog(0, slow); Jog(1, slow); state = BOTTOM; } //CHANGE TO SLOW CLOSE
    if (ReadBit(BOTTOM)){ Jog(0, 0); Jog(1, 0); SET_DWELL(); state = DELAY; }
    break;

    //WAIT FOR LIMIT OR RELEASE OF (FOOT PEDDLE OR DOWN BUTTON).
    case BOTTOM:
    if (!ReadBit(CLOSE)){ Jog(0, 0); Jog(1, 0); cnt1 = 0; state = IDLE; }
    if (ReadBit(BOTTOM)){ automode = 1; Jog(0, 0); Jog(1, 0); SET_DWELL(); state = DELAY; } //Put into auto mode.
    break;

    //DWELL AT BOTTOM
    case DELAY:
    if (Time_sec() > DelayTime){ state = UP; }
    break;

    //GOING UP
    case UP:
    if (!ReadBit(TOP)){ V_DECOMPRESSION(); Jog(0, -slow); Jog(1, -slow); state = RETURN; } //SLOW OPEN
    if (ReadBit(TOP)){ Jog(0, 0); Jog(1, 0); ZERODEST(); cnt1 = 0; state = IDLE; }
    break;

    //RETURN AT MEDIUM SPEED
    case RETURN:
    if (!automode && !ReadBit(TOP)){ V_RETURN(); ZERODEST(); Jog(0, -medium); Jog(1, -medium); state = TOP; } //MEDIUM OPEN
    if (automode && !ReadBit(TOP)){ V_RETURN(); ZERODEST(); Jog(0, -medium); Jog(1, -medium); state = HOME; } //AUTO GO TO TOP LIMIT THEN LEVEL
    break;

    //WAIT FOR LIMIT OR (RELEASE OF UP BOTTON IF NOT IN AUTO MODE).
    case TOP:
    if (!ReadBit(OPEN)){ Jog(0, 0); Jog(1, 0); ZERODEST(); cnt1 = 0; state = IDLE; } //STOP AND PUT BAKE INTO IDLE
    if (ReadBit(TOP)){ Jog(0, 0); Jog(1, 0); ZERODEST(); cnt1 = 0; state = IDLE; }
    break;

    //AUTO GO TO TOP LIMIT THEN LEVEL
    case HOME:
    if (automode && ReadBit(TOP)){ V_IDLE(); Jog(0, 0); Jog(1, 0); ZERODEST(); automode = 0; }
    //MOVE DOWN AND EVEN
    if (!automode && ReadBit(TOP)){
    int pos1 = ch0->Position;
    int pos2 = ch1->Position;
    position = pos2;
    Delay_sec(0.1);
    if (pos1 < pos2){ V_PRESSING(); Jog(0, slow); state = RETURN1; }
    if (pos1 > pos2){ V_RETURN(); Jog(0, -slow); state = RETURN2; }
    }
    break;

    case RETURN1:
    if (ch0->Position >= position){V_IDLE(); Jog(0, 0); Jog(1, 0); ZERODEST(); cnt1 = 0; state = IDLE;}
    break;

    case RETURN2:
    if (ch0->Position >= position){V_IDLE(); Jog(0, 0); Jog(1, 0); ZERODEST(); cnt1 = 0; state = IDLE;}
    break;

    }

    }
    }

    //----------------------------------- VALVE CONTROL ------------------------------------------------------

    V_IDLE()
    {
    //SET SPEED TO ZERO
    int max = 0; ch0->MaxOutput = max; ch1->MaxOutput = max;
    ClearBit(Y3);
    ClearBit(Y5);
    DAC(2,0); //Pressure Setting Zero
    }

    V_APPROACH()
    {
    //SET SPEED TO NORM
    int max = 600; ch0->MaxOutput = max; ch1->MaxOutput = max;
    SetBit(Y3);
    SetBit(Y5);
    A0 = ADC(0) * 2.12; //0 - 945 Reading Pressure Setting
    DAC(2, -A0); //SET PRESSURE
    }

    V_PRESSING()
    {
    //SET SPEED TO MAX
    int max = 2000; ch0->MaxOutput = max; ch1->MaxOutput = max;
    ClearBit(Y3); //Experiment
    SetBit(Y5);
    A0 = ADC(0) * 2.12; //0 - 945 Reading Pressure Setting
    DAC(2, -A0); //SET PRESSURE
    }

    V_DECOMPRESSION()
    {

    //SET SPEED TO ZERO THEN TO MINIMAL
    int max = 0; ch0->MaxOutput = max; ch1->MaxOutput = max; //Instant Stop
    ClearBit(Y3);
    ClearBit(Y5);
    Delay_sec(1.0);
    int max = 100; ch0->MaxOutput = max; ch1->MaxOutput = max;
    A0 = ADC(0) * 2.12; //0 - 945 Reading Pressure Setting
    DAC(2, -A0); //SET PRESSURE

    }

    V_RETURN()
    {
    //REGULATE UP SPEED
    int max = 300; ch0->MaxOutput = max; ch1->MaxOutput = max;
    ClearBit(Y3);
    ClearBit(Y5);
    A0 = ADC(0) * 2.12; //0 - 945 Reading Pressure Setting
    DAC(2, -A0); //SET PRESSURE
    }

    //------------------------------ SET DWELL -----------------------------------------------------------------

    SET_DWELL()
    {
    a10 = ADC(1) / 189;
    if (a10 > 189)
    {
    if (a10 > 0 && a10 <= 1){dwell = 1;}
    if (a10 > 1 && a10 <= 2){dwell = 2;}
    if (a10 > 2 && a10 <= 3){dwell = 3;}
    if (a10 > 3 && a10 <= 4){dwell = 4;}
    if (a10 > 4 && a10 <= 5){dwell = 5;}
    }
    if (a10 < 189){ dwell = 1; }
    if (a10 < 0){ dwell = 1; }
    DelayTime = Time_sec() + dwell; state = DELAY;
    }

    //------------------------------ SET OFFSET -----------------------------------------------------------------

    SET_OFFSET()
    {

    int a3 = ADC(2);
    int a5 = convert_value(a3);
    ch0->MaxOutput = 600;
    ch1->MaxOutput = a5;
    //printf("Y1 MaxOutput = %d\n",a5);
    state = DOWN;
    }

    convert_value(int a3){
    // Calculate the scaling factor (avoid floating-point math).
    int scale_factor = (620 - 610) * 1000 / (945 - 4);

    // Apply the scaling factor to a3 and offset by 610 to get the new value.
    int new_value = a3 * scale_factor / 1000 + 610;

    return new_value; }

    //---------------------------------------- ZERO DEST AND ALL -------------------------------------------------------------

    ZERODEST()
    {
    ch0->Dest = 0; ch1->Dest = 0; Delay_sec(0.1);
    }

    ZERONOW()
    {
    Zero(0); Zero(1); Delay_sec(0.1);
    }



    #include "KMotionDef.h"

    main()
    {
    ch0->InputMode=ENCODER_MODE;
    ch0->OutputMode=DAC_SERVO_MODE;
    ch0->Vel=1000;
    ch0->Accel=400000;
    ch0->Jerk=4e+06;
    ch0->P=30;
    ch0->I=0;
    ch0->D=60;
    ch0->FFAccel=0.025;
    ch0->FFVel=1.2;
    ch0->MaxI=1000;
    ch0->MaxErr=2e+06;
    ch0->MaxOutput=600;
    ch0->DeadBandGain=1;
    ch0->DeadBandRange=0;
    ch0->InputChan0=0;
    ch0->InputChan1=0;
    ch0->OutputChan0=0;
    ch0->OutputChan1=0;
    ch0->MasterAxis=-1;
    ch0->LimitSwitchOptions=0x100;
    ch0->LimitSwitchNegBit=0;
    ch0->LimitSwitchPosBit=0;
    ch0->SoftLimitPos=1e+09;
    ch0->SoftLimitNeg=-1e+09;
    ch0->InputGain0=1;
    ch0->InputGain1=1;
    ch0->InputOffset0=0;
    ch0->InputOffset1=0;
    ch0->OutputGain=-1;
    ch0->OutputOffset=0;
    ch0->SlaveGain=1;
    ch0->BacklashMode=BACKLASH_OFF;
    ch0->BacklashAmount=0;
    ch0->BacklashRate=0;
    ch0->invDistPerCycle=1;
    ch0->Lead=0;
    ch0->MaxFollowingError=1000000000;
    ch0->StepperAmplitude=20;

    ch0->iir[0].B0=1;
    ch0->iir[0].B1=0;
    ch0->iir[0].B2=0;
    ch0->iir[0].A1=0;
    ch0->iir[0].A2=0;

    ch0->iir[1].B0=1;
    ch0->iir[1].B1=0;
    ch0->iir[1].B2=0;
    ch0->iir[1].A1=0;
    ch0->iir[1].A2=0;

    ch0->iir[2].B0=1;
    ch0->iir[2].B1=0;
    ch0->iir[2].B2=0;
    ch0->iir[2].A1=0;
    ch0->iir[2].A2=0;

    ch1->InputMode=ENCODER_MODE;
    ch1->OutputMode=DAC_SERVO_MODE;
    ch1->Vel=1000;
    ch1->Accel=400000;
    ch1->Jerk=4e+06;
    ch1->P=30;
    ch1->I=0;
    ch1->D=60;
    ch1->FFAccel=0.025;
    ch1->FFVel=1.2;
    ch1->MaxI=1000;
    ch1->MaxErr=2e+06;
    ch1->MaxOutput=620;
    ch1->DeadBandGain=1;
    ch1->DeadBandRange=0;
    ch1->InputChan0=1;
    ch1->InputChan1=0;
    ch1->OutputChan0=1;
    ch1->OutputChan1=0;
    ch1->MasterAxis=-1;
    ch1->LimitSwitchOptions=0x100;
    ch1->LimitSwitchNegBit=0;
    ch1->LimitSwitchPosBit=0;
    ch1->SoftLimitPos=1e+09;
    ch1->SoftLimitNeg=-1e+09;
    ch1->InputGain0=1;
    ch1->InputGain1=1;
    ch1->InputOffset0=0;
    ch1->InputOffset1=0;
    ch1->OutputGain=-1;
    ch1->OutputOffset=0;
    ch1->SlaveGain=1;
    ch1->BacklashMode=BACKLASH_OFF;
    ch1->BacklashAmount=0;
    ch1->BacklashRate=0;
    ch1->invDistPerCycle=1;
    ch1->Lead=0;
    ch1->MaxFollowingError=1000000000;
    ch1->StepperAmplitude=20;

    ch1->iir[0].B0=1;
    ch1->iir[0].B1=0;
    ch1->iir[0].B2=0;
    ch1->iir[0].A1=0;
    ch1->iir[0].A2=0;

    ch1->iir[1].B0=1;
    ch1->iir[1].B1=0;
    ch1->iir[1].B2=0;
    ch1->iir[1].A1=0;
    ch1->iir[1].A2=0;

    ch1->iir[2].B0=1;
    ch1->iir[2].B1=0;
    ch1->iir[2].B2=0;
    ch1->iir[2].A1=0;
    ch1->iir[2].A2=0;


    EnableAxis(0);
    EnableAxis(1);

    DefineCoordSystem(0,1,-1,-1);
    }


    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  8. #8
    Join Date
    May 2006
    Posts
    4047

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Hi Jeff,

    What I don't have... is closed loop motion...
    I'm guessing you haven't properly tuned the axes. The Feed Forward is probably outputting something to the DAC to give some motion. The Max Following Error is set to a huge value so there isn't any fault when the axis doesn't follow properly. I would remove the FF and use the Step Response Screen to set the feedback parameters such that the position follows the command with low error.

    With a slaved pair of axes like this it is somewhat tricky to tune. I'd try very small moves (with the other axis disabled) first to obtain some reasonable tuning. Then set the same parameters for both axes and Slave them and Tune the Master Axis with the Slave following. Then reverse the Master/Slave roles to tune the other axis.
    TK
    http://dynomotion.com

  9. #9
    Join Date
    Jul 2004
    Posts
    240

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Thanks Tom,

    Got back into the tuning and figured out what was happening.

    Back Story: When I first installed the board into the new control panel, it all work well at my shop. At the customers, when first hooked up, one of the switch outputs to a relay... was hooked to some bad existing wiring and shorted out that transistor chip on the Kanalog board. Had to switch to some other outputs to get it going. I replaced all the wiring going to the valve bank, and eliminated the problem. All new control with all new wiring. See Picture below.

    Seems that this mishap, did something also to the analog out on channel 1. That was simply not working. I switched to channel 3 which was the next one available.

    The whole system was a problem, as I was making channel 1 the master and channel 0 the slave. With channel 1 being bad... and not functioning properly... all sorts of problems.

    By following your idea to go back to the tuning, I discovered this problem. Got full closed loop control now and the machine is accurate to the resolution of the linear encoders... 10 microns... or 0.000393701 of an Inch!

    Of course bending metal will never achieve that type of accuracy... but the machine can.

    Now converting programming to take advantage of the closed loop programming.

    Click image for larger version. 

Name:	CONTROL BAD EXISTING WIRING REPAIRED NOW.jpg 
Views:	2 
Size:	150.5 KB 
ID:	504792
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  10. #10
    Join Date
    May 2006
    Posts
    4047

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Wow very neat wiring.
    TK
    http://dynomotion.com

  11. #11
    Join Date
    Jul 2004
    Posts
    240

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Quote Originally Posted by TomKerekes View Post
    Wow very neat wiring.
    Thanks... we pulled the control backplate completely out of the machine and brought to the shop... and built the control there. Then back to the customers and installed.

    Not completely running yet. Adding features in the programming... at the customers request.

    More later.
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  12. #12
    Join Date
    Jul 2004
    Posts
    240

    Re: Press Brake with Linear Encoders with a Reference Mark: How to wire to Kanalog Bo

    Greetings,

    Now I am very close. I need in C programming to be able to do precise Coordinated motion? So that both axis move together and stay exactly in Sync.
    I am going to put the init and c program on Thread 1 and 2. The press brake program will run the thread 1 and wait a few seconds, then load and run its forever loop.

    I have four types of moves: DownFast, DownSlow, UpSlow, and UpMedium. slow = 2000; medium = 20000; fast = 24000; (cnts/sec).

    Thanks in advance for your help!
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

Similar Threads

  1. Converting Conventional Hydraulic Press Brake to CNC Press Brake with PC
    By aadityadengle in forum Uncategorised MetalWorking Machines
    Replies: 12
    Last Post: 08-13-2023, 05:23 PM
  2. Replies: 1
    Last Post: 01-21-2023, 12:32 PM
  3. press brake can't find reference point
    By Andriy77 in forum Bending, Forging, Extrusion...
    Replies: 2
    Last Post: 09-07-2016, 10:50 PM
  4. Linear encoders + kanalog. Wiring question
    By Alex101 in forum Dynomotion/Kflop/Kanalog
    Replies: 15
    Last Post: 08-28-2015, 07:26 AM
  5. WTB: linear bearing system for press brake
    By sdubfid in forum Want To Buy...Need help!
    Replies: 1
    Last Post: 12-20-2009, 10:29 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
  •