Arduino Forum

Using Arduino => Sensors => Topic started by: santam on Jun 14, 2019, 12:06 am

Title: Ir proximity sensor
Post by: santam on Jun 14, 2019, 12:06 am
While surfing the net , I came across many tutorials for proximity detection using ir led and receiver. Most of them have connected the ir led to an analog output pin in the arduino and have connected the receiver in an analog input pin. Does the setup work in this way? Doesn't the analog pin output a variable voltage? And for transmitting an ir signal don't we need to use an oscillating carrier wave? Please clarify my doubts.
Title: Re: Ir proximity sensor
Post by: Wawa on Jun 14, 2019, 02:38 am
analogWrite does NOT output a variable voltage.
It outputs a variable duty cycle (PWM), with fixed voltage (VCC) and fixed frequency.

For short distances, constant IR light and a photodiode can be used.
For longer distances and ambient light, modulated IR (38khz) and a demodulating 3-pin receiver can be used.
There are many more ways of proximity detection, like PIR and ultrasound.