This is an Arduino project which makes a electronic sustain pedal MIDI-capable.
I implemented this on a vanilla-shield board.
Some of my favorite keyboards (like microKORG) don't have a sustain pedal jack, and I have to use weird things to overcome this weakness.
I think this is a better and less weird solution to the problem.