Well, our
Gadget Shield comes with some
object detection software that you could use as a starting point.
Here's a video:
It's a similar setup: IR transmitter and TSOP1838 detector (or similar).
You don't need a "protocol" just to detect objects. Turn on the IR LED at 38 kHz and look for a reflection with the IR detector. Change the duty cycle of the IR LED 38 kHz waveform (see the software) to adjust the distance at which you will detect objects. Too high a duty cycle and you will "blind" the sensor, too low a duty cycle and you won't see any reflections.
--
The
Arduino Drum Machine: 14-track MIDI drum machine sequencer / groove-box