Skip to Content

PLC Solution Library · Assembly station simulator

Run an assembly station: check each part and hand the cycle to the robot

An assembly station decides on every part: is it good, and can the robot do its work now? In this simulator, one M-Duino 38R weighs the part, reads the press force and measures a distance with a laser. It compares each value with a window, sends a program number to the robot and waits for its answers.

Choose a variant, start the station or inject a fault. Watch the signals between the PLC and the robot, the OK and NOK counters and the record of each part.

Choose your scenario

07:00:00 - Simulated values
0parts
0OK
0NOK
0NOK in a row
READYrobot signal
-last cycle time
    Weight · load cell-
    --Window -
    Peak force · press-
    --Window -
    Distance · laser-
    --Window -

    Robot handshake

      Operator reset stands for the reset button on the Panel PC. When the robot is in fault, the PLC also sends it a RESET pulse.

      About this panel

      Example station for you to test. A base part arrives on a conveyor. The robot places an insert on it and a pneumatic press pushes the insert in. Three variants share the station, each with its own robot program and windows.

      One M-Duino 38R runs the station. It reads a weighing transmitter, a force sensor and a laser on its 0-10 V inputs, talks to the robot controller with relay outputs and optoisolated inputs, and sends each record to a Panel PC over Ethernet.

      Safety (emergency stop, guards, light curtains) runs on a separate safety circuit. The PLC only reads its state.

      Every value, window, time and fault on this panel is a simulated example, not data from a real line.

      Your design choices

      These are choices you make in your own station program. They are explained below.

      Example recipes

      VariantProgramWeight, kgForce, kNDistance, mmPress, bar
      A34.80 to 5.208 to 12119.5 to 120.56.0
      B53.40 to 3.706 to 996.5 to 97.54.5
      C46.10 to 6.5010 to 13142.0 to 143.05.5

      Example values for this simulator. A and B follow the examples of the case study: the windows of A, program 3 at 6.0 V for line A and program 5 at 4.5 V for line B, with a 0-10 V set point for 0-10 bar. The case calls them lines; here they are recipes of one station. Timeouts: START to BUSY 2 s, BUSY to DONE 10 s, DONE off 1 s, clamp 2 s, press stroke 1.5 s. Your windows come from your drawings and your process.

      Station record

      ntimevariantprogramweight, kgforce, kNdistance, mmrobotresultreason

      One row per part. Your PLC writes the row to its microSD card with the time of its real-time clock, and sends it to the Panel PC over Ethernet. NOT RUN means the value was not measured. It is not an OK.

      What does the station do with each part?

      The PLC runs the same seven steps on every part. The part goes on only when its weight, its peak force and its height are all in their windows.

      1. Part. A sensor sees the part at the stopper. The PLC waits for the robot READY signal.
      2. Weigh. The part rests free on the scale. The PLC waits 0.5 s for it to settle, reads the load cell and compares the weight with its window. A wrong weight often means a missing or wrong component. The PLC then skips the clamp, the robot and the press, so no insert goes into a bad part.
      3. Clamp. The PLC closes the clamp and waits for the clamp closed sensor, 2 s at most. The scale has mechanical overload stops. When the clamp closes, the part rests on the stops, so the press force goes into the frame and not into the load cell.
      4. Robot. The PLC sends the program number of the variant and starts the robot. The robot places the insert and answers DONE.
      5. Press. The PLC sets the pressure of a proportional valve with an analog output and presses the insert in. It keeps the highest force until the ram reaches the press down sensor, just above the seated position.
      6. Distance. The press goes up. A laser measures a distance on the assembly, the height of the insert above the base, which shows if the insert is fully seated.
      7. Result. OK opens the stopper to the next station. NOK opens the reject gate to the NOK lane. The PLC counts the part, writes its record and sends it to the Panel PC.

      Run the Out of the window scenario and compare each NOK with the reason in the record.

      How do the PLC and the robot hand over a cycle?

      With a handshake: each side answers every change of the other side before the next step. The robot program runs in the robot controller. The PLC only says which program to run and when, and waits for the answers.

      1. The robot shows READY: it is in automatic mode and has no fault.
      2. The PLC puts the program number on three outputs, plus a parity bit, and waits 100 ms so that every contact is stable.
      3. The PLC switches START on and keeps it on.
      4. The robot reads the program and answers BUSY. If BUSY does not come within 2 s, the PLC removes START and stops with a fault.
      5. The robot places the insert, then switches BUSY off and DONE on. If DONE does not come within 10 s of BUSY, the PLC stops with a robot cycle timeout.
      6. The PLC sees DONE and removes START and the program. The robot sees START off and removes DONE. The handshake is closed, and the next cycle can start. If DONE stays on more than 1 s after START goes off, the PLC stops with a handshake fault.

      The trace in the panel shows the last 15 s of these signals. Each change on one side has an answer on the other side.

      With a fixed START pulse, the PLC does not know if the robot saw it. If the robot reaches its wait point late, the pulse is already over and the cycle does not start. Run the Robot timeouts scenario with a 300 ms pulse and watch part 1.

      How does the PLC turn a 0-10 V signal into OK or NOK?

      It converts the counts of the analog input into kg, kN or mm, and compares the value with a minimum and a maximum. The analog inputs of the M-Duino 38R read 0 to 10 V with 10 bits, so 1 count is about 9.8 mV. The panel shows the volts and the counts next to each value.

      • Weight: a load cell gives a few millivolts. A weighing transmitter turns them into 0-10 V. In the example, 0-10 V is 0-10 kg, so 1 count is about 10 g.
      • Peak force: a force sensor on the press ram, with its amplifier, gives 0-10 V for 0-20 kN. The PLC keeps the highest force until the ram reaches the press down sensor, set just above the seated position. After that, the cylinder stops against the part and pushes with pressure × area, the same on every part, so that force does not tell a good fit from a bad one. If the ram does not reach the sensor in time, the insert is jammed.
      • Distance: a laser distance sensor gives 0-10 V for 50-150 mm. 1 count is about 0.1 mm, enough for a window of ±0.5 mm. For tighter windows, use a sensor with a shorter range or a digital output, for example RS-485.

      Each value gets a settling time and an average. Vibration from the conveyor, the robot and the press reaches the scale, and one reading can put a good part out of its window. In the simulator, the PLC takes one sample every 20 ms, so 16 samples take about 0.3 s. Set Samples per reading to 1 sample and let the station run: some good parts near the edge of a window become NOK.

      With 0-10 V, a broken wire also reads 0 V. The PLC treats 0 V with a part on the scale as a sensor fault, not as a light part. A 4-20 mA transmitter shows a broken wire as less than 4 mA.

      The peak force does not show the whole press-fit curve. If you must check the force against the position, a press-fit monitor does it, and the PLC reads its OK or NOK signal.

      What should the PLC do when the robot does not answer?

      Stop in a known state: remove START and the program, keep the part clamped, show the fault and wait for the operator. What comes next depends on whether the robot has touched the part.

      • No BUSY after START: the robot has not moved. After the reset, the PLC repeats the robot step on the same part.
      • Robot FAULT before BUSY, for example a parity error: the robot has not moved either. The PLC repeats the robot step after the reset.
      • Robot FAULT during the cycle, or no DONE within 10 s: the insert may be half placed. The PLC marks the part NOK and sends a RESET pulse to the robot with the operator reset. It waits for READY, with the robot back home, before it opens the clamp and moves the part.

      Set each timeout longer than the slowest normal answer, with a margin. In the example, the slowest robot cycle takes 3.4 s and the timeout is 10 s.

      The handshake is process logic. The safety of people is not in this program. Guards, light curtains and the robot safety functions go to a safety relay or a safety controller, designed to ISO 10218-2 and ISO 13849-1. That circuit stops the robot through its safety inputs and removes the air from the press with a safety exhaust valve, without going through the PLC relays. The emergency stop does not depend on the PLC program (IEC 60204-1, ISO 13850). The PLC reads the state of the safety circuit on one input and stops the sequence. It does not replace it. See how a PLC reads the state of interlocks and the e-stop.

      Run the Robot faults scenario to see a fault during the cycle and a parity error.

      Design choices you make

      1. A held START or a START pulse

      A held START waits for the robot. A late robot still sees the request, and the robot drops DONE only after the PLC drops START, so neither side misses a change. A pulse is simpler, but it works only if the robot is always waiting when the pulse comes.

      2. A parity bit on the program number

      A program number on relay contacts can be wrong if one contact does not close. With three bits, an open bit 0 turns program 3 into 2 and program 5 into 4. Program 4 is a valid program: only the parity bit shows that the number is wrong. Program 4 itself does not use bit 0, so the fault stays hidden until a recipe needs that bit. A reset does not repair the relay: the fault comes back on every part that uses bit 0. With an even parity bit, the robot sees a wrong number and does not move. Another way is a program echo: the robot sends the number back and the PLC compares it before START. That needs three more inputs. A fieldbus between the PLC and the robot controller also removes the wire for each bit.

      3. When the station stops

      One NOK part is a part problem. Several NOK parts in a row often point to the process: a worn press tool, a wrong batch of inserts, a sensor that has moved. A stop after 3 NOK in a row keeps the station from filling the NOK lane. You choose the number, or you stop on the NOK rate of the last parts.

      4. Where the recipes live

      The windows, the program number and the pressure of each variant can stay in the PLC program, or come from the Panel PC with each order. Keep the variant in each record, so you can trace which windows judged which part.

      5. Relay outputs for the handshake

      The M-Duino 38R has 16 relay outputs. They suit signals that change a few times per cycle, such as START, the program bits and the valves. A relay contact is potential free, so it can feed a 24 V input of the robot controller from the robot supply. For valve coils, add a suppressor sized for the coil, such as an RC snubber. Count the operations: with one cycle every 10 s, START switches about 3 million times a year. Check the electrical life of the relays in the user guide against your cycle, or exchange the program and the status over a fieldbus (see the FAQ). Keep the robot signals on relays whose common is not shared with the valves.

      The case study behind this simulator

      This simulator goes with our case study on an automotive production line run by an M-Duino 38R. The case describes the line: stations that weigh, measure and press, robots and arms that get orders from the PLC, and a Panel PC with MQTT and Node-RED where people manage it. This simulator zooms into one station and its robot handshake.

      Read the automotive production line case study

      What you see here is a general pattern. The variants, windows, programs, times and faults are examples, not data from that line.

      To watch a whole line over MQTT, with stops and alarms, try the Machine Monitor simulator.

      To test each finished unit at the end of the line, see the end-of-line test simulator.

      Learn the building blocks

      These tutorials and examples cover the parts of this station on an Arduino based PLC.

      More examples: PLC Solution Library · all simulators.

      M-Duino 38R: the specs that matter here

      Inputs12: 8 analog/digital (0-10 V, 10-bit) and 4 digital optoisolated (5 to 24 Vdc), 4 with interrupt
      Outputs22: 16 relays (230 Vac 4 A / 24 Vdc 2 A, resistive) and 6 analog/digital/PWM (0-10 V, 8-bit)
      CommunicationEthernet W5500 10/100 Mbit (RJ45), RS-485, RS-232, TTL serial, I2C, SPI
      Built inReal-time clock, microSD slot, USB 2.0 Type-B
      ControllerArduino Mega 2560 (ATmega2560, 16 MHz)
      Power supply12 to 24 Vdc, with fuse (2.5 A) and polarity protection
      Environment0 to 60 °C, 10 to 90 % humidity without condensation
      MountingDIN rail TS35, IP20, inside a cabinet
      ProgrammingArduino IDE with the Industrial Shields boards package

      Example I/O for this station

      SignalPLC I/OCount
      Robot READY, BUSY, DONE and FAULTDigital inputs, optoisolated4
      Weight, force and distance, from 0-10 V transmittersAnalog inputs3
      Part present, clamp closed, press up, press down, safety circuit OK (status only)Analog/digital inputs used as digital5
      Program bits 0 to 2, parity, START, robot RESETRelay outputs6
      Clamp valve, press valve, stopper, reject gateRelay outputs4
      Tower lamp: green, amber, redRelay outputs3
      Pressure set point to a proportional valveAnalog output, 0-10 V1
      Panel PC: recipes, records, operator resetEthernet1

      This example uses all 12 inputs, 13 of the 16 relays and 1 of the 6 analog outputs. The robot signals go to the optoisolated inputs because they come from another controller with its own supply. The family datasheet gives 0 to 24 Vdc for the analog/digital inputs in digital mode, so 24 V sensors can connect there. The analog output has 8 bits: on a 0-10 bar valve, one step is about 0.04 bar. For more signals, choose a larger M-Duino or add a second PLC on Ethernet. Check your loads and levels against the M-Duino family datasheet. Full specs: M-Duino 38R · M-Duino family.

      FAQ

      What should the PLC do when the robot does not answer START?

      Remove START and the program number, keep the part clamped and stop with a fault. The robot has not moved, so after the operator reset the PLC can repeat the robot step on the same part. Use a timeout longer than the slowest normal answer of your robot, for example 2 s.

      Why hold START until DONE instead of sending a pulse?

      With a held START, each side answers every change of the other side. A pulse can end before the robot reaches its wait point, and then the robot does not start. A held START is still there when a late robot arrives. The robot drops DONE only after the PLC drops START, so the PLC does not miss DONE either.

      Why send a parity bit with the program number?

      To catch a wrong number before the robot moves. If one relay contact does not close, the robot reads another program. With an even parity bit, the robot sees that the number is wrong and goes to fault. Some faults stay hidden: an open bit 0 does not change program 4, so test every bit when you commission the station. A reset does not repair the relay.

      Why does the station skip the robot when the weight is out of the window?

      A wrong weight usually means a missing or wrong component. Pressing an insert into that part wastes the insert and a robot cycle, and the part is NOK anyway. The record shows the force and the distance as not run.

      Why does the PLC stop judging the force at the press down sensor?

      Because after that point a pneumatic press pushes with pressure × area on every part. When the insert is seated, the cylinder stops against the part and the force rises to that value, good fit or not. The useful force is the one before the seated position: too low means a loose insert. An insert that jams never reaches the sensor, so the PLC uses a stroke timeout to catch it.

      How many samples should the PLC average before it compares a value?

      Enough to remove the noise of the conveyor and the scale, and few enough to keep the cycle time. In the simulator, the PLC takes one sample every 20 ms, so 16 samples take about 0.3 s after a settling time of 0.5 s. Compare the result with 1 sample: some good parts near the limit become NOK.

      Can the M-Duino 38R talk to the robot over a fieldbus instead of wires?

      The M-Duino 38R has Ethernet, RS-485 and RS-232, and the Industrial Shields libraries for Modbus TCP and Modbus RTU. If your robot controller accepts Modbus TCP or Modbus RTU, the PLC can exchange the program number and the status as registers. Many robot controllers use other fieldbuses, such as PROFINET or EtherNet/IP, so check the options of your controller. The handshake logic stays the same.

      Do I need to write the station program myself?

      The program is written in C++ with the Arduino IDE. The building blocks, such as analog inputs, relay outputs, the SD card and MQTT, have public tutorials, linked above. An integrator can also write the program from your description of the station.

      Send me this architecture

      Tell us what your stations measure, which robots they command and how many variants you run. Our team replies with a proposed architecture for your line. Your simulator settings go with the request.