Hydraulic Press project on Neuron M203 - beginner needs help



  • Hello, im new to the board and to the topic of automation, and i require some assistance.
    I see there are some experienced users which I hope will lend me a helping hand.

    For a brief overwiew: we decided to use Neuron M203 to replace the old Simatic S7 300 which stopped functioning for unknown reasons ( we bought the press in fatal condition ). Anyway while the whole hydraulic loop and mechanical issues are being fixed meantime, I'm supposed to rebuild the wiring and wire up & program the PLC.

    I've followed all tutorials on Mervis IDE, had some success wiring some easy test limit switches on DI 1-4 which were activating some RO's using fbd.

    But now as my first task is to verify if the analog pressure sensor which came with the press is actually working.
    Its APLISENS PC-28, and i think of using it in current mode 4-20ma, correct me if im wrong.

    Unfortunately cant find the manual in english atm, ask me anything.

    https://www.aplisens.com.pl/pdf/produkty/PC-28.pdf

    The sensor is 0-400 bar.
    So my first issue is, how do i actually realize the analog input scaling in Mervis? I saw that other IDE's include some example/ready to go function blocks that easily bring the REAL AI1.1 output (which is in mA if im correct?) to an INT/DINT variable, so in the end we'll be able to set an example.

    I tried to write my own .st function which will take the reading of the AI, store it in another global variable, then do the maths and output scaled value into another global var.

    While i completely get the concept I need a walkthrough and how-to step by step on how to do it right.
    Is it possible, and how hard is to write a simple function block for the scaling? Maybe there is a function in IEC that solves this?


  • administrators

    Hello @r3sist,
    for this type of recalculation you can use "transformation". Transformations are built-in functions for recalculating the measured value and you can configure them for each input.

    Your sensor outputs 4mA when the pressure is 0 bar nad 20mA when the pressure is 400 bar. You can use transformation "LinearByTwoPoints", via which you define line on the graph by two points: X1, X2, Y1 and Y2.

    For first measured value (X1) in mA, you define what value you want (Y1). So for X1 = 4, you want Y1= 0. The same you will do for X2 = 20, Y2 = 400.

    Here is where to configure this:

    0_1565264892666_9828ba6d-91d1-496e-b76b-5e438f9e3a02-image.png

    After this configuration, you need to upload the configuration to the module: https://kb.unipi.technology/en:sw:01-mervis:unipi-configure-module-hidden

    Best regards,
    Martin



  • @martin-kudláček Very detailed tips, i found the setting immediately. I lost myself while looking for parameters under Variable Browser.

    I applied the transformation, first at Analog Type - > Current, i've set the points just like u said, but...

    Not sure, but 95% that my sensor is dead, cause the PLC Value reading was oscillating between 0.0078 to 0.0106 or something, the exact same reading is shown when there is nothing wired to the AI1.1/AGND on open contacts.

    I will try to check the pressure sensor alone, ordered another new one, and I will post back the results on a new sensor.

    Thanks a lot for help, will come back to this topic after it arrives.


  • administrators

    Hi @r3sist, did you configure the module? It looks like you still have the AI in the voltage mode, hence the low readings.



  • Hi @martin-kudláček, yes, i did reconfigure the module, even twice, trying to swap between the sensor's voltage and current output, with the same result.
    New sensor is on the way, i should give some updates tomorrow.



  • Im back, got my hands on an used STS ATM/T 0-400bar, 0-10V output. Configured AI1.1 for voltage mode, plugged the sensor into air line, got some readings after the transformation on around 6,3-6,4bar so it seems correct.

    Now when i have the pressure value I should start coding the machine program itself.

    For first i would want and idle menu machine state, use some kind of case instruction to choose between the automatic and manual press mode where:
    In auto, some RO's would stay on until the before set pressure is met and until limit switches arent tripped.
    Where in manual, no more than 400bars and also to the min/max limit switch positions.

    Could you guys guide me or show some .st examples? I've no idea on how to start it right.

    Also is there a way to connect a simple display to neuron, and also program plc to output for example the A1.1 value?
    I know there is a full hmi panel available, but I would prefer something simple, + / - using DI's, and simple lcd/segment display for it, so an operator could adjust the set pressure for auto mode easily.



  • Hi @r3sist,
    any progress with your project? Very interesting.



  • @josar Yes, we have a lot of leaking problems at the moment, but its almost finished. Still trying to figure out something more basic for HMI than a weintek panel. I will post the updates with some pictures soon, gonna take about 2 weeks I hope.



  • So we got most of the leaking solved, time came to code the auto cycle.
    While coding manal valve closing/openings on button presses was easy, this is where i began to struggle.
    I followed a guide which was based on a TwinCat 3, but obviously things are different between IDE's.
    What i would like to know is to how to properly init and call a simple timer and r_trig function block in mervis. Does it have to be manually added into the main.fbd, then called properly from main.st for example? Or can i just declare it in .st which would seem more convenient for me.

    VAR
    // timers
    fbStartautotimer:TON;
    // triggers
        fbAutoInit_RTRIG:R_TRIG;
        fbAutoOff_RTRIG:R_TRIG;
        fbCycle_RTRIG:R_TRIG;
        fbZeropos_RTRIG:R_TRIG;
    END_VAR
    

    Also im not sure if the code below will work even if I call the function blocks properly.

    // auto cycle
    
    // button mapping
    hw.$Neuron M203_DI2.10$:= bManualMode;
    hw.$Neuron M203_DI2.11$:= bAutoMode;
    hw.$Neuron M203_DI2.12$:= bAutoEjectorMode;
    // pressure setpoint and scaling
    iPressure:= REAL_TO_INT(hw.$Neuron M203_AI1.01$);
    iPressure_setpoint:= 200;
    fbAutoInit_RTRIG(clk:=bAutoCycleOn);
    fbAutoOff_RTRIG(clk:=bAutoCycleOff);
    
    IF bAutoMode & fbAutoInit_RTRIG.Q AND NOT fbAutoOff_RTRIG.Q THEN
        bPumpOn:= TRUE;
        iState:= 10;
    ELSE
        bPumpOff:= TRUE;    
        iState:= 0;
    END_IF;
    CASE iState OF 
        10:
        // timer init to let the pump run well
        fbStartautotimer(IN:bPumpOn,PT:T#2s);
        IF fbStartautotimer.Q THEN
            fbStartautotimer(IN:=FALSE);
        END_IF;
        fbCycle_RTRIG(clk:=fbStartautotimer.Q);
        IF fbCycletrigger_RTRIG.Q THEN
        iState:= 20;
        sCurrentCycleState:= "Pressing cycle start";
        END_IF;
        20:
        IF iPressure <= iPressure_setpoint AND NOT bLimitswitch2 & fbAutoOff_RTRIG.Q THEN
        bTableDown_valve:= TRUE;
        sCurrentCycleState:= "Pressing to the pressure setpoint";
        iState:= 30;
        ELSE
        bTableDown_valve:= FALSE;
        sCurrentCycleState:= "Cycle stopped, reset";
        END_IF;
        30:
        // expression cycle completed, move the table upwards to 0 position
        fbZeropos_RTRIG(clk:=iState:=30);
        IF fbZeropos_RTRIG.Q AND NOT bLimitswitch3 & fbAutoOff_RTRIG.Q THEN
        bTableUp_valve:= TRUE;
        iTotalAutoCycles:= iTotalAutoCycles +1;
        sCurrentCycleState:= "Zeroing table, cycle end";
        END_IF;
    END_CASE;
    

    I would appreciate a helping hand on this one.

    Also wondering if this: https://www.waveshare.com/wiki/3.5inch_HDMI_LCD

    can be hooked up to display the pressure? And assign some leftover DI's for +/- ?


  • administrators

    If you want to call a function(or FB) in a ST, you can create aditional program in ST and call the FB from there.

    The display however is a HDMI and cannot be hooked to any DIs.



  • I guess that @r3sist was trying to cover two separate topics:

    • using the 3.5" screen as local HMI (or operator screen, depending on the preferred terminology)
    • using DIs to manipulate some variable(s) in the algorithm, e.g. maximum and minimum for pressure

    Am I right?

    Jaroslav



  • @jaroslav_sobota
    Yes exactly. I just need anything to notify the operator directly on the machine about current pressure , and let him adjust this one pressure setpoint variable. It could even be a segment lcd.


  • administrators

    @r3sist thanks for clarification.

    The best would be to setup a HMI terminal like this one https://www.unipi.technology/weintek-mt8051ip-p198?categoryId=29

    Hooking buttons to DIs would be OK, but you would have to figure out the display since Neuron do not have native support for HDMI or I2C displays.



  • @r3sist said in Hydraulic Press project on Neuron M203 - beginner needs help:

    I just need anything to notify the operator directly on the machine about current pressure , and let him adjust this one pressure setpoint variable. It could even be a segment lcd.

    If segment LCD is all you need, maybe something like this could do the trick:
    https://en.papouch.com/tds-rs485-7-segment-led-display-p1922/

    You can connect it via RS485 and communicate using Modbus RTU.



  • @jaroslav_sobota said in Hydraulic Press project on Neuron M203 - beginner needs help:

    If segment LCD is all you need, maybe something like this could do the trick:
    https://en.papouch.com/tds-rs485-7-segment-led-display-p1922/

    You can connect it via RS485 and communicate using Modbus RTU.

    Oh, thanks, I was totally unaware of displays over RS485. Yes, this should work.
    Going to look for a suitable device then, and post updates here.