0
\$\begingroup\$

How does this IR Proximity/Object sensor work ? Any resources or tutorials on how this works would be really helpful. I want to use this for my raspberry pi

IR Sensor Image

NOTE : I have searched a lot on the internet and most of them either have 3 pins or a white dome shape over the module. This one has 4 pins.

\$\endgroup\$
5
  • \$\begingroup\$ My guess is that one output is a 'trigger', basically the output of a comparator with the threshold set by the trimpot. The other output is likely the 'raw' analog output. I sugest you hook it up and use a multimeter to probe both outputs to find out more. \$\endgroup\$
    – RJR
    Feb 18, 2016 at 4:32
  • \$\begingroup\$ Can you post a picture of the back of the PCB? \$\endgroup\$
    – RJR
    Feb 18, 2016 at 4:36
  • \$\begingroup\$ Please post the schematic for this device. \$\endgroup\$ Feb 18, 2016 at 5:40
  • 1
    \$\begingroup\$ @RJR Here you go, some high resolution photos of the back and front imgur.com/a/YLewm \$\endgroup\$ Feb 18, 2016 at 5:45
  • 1
    \$\begingroup\$ @NickAlexeev I just bought this from a local shop. Dont really know its schematics. \$\endgroup\$ Feb 18, 2016 at 5:45

3 Answers 3

1
\$\begingroup\$

It's a basic IR proximity sensor using a LM358 general purpose op-amp. Not knowing it's specific configuration, it's safe to assume its similar to a simple comparator setup. Diagram from here along with a full detail of how it works, which is how most IR proximity sensors will be wired really.

enter image description here

The two output pins are likely for convenience and will be tied together. You can confirm by looking or using a continuity setting on a multimeter.

Update: Based on the pictures and @RJR's schematic, the two outputs are separate. One provides an on/off digital output, the other provides an analog voltage proportional to the input.

Since it's running at 5V, you will need a voltage divider or level translator to connect it to a RPi input.

\$\endgroup\$
1
  • \$\begingroup\$ So when the object is close enough the first pin will give me a logic HIGH right ? \$\endgroup\$ Feb 18, 2016 at 16:55
1
\$\begingroup\$

Here is your schematic - sorry for the rough draft...

Here's your schematic:

Basically there two function as I said in my comment above. One part of the amplifier is set up as a comparator, feeding output 1 (pin 3). The trimpot determines at what level the output will flip (and light the red LED).
The second amplifier is set up as a simple analog buffer/amplifier with a fixed gain (1+10k/4.7k = 3x). Output 2 (pin 4) will give a voltage proportional to the amount of light detected.
O1 will be 0v is the amount of light is below the threshold set by the trimpot, it will ve 5V when the amount of light is above the threshold. If this is what you need for your application, you should use this output. That sayd, you need to take care that the Raspberry Pi uses 3.3v logic - high is 3.3v, low is 0V and thus, you need to reduce the 'high' voltage from 5v to 3.3v. The simplest way is to use a voltage divider. Take a 15k and a 22k resistor. Connect the 10k to O1, the 20k to the other end of the 15k, and the other end of the 22k to ground. Then, connect your rPi input to the connection between the 15k and 22k resistors. You have just made your first voltage divider. The 5V on O1 will now be 22*5/(15+22)=3v, nice and safe for your rPi.

\$\endgroup\$
1
  • \$\begingroup\$ I actually dont understand electronics that much and I am pretty noob. I just want to know how to use the pins and what high and low on each pin means. \$\endgroup\$ Feb 18, 2016 at 16:52
0
\$\begingroup\$

4 pin IR sensor works same as that of 3 pin IR sensor. Just leave the last "OUT" pin. First three pins are enough.

(1.) +5 volts

(2.) ground

(3.) output

->The LED on the board becomes "ON" when obstacle is near.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.