Factorio: Recycler Belt Stacking

Circuit logic in Factorio is pretty annoying to deal with, tbh. I really wish there was a way to deterministically configure circuits with expressions. Alas, here we are.

In this post, I’ll walk through a solution to using a recycler in Factorio with a stack inserter without it jamming. There are definitely other approaches, but this is the one that worked for me.

There's a blueprint string at the end if you'd like it.

Recycling Junk

Recyclers are unlocked on Fulgora and although their primary use is for recycling Scrap into the 12 output products, this is not their only use. We can also use Recyclers to upcycle items quality.

The standard scrap recycling recipe in Factorio

Quality brings 5 tiers of items to the game, each with increasingly powerful stats. Thus, even a simple Scrap recycling recipe can potentially have 60 product possibilities. Upcycling only excerbates the number of possible output products.

A simple quality upcycling example

This is a problem for stack inserters, which only swing when they have a full stack of 16 items. If a machine is outputting just 1 or 2 of something, the inserter won’t clear its output until it reaches 16 - or as we sometimes refer to it, it will jam. If you’re dealing with mixed outputs or qualities and not using filters, you’re going to have a bad time.

So we need a way to buffer items until there are 16 of a kind, and dynamically set the inserter’s filters so it only picks up items that have reached that threshold.

Circuit City

To make this next section easier to visualise I'm using the mod [Circuit Visualizer](https://mods.factorio.com/mod/circuit_visualizer).

First, we need a way to buffer items until we have a full stack of them. For this, we use chests. Place one at the output of your Recycler.

Next, we must count the items in the chests. For this, we use an arithmetic combinator and red wires linking every chest to the combinators input.

Hook up a red wire to every chest and connect it to the input of the Arithmetic combinator

Configure the Arithmetic combinator to output a signal of value 1 for each item present in the chests. Conditions should be EACH > 0 and Outputs EACH 1.

Arithmetic combinator configuration.

We can think of the Arithmetic combinator like an if statement. If an item is present in any quantity greater than 0, then output a signal via the combinators output.

Connecting the Arithmetic output to the Deciders input via a Green Wire

Now hook up the output of the Arithmetic combinator using a green wire (colour is important) the input of a Decider combinator.

We must also hook up every Stack Inserter via a red wire to the output of the Decider.

Configure the Decider like so: INPUT -> EACH - 16 / OUTPUT EACH.

The job of the decider combinator is to subtract 16 from every signal that comes in thus creating an index of available items to filter. By sending this signal out as -15 we can then compare the contents of the chest to this value and only once it is 16+ (a full load) does the Stack inserters filter become set.

The Stack Inserter should be configured like so

The final piece here is hook up a green wire from the chests to each Stack inserter, one by one. Then configure the Stack Inserter to ENABLE/DISABLE when ANYTHING > 2 and SET FILTERS is checked. The Stack Inserter reads the filters from the circuit network. Do not link these down the line as you have the chests or inserters previously.

Hook up a single green wire connecting the chest to the Stack Inserter

Sit back, and relax

Now sit back and watch the fruits of your hard work.

The final result

When the chest contains 17 of something then it's OK to swing. The chest contains multiple tiers of quality items and scales as far as I have been able to test to infinite number of items.

The only real downside is that this won't work in space because you can't place chests there.

Here's a blueprint string for you to try it out yourself - I'm in the blueprint sandboxes mod for all of these screenshots.

0eNrlWNuSoyoU/ReecUrwEk3VnB/pSlmopEONogcx56S6/PfZqNF0Yroxvs08RTew1mbti5APlBYtr5WQGu0/kMgq2aD92wdqxLtkhbFJVnK0R4pnl6zgCnUYCZnz/9GedHhhom5VWjlaMdnUldJOygt9s4h2B4y41EILPlD1L5dEtmUK8HuCv0TCqK4aWFxJwwmAjkd2PwKMLmgfBj8CYMoFODvMiIyLdwR0A4FvQ+BNBI1m2S9HyIYrDSNL0OFTaH8B2p+ghTwKCUNOduLNstfBZ+jriqThWgv53piZipfVmSctjBXgIs8ToXkJQ0dWNByjwTwEamSuC9ZokTkpMzvKqtbkDnFdjMoqNxOYdgrOeqemTDl0C7sJpt0wJfSp5AY2q8pUSKarZb3cKdadIZdaVUWS8hM7C1gB02aoBIbzfnm/1aNQjU7mfNWX2lCfhdItWOag9TMczrKTyduGGxiDBdHstxpiVNVcscEx5MDSqtV1uxq8WxIlnObmPBM5V98pQr5TZMS5k+P27e1ldcC3mqnetz36B5niHrS4byPWePUl6XMqOaqqTIQErDEbTRItCLbbUM87m3qONhCENgTxSw3jAZrQBWzi4ocWvgTrj4Lc9SAo4aEfQDBFftPm/4UomvYDNd8W3PH6Fj9MhZkSAncGTyp1GZbObwDZ7xLtXePu4gh5OkKfjngmPQ5LCpA18rpfyLtcXplQWSt0wiVLCw4aadVC57yapzp7oQcxedEnaNVD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