Introduction: Step Conveyor Using Arduino Based PLC
At the company I work, there is a conveyor which carries boxes onto another round 'close loop' conveyor. It pushes box onto the 2nd conveyor based of empty spaces on. Therefore, it doesn't run continuously but rather pushes boxes when it can and stand still for the rest of the time. In other words - it is a step conveyor.
At the beginning of it, there is a part the motors were not connected/wired when the rest of the conveyor was refurbished. It created a great hassle for the employees, especially since it was a curved part which made pushing the boxes harder.
The aim of the project was to created a system with additional sensors and connect the existing (though not connected) motors so the boxes will be pushed forward.
I used Wenglor OPT103 NPN sensors and a FA-duino-12RA PLC which is an Arduino based PLC that is regulated to work in an industrial 24V environment. It has 8 digital inputs and 4 relays as outputs.
Step 1: The Logic
After spending some time looking at the part of the conveyor that was working, the logic was quite clear. A step should push forward on one of two conditions -
- Next position is empty and current position is occupied.
- Current position is empty and previous position is occupied.
A step should stop if next position is occupied as well as current position. In addition, there is a need to stop the motors after sometime even if the stopping condition isn't met. For example, if one loads a single box onto the conveyor, it will move forward without triggering the stop condition. Therefore, a timer is needed as a 2nd stopping condition. The timer as set at 10 seconds. No great reason for that number.
Therefore, to operate each motor there one requires -
- Input boolean from previous sensor
- Input boolean from current sensor
- Input boolean from next sensor
- A timer
In order to use one function for all sensors in an elegant way, two more variables were added -
- Output int for current motor
- Boolean for current motor state
My project controls 3 motors and therefore the functions is called 3 times with the relevant variables.
Step 2: Wiring
Let's break it down to two parts. Sensors and motors.
To wire the NPN sensors I had to add a 5k ohm resistor as a bridge between the output (black) wire and the positive wire. This isn't required for all PLCs but the FA-duino requires it otherwise it won't read the output. (10k as in the instructions does not work).
The motors can simply be wired to the built-in output relays but a friend advised me to used secondary relays for the task and trigger the 2nd set of relays with built-in relays. The reason is the high Amp the motors draw which can overtime destroy the built-in relays.
All in all, pretty straight forward setting.
Step 3: Walla
That is basically it.
Upload the program, wire sensors and motor and turn on the electricity.
The board has been working for about a month now with no problems. Instead of pushing boxes around, employees can simply put them at the entrance and once the first sensors senses them, the PLC takes care of the rest.
This was fun!!