When planning a tech talk with some folks on IoT development, we had to come up with several sensors to demo in order to feed a backend server module. An obvious choice was a PIR motion sensor, which is very straightforward and easy to build. Someone suggested a distance sensor, and having previously worked with a Sharp IR distance sensor (2Y0A02) on an Arduino it seemed like a perfect win.
So, we committed to building this sensor using the Raspberry Pi as our platform. As we started the development process, we discovered when looking at the datasheets for the Raspberry Pi and the Sharp sensor there was something we overlooked.
The Sharp IR sensor outputs an analog signal, whereas the Raspberry Pi GPIO pins are digital. So in order to build a Raspberry Pi Distance device we have to overcome this.