The Proximity sensor has an IR led and a Photo detector to detect. The basic purpose of a proximity sensor is to perceive occurrence of any object without being in contact with it. A proximity sensor makes a field around it by emitting IR beams from the IR LED. The beam of radiations traces any object or hurdle in its way. The term ‘target’ is used for the object that a proximity sensor intuits in its path. The sensor looks for any alteration made in its field. Target usually replaces a certain beam of the field or hurdles its projection. Different fields or sensors are used to detect different targets.
The proximity sensor is connected to the FreeSoc2 Analog pin. The example is used to differentiate between a white object and a black object that has different way of reflecting the IR rays. Basically the white objects will reflect more IR rays and the black object will only reflect a negligible amount of rays, by using this, the white and black objects can be differentiated by using a proximity sensor and a FreeSoc2.
The connection part has only a proximity sensor and a couple of resistors and connecting wires to accomplish this task.
- FreeSoc2 development board
- 10K and 1K Resistors
- Connecting Wires
Connect all the components as it is mentioned in the circuit diagram below in a bread board or a general purpose board.
Download and install the PSoC creator 3.2 from the below link
Connect your Freesoc2 via USB debugger port and the necessary drivers will be automatically installed in your system
Now open the sample workspace that is attached along with the blog.(Click to download the code TCRT5000)
Double click on it and it should open in the PSoC creator IDE. As the below screen shot.
Now click on the program button on the left side of the window. And it will automatically program the board.
You will see the dialog “successfully programmed” in the output side
And that’s all you are done. Now you will see the working output with the TCRT5000 along with your FreeSoc2