Today, let’s get straight to the point and discuss how to build a color sorting system using a PLC. Last month, I helped a beverage bottle recycling factory with a similar project, and the workshop technician said it was more than three times more stable than their previous system built with a microcontroller (and it saved 20% in power consumption). The core of the system boils down to two points: color recognition accuracy and pneumatic response speed. Let’s break it down step by step.
1. Key Points of Hardware Configuration (Highest Cost-Effectiveness Solution)
My recommended configuration:
- • Reflective photoelectric sensor (Omron E3Z series) for color recognition
- • Mitsubishi FX3U PLC (transistor output type)
- • Two-position three-way solenoid valve to control the pneumatic actuator
- • AIRTAC air pump (0.6MPa working pressure)
Wiring Diagram Key Points: Sensor brown → 24V+, blue → 0V, black → PLC X0 (signal line) Solenoid valve coil → PLC Y0 (red sorting), Y1 (blue sorting), Y2 (spare)
Note! The sensor should be installed at a distance of 30±5mm from the surface of the object, and the air circuit must include a three-piece unit (filter + pressure regulator + lubricator)
2. Core Logic of Programming (Ladder Diagram Example)
Action flow breakdown:
- 1. The sensor detects that the object is in position (X1=ON)
- 2. The color sensor outputs a signal (red object X0=ON, blue X0=OFF)
- 3. The PLC triggers the corresponding solenoid valve based on the X0 state
- 4. The actuator automatically resets after action
Key Program Segments (Mitsubishi instructions):
|--[PLS X1]--|--[MOV K1 D0]--| // Object in position pulse signal
|--[LD X0]----|--[SET Y0]-------| // Red channel action
|--[LDI X0]---|--[SET Y1]-------| // Blue channel action
|--[T0 K20]---|--[RST Y0]-------| // Reset actuator after 2 seconds
|--[T1 K20]---|--[RST Y1]-------|
Essential Protection Programs:
- • Add interlock between Y0 and Y1 (to prevent simultaneous action)
- • Monitor the air pump operating status (to prevent operation under low pressure)
- • Action count counter (to prevent material jams)
3. On-Site Debugging Hard Lessons
Three pitfalls I encountered while debugging in Dongguan last year:
- 1. Environmental light interference: LED lights in the workshop caused the sensor to misjudge → Solution: Cover the sensor with a black corrugated tube
- 2. Air circuit delay: The actuator action was 0.3 seconds slower than the program → Changed the air pipe from Φ6 to Φ8, and the response was immediately normal
- 3. Signal jitter: Vibration of the conveyor belt caused X1 to trigger incorrectly → Parallel connect a 104 capacitor at the PLC input
Debugging Tools: Use a multimeter’s frequency range to measure the sensor output signal and the PLC’s online monitoring function to check the actual trigger time
4. Safety Precautions (Potential Costly Points)
- 1. The solenoid valve must be connected to a flyback diode (I burned three valves using 1N4007)
- 2. Add a buffer pad at the end of the stroke of the pneumatic actuator (otherwise, the sealing ring will need to be replaced every three months)
- 3. A fuse must be connected in series at the PLC output terminal (my colleague’s Y0 point burned the mainboard due to a short circuit)
- 4. The emergency stop button should be connected in both the input circuit and the output circuit for double protection
5. Directions for Function Upgrades
- 1. Add a fiber optic sensor for secondary verification (to prevent misjudgment of reflective objects)
- 2. Use a high-speed counter module to achieve dynamic sorting (without stopping the conveyor)
- 3. Connect a touch screen via RS485 to display sorting statistics
- 4. Add a pressure alarm function (automatically shut down if below 0.4MPa)
Practical Suggestions: Start with cardboard for sorting experiments (safer than metal parts), and I recommend using Mitsubishi’s GX Works2 software for simulation; just connect an old solenoid valve to practice. Remember, the pneumatic response time = program cycle + solenoid valve response + cylinder action time; this time chain determines your sorting rhythm.
Next time you encounter a color sorting project, follow this approach, and you will surely succeed from hardware selection to programming and debugging. If one day the sensor signal keeps drifting, remember to check the grounding—this was a ghost fault I discovered after three days…