Help with a Minecraft Redstone Mechanism

I'm making a system for my town that requires an automatic system that moves a chest in a minecart around under the roads. I've gotten almost the things necessary for the loading process to work, but i need to tell when the hopper putting items into the chest is empty. Normally, I could use a NOT gate with a torch, but I can't use that in this situation, since I need it to be always off, except when the hopper initially empties. Meaning, I need a system that uses the comparator coming out of the hopper to be linked up to some circuit that can turn on for a few seconds when all items leave the hopper, then turn back off again, and wait until the hopper empties until repeating.


This solution uses a NOT gate to invert the output of the comparator to a pulse generator to an RS NOR Latch to a reset timer. The latch and reset timer form a pulse extender.

This solution has a larger footprint as it is the easiest to explain and take an image of. Using the above circuit explaination and the above linked page, you could modify this design or use a different pulse generator and/or extender to make a smaller version if size is a problem. If this is needed, leave a comment and I will build a smaller circuit.

When the hopper initially empties, the comparator outputs low. The not gate inverts this to high. The pulse generator turns this constant high into a single tick pulse. This pulse sets the latch output high. The timer resets the latch output low. It will stay this in this condition until the hopper has an item again.

Here is an image of the contraption:
Output Pulse

The pulse generator is a sticky piston submerged in the ground, pointed up, with a solid block stuck to it. In the unpowered position, the piston will be retracted. When the redstone dust is powered, the block will be powered. This will power the repeater and at the same time the piston. The piston will extend, moving the block up and removing power to the repeater. The repeater will have been powered for a single tick.

The single tick output powers the block at it's output which is part of the RS NOR Latch. The torch on the block turns off which causes the torch on the other block to turn on. This is your output for your circuit. This output also powers a line of repeaters. These repeaters set the duration of the output pulse. When a signal has passed through all these repeaters to the second block in the latch, the second torch turns off which causes the first torch to turn back on.

You said you wanted a few seconds output pulse. With 8 repeaters set to 4 ticks, it outputs high for about 3 seconds.