2 Pin Infrared Receiver [Closed]

Hello!, I am developing a robotic project, so I need a communication between Arduino and a universal TV controller.

So, I recently bought a infrared receiver like this:

I have seem a lot of tutorials, but they teaches you to use a 3 pins IR receiver like this:

How can I connect the 2 pin IR receiver to arduino using the IDE library?

The 2 pin device is a phototransistor or photodiode. It will not replace the 3 pin device. The 3 pin device contains a phototransistor, amplifier and demodulator . The phototransistor will, at best, detect the presence of an IR signal but, without additional electronics and code, will not decode the IR signal.

How can I use it for detect a presence of a IR signal?

We

Alvaro_Pelon:
How can I use it for detect a presence of a IR signal?

You can detect IR with the two-pin one by connecting it as shown here. Note that the dark one you posted is probably the transmitter, the receiver is usually clear.

But that's all you'll be able to do. If you need the tv remote codes to be understood you need to go for a 3-pin one and the IR library.

Thanks for the quick reply!!

This is a very good forum!!!

JimboZA:
We
You can detect IR with the two-pin one by connecting it as shown here. Note that the dark one you posted is probably the transmitter, the receiver is usually clear.

But that's all you'll be able to do. If you need the tv remote codes to be understood you need to go for a 3-pin one and the IR library.

hmmm.. that's not the whole truth. i'm having the same problem right now. i am using a simple infrared sensor from an old printer's light barrier, connected the way it is shown following jimbozm's link.

i get the codes and can turn on and off an led, but not in a propper way. sometimes i get different codes with the same key (not random, but always the same 4 or 5 codes) and sometimes i get the same codes with diffrent keys.

i will try to connect the sensor with a small capaciter.

does someone know, what the problem is and how i can solve this?

EndoAnaconda:
does someone know, what the problem is and how i can solve this?

Is there even a problem?

The fact that the remote sends different codes from the same button, and/or same codes from different buttons, is part of its design. Those codes will obviously be expected and handled by the remote's matching receiving device, as part of some protocol.

The "problem" (if there is one) is that you're using the remote outside of its native habitat.

The "solution" is to find out what that that protocol is, understand it, and then code your sketch to handle the codes the remote sends. For example, I have to use ors (||) in ifs to drive a robot's motors, to anticipate that the "left" button can send one of two codes; I just do the same thing when either code arrives. It's not a "problem" in some absolute sense; it's by design of the protocol.

Iirc, the IR library decodes and tells you what protocol you have- but it's years since I used it.

JimboZA:
We
You can detect IR with the two-pin one by connecting it as shown here. Note that the dark one you posted is probably the transmitter, the receiver is usually clear.

But that's all you'll be able to do. If you need the tv remote codes to be understood you need to go for a 3-pin one and the IR library.

Dark one = receiver
Transparent one = transmitter