I've done some research on using a rotary encoder for measuring filament use and

I’ve done some research on using a rotary encoder for measuring filament use and written down some of the work in a blog post. Terrible mechanical implementation, but the electronics and software is really great! http://www.thing-printer.com/filament-sensor-3d-printer-replicape/

I plan to test this when I upgrade my BBOne printer:

@Oyvind_Amundsen optical?

Hall-E sensor and magnet
http://doku.radds.org/dokumentation/other-electronics/fts-filament-tracking-system/
When the filament moves a magnet rotates and the Hall-E detect the movement