rPLC Home rPLC

    How to build an optical inspection sorting machine

    Step by step process of building an open source and open hardware line sorting machine.
    • Last Update:2025-11-06
    • Version:007
    • Language:en

    Agenda

    • Purchase required hardware
    • Print with 3D printer needed components
    • Assemble components of the machine
    • Connect electrical components and start rPLC coupler and ORS
    • Configure rPLC coupler using Rapid.Space
    • Configure ORS using Rapid.Space
    • Configure DNS names of the rPLC coupler and ORS
    • Start and stop servers using Rapid.Space

    Goal

    This how to explains how to build yourself an optical inspection line sorting machine. This machine is able to sort objects by shape using advanced optical inspection algorithms. It is to be controlled by 5G ORS (Open Radio station) by Nexedi which itself can provide 5G network.

     

    Picture 1: a finished line conveyor with a controller (the 5G ORS station at left).

    Video 2: a real machine doing a selection (removing from line cylinders and leaving untouched kubes and triangles).

    Purchase required hardware

    Purchase list

    1. rPLC coupler or build it yourself following tutorial here (1 piece)
    2. ORS (1 piece)
    3. Line conveyor (length: 460mm) (1 piece)
    4. A 12VDC push solenoid (18W) (1 piece)
    5. A 5VDC proximity sensor (1 piece)
    6. 20 mm by 20 mm V-slot (3 x 500mm length)
    7. M5 T-slot nuts (20+ pieces)
    8. M5x10 mm (20 pieces) and M5x12mm (6 pieces) bolts
    9. Adjustable legs for 2020 (4 pieces)
    10. 5 Hole Joint Board Plate Corner Angle Bracket (3 pieces)
    11. USB camera (1 piece)
    12. Magnetic stand holder for equipment (1 piece)
    13. A mounting of optical axis fixed support (1 piece, hole diamater; 12 mm)
    14. IP 67 plastic box (minimal dimensions: height: 100mm, width: 240mm, width: 200mm)
    15. 220VAC to 5VDC DIN rail mountable power converter (Model: Meanwell DDR-15G-5, 1 piece)
    16. 220VAC to 12VDC DIN rail mountable power converter (Model: ESPE ESPE-HDN1512, 1 piece)
    17. 220VAC to 24VDC DIN rail mountable power converter (Model: Meanwell DDR-15G-5, 1 piece)
    18. Automatic switch DIN rail mountable 2A (Model: HDR-30-24 VDB3-63/1P ,1 piece)
    19. Few meters of various cables (multi core) with 1 x 0.75mm  for inside electrical connections
    20. Standard center-positive (2.1x5.5mm) male barrel jack (2 pieces)
    21. DIN rail (500mm)
    22. Rail mount terminal blocks (1 piece)
    23. Cable Gland (М12х1.5, ф12mm, IP66, Scame, 805.5412 - 3 pieces)
    24. Cable Gland (25mm/M25x1.5, IP66, SCAME 805.5425 - 1 piece)
    25. Quick wire connectors (PCT-222, 2 pieces)
    26. Bolts and nuts (M3x10mm, 4 pieces)
    27. A 10 ml tube of threadlocker glue

    Print with 3D printer needed components

    Print primitive shapes used for testing the oi-line

    We need to print the basic shapes which will be used to do selections on the real machine. The default PLC program is configured to remove from line ONLY cylinders and leave triangles and rectangles. Thus it is required to print these shapes from respective models

    Print line parts

    We need to print 4 parts which later needs to be mounted on the conveyor as follows

    Recommended 3D printer settings:

    1. Material: PLA (preferred)
    2. Nozzle: 0.4 mm
    3. Infill Density: minimum 50%
    4. Support : Yes
    5. Shell thickness: 0.8 - 1.0 mm

    Assemble components of the machine

    Step 1.1: Cut v-rail

    Please cut two v-rails with a length of 400 mm each.

    Step 1.2: Attach the 4 legs to the v-rails

    Please connect the first leg to the v-rail using two t-nuts and two M5x10mm bolts and screw the M8 leg inside as visible on the picture below. Do again for the other leg. Each leg should be 20 mm from end of the rail.

    At the end you should have following v-rail. Please do make repeat the process one more time.

    Step 1.3: Drill the mount holes of the conveyor belt

    Please drill two mounting holes ("Hole 1" and "Hole 2") for each side of the conveyor belt with 5 mm drill. The 4 holes will be used for mounting the v-rails to.

    Step 1.4: Connect the v-rails to the conveyor belt

    Connect left and side v-rail to conveyor belt using already drilled holes in previous step using a t-nut and M5x10mm bolt. You should see this after it is done.

    Step 1.5: Mount front aligner left to v-rail (left one)

    Please connect with t-nut and M5x10mm bolt the front left aligner to the left v-rail (50 mm from the start of the v-rail) as shown below.

    Step 1.6: Mount front aligner right to v-rail (right one)

    Please connect with t-nut and M5x10mm bolt the front right aligner to the right v-rail (50 mm from the start of the v-rail) as shown below.

    Step 1.7: Mount the proximity sensor stand and proximity sensor to v-rail (right one)

    Please mount first the proximity sensor stand to the v-rail (right) using t-nut and M5x10mm bolt. And only after that connect using the supplied rings to proximity sensor to its stand. The final setup can be seen below:

    The detailed setup picture of proximity sensor stand and proximity sensor can be seen on the following image:

    Step 1.8: Connect solenoid stand with spring and solenoid lever together

    Place the solenoid and tighten it with its nut in the solenoid stand. Then let its cable go through the designated hole just above it. Following image shows it:

    Attach with two bolts the lever and place the spring inside as show in the following picture. After proper testing you can apply a thread locker glue on top of the bolts so that they do not unscrew.

    Step 1.9: Mount already bundled together solenoid stand to v-rail (right one)

    Using t-nuts and two M5x12mm bolts attach to the v-rail (right) the already assembled solenoid stand as shown below.

    A more detailed view from above can be seen below:

    Step 1.10: Drill hole for the camera stand

    Please drill with 6mm drill a whole in the USB camera holder. In the middle of the metal plate.

    Step 1.11: Connect camera  to its stand

    Please connect the camera to the stand using the stand's own bolt into the previously drilled hole. Finally attach the alluminium block which will be used for mounting to the v-rail.

    Step 1.12: Attach camera and its stand to the right v-rail.

    Finally the whole assembly should look like this.

    Step 1.13: Attach the two collect boxes

    Attach the two collect boxes to the left side v-rail using t-shape nuts.

    Step 1.14: Attach the back aligner

    Attach the back aligner using t-shape nuts.

    Step 1.15: Level the oi-line machine using legs' blocking nuts

    Please place the machine into a leveled and flat surface. Then using a 13mm wrench adjust the heights of the 4 legs so the conveyor belt is horizontal.

    Prepare plastic box

    Step 2.1: Cut v-rails

    Please cut the 20 x 20 mm v-rail with to length of 250 mm. We need two pieces.

    Step 2.2: Drill holes in the plastic box and attach v-rails to the plastic box

    Please drill two holes with 6 mm drill at back of the plastic box. Using M5x10mm attach the v-rails to the plastic box how can be seen from following images:

    Front

    And back

    Step 2.3: Drill holes for incoming power cable and outgoing cables

    Please drill 4 holes for mounting holes as visible with dimensions on the following image:

    Then attach accordingly cable connectors like so:

    Step 2.4: Attach DIN rails to back (inside) plastic box

    Please attach as follows the two DIN rails (each 180 mm long)

    Connect electrical components inside the plastic box

    Step 3.1: Attach main surge protection (2A)

    NOTE: Always work with main power cable detached from power grid!!!

    Please insert the main power cable through the bottom hole (12mm) and make sure it is properly secured through the mounting holes. Then unstrip the power cable which should have 3 sub cables. These three sub cables should be attached as follow (can be seen on picture below):

    • Blue (Ground earth) should be attached to the first DIN rail
    • Blue (Neutral) should go as IN for the automatic surge protection relay (2A)
    • Brown (L1) should come as IN for the DIN rail electrical mount

    Step 3.3: Attach 220VAC -> 24VDC  and 220VAC -> 12VDC converters and power it from main line

    NOTE: Always work with main power cable detached from power grid!!!

    Place the 220VAC -> 24VDC  and 220VAC -> 12VDC converters onto the second DIN rail and power them from automatic DIN rail surge protection and DIN rail power line stand as shown in following picture.

    As it is easier from cable management point of view you can power the 12VDC converted directly from the 24VDC converted using so called bridge cables.

    Step 3.4: Attach 24VDC -> 5VDC. Prepare 5VDC & 12VDC power cables and barrels for powering of rPLC coupler

    Please connect OUT of 24VDC to IN of 5VDC keeping in mind polarity as shown below.
    Keeping in mind polarity please prepare two cables. One connected to 5VDC power in of rPLC and the one connected to 12VDC power in.

    Step 3.5: Place rPLC coupler and power it

    Please the box for rPLC coupler on the DIN rail bus as shown below.

     

    Connect plastic box with conveyor belt, solenoid, proximity sensor, camera and network connectivity

    Step 4.1: Connect camera

    Please connect the external USB camera to one of the 2 USB ports of the rPLC coupler. You can use one of the already drilled holes.

    Step 4.2: Connect network

    Please connect the LAN (RJ 45) cable to the rPLC coupler. You can use one of the already drilled holes.

    Step 4.3: Connect conveyor belt

    Please create a electrical circuit which starts from OUT of 24VDC, goes through REL1 (relay of MOD-IO) and powers up the conveyor belt.

    Step 4.4: Connect solenoid

    Please create a electrical circuit which starts from OUT of 12VDC, goes through REL2 (relay of MOD-IO) and powers up the solenoid.

    Step 4.5: Connect proximity sensor

    Please insert cable for proximity sensor using the already drilled holes in previous steps. Please power the proximity sensor's Gnd (ground) and Vcc (voltage_ directly from the 5VDC power converter. Please insert Gnd from your 5VDC into IN1 (analog input 1, left on picture below) of MOD-IO and the Signal cable from proximity sensor into IN1 (analog input 1, right on picture below).

    Following video might help connecting the proximity sensor.

    Step 4.6: Close the plastic box

    Please put the plastic cover of the box using designated screws.

    Success

    At the end you should have built successfully an oi-line.