I’ve tried the standard Minecraft one and several variations of it, but none work. The standard one below just doesn’t give the cart enough time to unload. I tried placing 3 hoppers in a row and one in a closed track circuit, but those didn’t work either.
Standard
Circuit
I decided to give this a go. This is what I came up with:
It has the usual consistency issues of mesecons/voxelibre-redstone, but seems to work the majority of the time. It won’t return empty carts though, so make sure to send them in with at least 1 item.
Edit: much simpler version:
(Remember to right click the second comparator to put it into subtraction mode)