rPLC Home rPLC

    How to build a sorting machine

    Step by step process of building an open source and open hardware line sorting machine.
    • Last Update:2024-09-26
    • Version:003
    • 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 edge pod server
    • Configure rPLC coupler using SlapOS
    • Configure Edge Pod server using SlapOS
    • Configure DNS names of the rPLC coupler and Edge Pod
    • Start and stop machine using SlapOS

    Requirements

    • A rPLC coupler (and their power supplies)
    • A simple line conveyor (and its power supply)
    • An edge pod server
    • A solenoid and a 12VDC PSU
    • a 3D printer
    • a USB keyboard and a mouse
    • a USB camera
    • a USB camera magnetic stand
    • 12-16 (3.5mm x 20 mm) screws
    • basic assembly skills

    Goal

    This how to explains how to build yourself a line sorting machine. This machine is able to sort objects by shape using advanced optical inspection algorithms. The tutorial describes a semi automated approach in which a person manually switches the line conveyor. This is done intentionally for simplicity sake. A fully automated approach requires a deeper electrical skills which is outside the scope of this tutorial.

     

    Picture 1: a finished line conveyor

    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.
    2. Edge Pod server
    3. Line conveyor
    4. A solenoid
    5. A 12VDC, 1A power supply unit for the solenoid
    6. an USB camera
    7. an USB camera magnetic stand

    Print with 3D printer needed components

    Print primitive shapes used for test

    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 repective models

    Print line parts

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

    • front aligner left (part A, 1 piece) (.stl, .gcode)
    • front aligner right (part B, 1 piece) (.stl, .gcode)
    • solenoid separator (part C, 1 piece) (.stl, .gcode)
    • back aligner left (part D, 1 piece) (.stl, .gcode)
    • conveyor belt leg (part E, 2 pieces) (.stl, .gcode)

    Assemble components of the machine

    Step 1: Put support legs (part E) on conveyor line

    You need to attach the already printed conveyor belt support legs (part E) to the bottom of the conveyor so that conveyor is in a horizontal position. For each leg use 2 screws (3.5mm x 20 mm) and attached as seen on the picture below.

    Picture 2: Mount support legs

    Step 2: Assemble front aligners

    You need to attached to conveyor front aligners (part A and part B) using 4 screws (3.5mm x 20 mm). See Picture 3.

    Picture 3: Conveyor mounting

    Step 3: Assemble and mount solenoid stand

    You need to first attached the solenoid to part C using the packaged solenoid's connecting nut. Then mount using 2 screws (3.5mm x 20 mm) to the conveyor. See Picture 3.

    Step 4: Assemble back aligner

    You need to attached to conveyor belt the back aligner (part D) using 2 screws (3.5mm x 20 mm). See Picture 3.

    Step 5: Place camera

    There are various ways to place a camera on top of the conveyor. One may use a camera tripod or as seen in Picture 4 a magnetic instruments stand to which a camera is attached. What is important is that the camera is placed in a such way that it can access visually the area just in front of the solenoid.

    Picture 4: Camera mount.

    Connect electrical components and start rPLC coupler and edge pod server

    Step 1: Connect solenoid to rPLC coupler (relay 1) and its power supply unit

    You need to connect the solenoid, its power supply unit and rPLC coupler (to relay1). The diagram is visible in picture 5.

    Picture 5: Solenoid wiring diagram.

    Optionally: if in your setup you want to control the conveyor belt from your PLC program (respectively turn it ON / OFF) then you need to connect to relay0 as it can be seen on Picture 5.

    Step 2: Connect the PSUs of the rPLC coupler

    You need to power up the  rPLC coupler and its MOD-IO device. Please take care to use 5VDC for rPLC coupler and 12VDC for MOD-IO. Please make sure that you can access over ssh the rPLC coupler.

    Step 3: Connect USB camera to edge pod server

    Plug in the USB camera cable to any of the edge pod server's USB ports.

    Step 4: Start edge pod server

    Please start the server and make sure you can ssh into it.

    Configure rPLC coupler using SlapOS

    The configuration of rPLC coupler is well described in generic tutorials. It consists of these three steps:

    At end of these tutorials you will have a general purpose rPLC coupler managed by SlapOS which you can use in any PLC setup.

    Configure Edge Pod server using SlapOS

    The configuration of the Edge Pod server assumes that you already have an operating system on the Edge Pod Please follow tutorial below:

    Configure DNS names of the rPLC coupler and Edge Pod

    As all machines needs to communicate to each other and be controlled by Beremiz runtime running at Edge Pod server following adjustments in /etc/hosts at Edge Pod are needed to be added. Please note that you have to adjust the IPv4 addresses based on the ones given to machine running oi-sensor and oi-coupler (i.e. the rPLC coupler). Please also note that this step is ONLY needed to be done once and ONLY for Edge Pod.

    192.168.0.139           oi-sensor
    192.168.0.121           oi-coupler

    Start and stop machine using SlapOS

    Starting and stopping processes happens using ¨slapos node¨ command. Below you see an example output of the processes run at Edge Pod.

    Below you see the output at oi-coupler machine (rPLC coupler).

    To start a process following command can be used: slapos node start <name_of_service>

    To stop a process following command can be used: slapos node stop <name_of_service>