The hopper is a useful device for controlling/counting/sorting items.
 Day counter
This is a very simple machine for counting days. Every time it becomes day, the dispenser is activated and shoots an item into the chest.
|Video tutorial Video (view on YouTube)|
 Item counter
A mechanism that outputs short redstone signal for every item that goes through the dropper. The mechanism slows down the items moving through the dropper and the hopper above to make the outputs comfortable to use for counting mechanisms.
The output of this counter can be used in any counting mechanism and can be counted using the scoreboard command in a command block.
It is possible to change the outputs timing by replacing the bottom comparator with repeater (to make it slower) or redstone dust (to make it faster).
Size: 1x4x5 blocks.
This mechanism made by Xbxp.
You can download this mechanism from: Planet Minecraft - Item Counter
 Item sorter
Most item sorters work using hoppers. More specifically, a hopper with all five slots occupied by, for example, redstone, will only be able to collect redstone, because there is nowhere for any other items to go.
Connecting the hopper to a comparator will allow the sorter to measure the contents of the hopper. All five slots MUST remain occupied by the material you are sorting for, otherwise other items will be able to pass through. The easiest way to ensure this is to measure for a 2-strength signal from the comparator, which corresponds to 22 items inside - 18 inside the leftmost slot and 1 each in the other four slots (hoppers lose items in the leftmost slot first).
There are two components to an item sorter: the item channel and the sorting component(s). Here is an analogy to clarify this: the item channel is like a river, and the sorting components can be imagined as nets that only catch certain items. The river ends in a dump (the junk chest).
The item channel is simply a path that items travel through. It can be a horizontal chain of hoppers, or a water channel. Hoppers underneath the hopper chain or water channel act as the "net" and will extract items.
The sorting components are composed of hoppers. To enable deposition and extraction to be independently toggled, two hoppers must be used: one on top of the other, and the top one pointing sideways. The top hopper should be connected to the comparator, which will power the bottom hopper (which takes items out of the top hopper)
 Hopper Clock
Connect 4 hoppers in a circle (create one pointing at nothing, point a 2nd one at it while crouching, destroy the 1st and use the 2nd as the start of your circle since it's the 1st one pointing the right direction). Put any item that doesn't stack (a wooden axe for example) into any one of the hoppers. Attach a comparator to any one of the hoppers. It will give a signal every time the item goes through that hopper. If you want it to activate more often make a 2 hop clock.
 Slow Clock
Connect two hoppers (let's call them hopper A and B) with their outputs facing each other. Measure their outputs with comparators (comparator A and B). Connect the comparators' outputs to repeaters (repeater A and B), add repeaters perpendicularly to make them lockable (lock A and B). Connect the output of repeater A to hopper B and lock B and the output of repeater B to hopper A and lock A.
To start the clock, throw items into one of the hoppers. The speed of the clock will depend on the amount of items circulating in the system, with the longest duration being 128 seconds in case of 5 stacks of 64 items.