Sort by Color Conveyor System

I made this video for one of my colleagues at school to demonstrate how one of our Actual Lab Training Conveyors can be Simulated using Factoryio. This Simulation uses both Part Present Sensors and a Pulse Counter as an Encoder to determine where the box is as it is transported along the conveyor. The chosen conveyor speed minimizes the affect the processing and communication delays, however, a second video will be posted with a faster, and therefore more difficult to control, conveyor.

Here are my files for Rockwell PLC. I’ve also included a PDF of the program in case you do not use Rockwell so you can convert to another platform. The program provided is a bit improved from the one I show in the video. Rejects have been accounted for, conveyor speed adjustment has a finer increment and bins will accumulate up to 5 parts before the remover is turned on allowing students time to observe the results.

Sort by Color - (1.7 MB)

Here are my files for Control IO. Again, I have also include the PDF (one and two page version) of the code. I may add notes and repost since Control IO is a bit more difficult to follow than the PLC version.

Sort by Color - Control (1.2 MB)

Note: for the Control IO to work correctly, go to Control IO settings and uncheck the option “Sync Factory I/O”. The code must be running when the Factory is not so the proper reset can occur.


@wayneschaefer Great content. Thanks for sharing :+1:

1 Like

It was the first time I used Control IO and found it to be fairly easy to learn and implement. I am sure the code can be refined bit but I think I got most issues resolved. Can you provide some guidance as to how Control IO scans? The code should be fairly scan tolerant but there is a minor glitch that occurs in my coding that is probably due to the difference between ladder and flow chart style programming. The Siemens Logo has the same issue and programming techniques must be adjusted accordingly.

Hi Wayne,
There is no set order for Control I/O execution, the position of nodes in the diagram is completely independent from its execution order.
The only guarantee is that, between nodes that are linked together, the ones to the left are executed first.

Currently the way it works is:
First are executed all nodes that have no inputs (in no set order).
Then, for nodes that are linked together in a chain, execution starts from left to right.
Among separated chains of nodes the longest ones start executing first.

1 Like

Thanks for the quick reply … I tried to program the charts in a way that was independent of execution. Most of my ladder is not order dependent either but there is the odd time (on real machines) that execution does matter but I avoid it as much as possible. I learned the hard way when I was programming with the Siemens Logo since it does not follow the same rules as a standard PLC. The Control IO worked pretty nicely … I like being able to show Factoryio as a stand alone package.

1 Like