The capsule detection is done by two super bright leds and two photo resistors attached to the outside of a tube. Drilling holes into the tube is not necessary since it is just transparent enough.

The signals of the photo resistors will be preprocessed by a simple operational amplifier circuit. First a capacitor is used to filter out any DC-offset on the signal caused by ambient light. After that the signal may still contain noise, like the 50Hz sine produced by fluorescent light tubes. Therefore a comparator is used to filter out this noise floor below a configurable threshold voltage. It also amplifies anything above the threshold to 5v, leaving us with a AVR friendly 0v to 5v signal. The passing capsule will usually decrease the voltage coming from the photo resistor about 1v. Therefore the threshold should be chose between 0,2v and 1,2v.

The output of each comparator circuit is directly attached to the digital IO-Pins of a AVR based micro controller board (e.g. a Kaboard). The board calculates direction and speed of each capsule and sends the data to a beagle bone using a simple usb uart bridge. The datasets will be saved in json files by a python script and uploaded to a webserver.