Proximity Sensor
IR obstacle sensor - is something in front of me?
The clear LED is an IR lightbulb. The dark bulb is an IR phototransistor. Photoresistors are devices that amplify current more when more light shines on it. The sensor works by emitting light in front of it and then the detector measures the amount of light reflection. The little screw on the board is a variable resistor that you can use to set the detection threshold. If the detector receives enough light, it outputs that something is there!
Plug the sensor into the Arduino. Then point a digital camera, like your cell phone or webcam, at it and see if you can see the light using the camera. Note, only some cameras can see IR. |
The bulb not emitting visible light. It is only emitting a specific wavelength of infrared light (IR)! That means it is not visible to your eye.
|
Look at this picture and video for how this sensor works.
The code!
This sensor gives outputs of either 0 or 1 for if something is close to it or not. This code below will print on or off to the Serial Plotter depending on if something is close to it or not. Type out the code below in Arduino IDE