A proximity sensor is a sensor able to detect the presence of nearby objects without any physical contact. We are using 2 proximity sensors in our project it will be used to play next or previous and pause the song.

To build the circuit follow the above circuit diagram.

Explanation of Diagram

We are using pair of Photodiode and IR LED's. Photodiode is connected to 10K Resistor while IR LED connected to 100 Ohm Resistor. S1 & S2 outputs are connected to LM324SN Operational Amplifier which amplifies the voltage according the Potentiometer connected. The output of the LM324SN is 5V. But we need 3.3.V to Raspberry Pi therefore we are using Voltage Divider Circuit.

Connect Output O1 & O2 to GPIO 27 & 17 Pins respectively.