This setup gradually fills a minecart with a chest as items arrive, sends it along track when its inventory is full, empties it at a receiving station, and then sends it back to be filled again.
Based on discussion on the Minecraft forums; thanks especially to Trystanwolf.
A hopper will fill the cart from above. While the cart is being filled, it is held in place by a block on a sticky piston. A not gate with a low input extends the sticky piston. The cart is able to arrive under the block, but cannot slide out again under it.
Filler station awaiting cart arrival:
Filler station, cart just arrived:
A comparator's output increases as the cart is filled.
When the cart is full, the comparator activates 14 sections of redstone; that sets the not gate's input high and thus its output low, which causes the sticky piston to retract.
Transfer the cart's inventory to a chest when the cart arrives, then return the cart when it's empty.
Track ends in a section of powered rail on a hopper; a block is at the end of the track. The hopper feeds into a chest. A comparator reads the status of the hopper and is connected to a not gate, so that the gate's output is high when the hopper is empty. This output is connected back to the powered rail on the hopper (via the block at the end of the track).
When there is no cart present, the comparator circuit is high, and the powered rail is active (but does nothing).
When a cart arrives with some inventory, it feeds items into the hopper, which activates the comparator and deactivates the powered rail. This stops the cart on the hopper. (Note that feeding into a hopper chain does not work, as the first hopper empties too quickly; the first hopper must feed into a chest.)
When the cart empties and subsequently the hopper empties, the comparator's output drops low, the not gate's output goes high, and the powered rail is activated. This sends the cart back along the track.
Created by and © 2013 Mark Fickett except where noted. I try for valid XHTML 1.0 Strict and CSS.