IR Detector (How do I hook it up)

http://www.radioshack.com/product/index.jsp?productId=2049723&cp=&sr=1&origkw=ir+detector&kw=ir+detector&parentPage=search

 

I wanted to get an IR detector that would be able to read commands from a TV remote (think VERY cheap remote control robots). How do I wire this thing up? I read about infrain commands and I understand how it works, but does the IR detector get hooked up to ground and the picaxe pin infrain/in? I am using it on an 8m chip but I have a 40m at my disposal as well as a 28x1.

 

See the 28 for dummies-part,
See the 28 for dummies-part, research on… Picaxe sells "kit" to solder on 28 board, see insructions in that kit…

Frits you’re too “kit” happy
Frits you’re too “kit” happy :slight_smile: I don’t have $30 to spend on a kit. I know how to use the chip and code to get an infrared detector to work, I’m just not sure how to wire it up. I know one pin on the LED goes to the infrain pin on the microcontroller, but where does the other one go? Ground? I saw another project where someone used an infrared detector without buying the kit so I’m sure it works… I don’t want to spend $30 on a kit when $3.50 and an existing remote control will work. The kit is easier, but I’d rather not spend that much money. I’m cheap and I want to learn how it works :wink:

The kit has explanations :wink:
The kit has explanations :wink: Read them for an answer!

Mine has 2 pins theirs has
Mine has 2 pins theirs has 3. I think the short pin goes to ground and the long goes to the microprocessor. I’ll play with it later and see what I can do. I also wasnt sure if it would pick up any infrared frequency or only specific. I’ve been researching just wanted verification because I can’t get it to work with my remote. The LED that picaxe has that matches mine doesn’t have a datasheet.

Hmm… Sorry, all I can
Hmm… Sorry, all I can contribute with now is from the "I guess & I think-box"… But hey - at least I showed you some of the way :slight_smile: Someone else please take over!

I was just playing with

I was just playing with these, but I didn’t ever actually figure out how to get the detector to work. My first assumption is that it works like a CdS cell – it varies its resistance with varying IR light. In that case, you can read it just like a CdS cell or a potentiometer (i.e., wiring it up with a resistor as a voltage divider, as described on this page (scroll down to “CdS sensors”)).

But the fact that it’s called a phototransistor (and the information on the back of the package) makes me think that maybe that’s not how it works. I think that basically, you can imagine that the long lead is the collector, the short lead is the emitter, and infrared light functions as the base pin, controlling how much current can flow between the other two pins. If that’s true, then IR light allows current to flow from the collector from the emitter. But I’m not sure how you would measure whether current is allowed to flow through it. maybe wiring the collector to +5v, the emitter through a resistor to ground, and connect an analog input to the emitter, before the resistor? I’m pretty much guessing here. Sorry I can’t be more useful, just figured I’d pass along the tiny bit of information I’ve got on the subject :slight_smile:

In the end, I gave up on trying to get it to work, since there is IR light in sunlight, incandescent light, etc, so there’d be too many sources of interference for what I wanted to do. I went with the Panasonic PNA4612 sensors, which cost about $1 and detect IR light modulated at 38 kHz, like remote controls do. It makes your emitter circuit more complicated of course, but it makes it easy for your detector to filter out all the other sources of IR light in the room and only detect the modulated one. The only downside to that is that apparently some fluorescent lights output IR light at the same wavelength and flashing at the same 38 kHz rate, so those would still confuse your detector. But I’d rather just have to deal with one source of interference rather than having it come from everywhere.

Dan

I think the infrain command

I think the infrain command of the picaxe is supposed to work with detectors like the ones TheCowGod describes in the end of his post. There is one of those 38 KHz ones at

http://www.radioshack.com/product/index.jsp?productId=2049727&cp=2032058.2032230.2032279&parentPage=search&sr=1&origkw=ir+detector&kw=ir+detector&parentPage=family

If you want to use the emitter / detector pair with infrain, I guess you would have to build a bandpass filter that would filter out anything but 38 KHz’ish (you can do that with a couple of capacitors and a couple of resistors) and then maybe use a voltage comparator and an inverter for the final detection setup. I would recommend getting the 3-pin 38 KHz detector though. They’re easy to work with and plug straight into the picaxe infrain.

I don’t think that interfering fluorescent light should be a serious problem, unless it actually produces valid IR commands.

Oh and btw the 3-pin detector has VCC, GND and DETECT pins. You would want to plug the DETECT into your picaxe infrain pin.

Huh, wow. I never saw that

Huh, wow. I never saw that at my Radio Shack, though the website says my store has it in stock. I’ll have to look for that. And yeah, if you’re actually sending messages, fluorescent light shouldn’t be a problem – in my case, I’m just looking for the existence of a constant 38 kHz signal. For other uses it probably wouldn’t be much of an issue.

BTW, jklug, I’ve read that adding a .1 uF capacitor across the Vcc and Gnd pins on these 38 kHz detectors helps to eliminate false signals.

Dan

I shoul dhave time to play
I should have time to play with them more tonight. I was hoping to be able to use a TV remote to control a robot. I’m also trying to hack a bluetooth dongle for use on a robot. My goal is to create a couple cheap ways (under $5) to get wireless control for a robot. I know I could rip apart a remote control car and use the radio controller, but bluetooth would blow that out of the water. I would love to control a robot from my PC and have it send back live images from a webcam.

I rediscovered these

I rediscovered these webpages I had found during my search, thought they might be useful for you.

http://hackedgadgets.com/2007/11/10/ir-detector-circuit/

http://www.tkk.fi/Misc/Electronics/circuits/irdetector.html

Looks like it’ sjust a matter of using the phototransistor to bias the base pin of a regular NPN transistor. Hope that helps.

Dan

I broke down and ordered
I broke down and ordered some off the picaxe site. It is my second order form them in the last week :wink: I will try to get it working as I want to know why it isn’t working. I just can’t walk away without fixing something or proving why it won’t work.

Uh - how ever fond I am of

Uh - how ever fond I am of picaxe, I think there is one big problem here; infain halts all program termination untill something is recieved! (I think) So you’d need an extra picaxe just to deal with the IR - and it would take 2 pins from the “main picaxe” to deal with the communication as I see it:

IR-axe: Waiting to recieve, waiting… bingo, something recieved. Now keep sending this to pin 1 on Main-axe, serial, until pin 2on main axe indicates "I have recieved from you, thanks, I will use it, get back to waiting"

Pretty stupid & complicated setup to have “multitasking”.

As note, the picaxe has the same problem with SERIN - however, there you can use the HSERIN that has a timeout. I do not think there is any timeout-functions on the INFRAIN in the current versions of the Picaxes, sadly!

For remote control I don’t

For remote control I don’t really think it’s a problem that the infrain command is blocking. When you receive a command you would normally set some state for the motors - for example set it to turn or to go forward, and then you would wait for another command. Remote control doesn’t normally invoke behaviour that requires continous processing.

I am planning on makign it

I am planning on making it so when you hold down an up arrow on the remote it goes forward. When you let go it stops. Same for right, left and backward. Maybe another button that does something else. As long as it does nothing when a button isn’t pushed I’m fine. This fits the contraint of infrain. It doesn’t need to think for itself, only do what it is told to do when I tell it. If I wanted a sensor to avoid letting me mash it into the wall we would have problems.

I’m assumign the code will be

main:

infrain

select infra:

case 1:

blah blah blah

case 2:

blah blah

end select

goto main:

 

That is done quite easily,

That is done quite easily, no prob if it is not going to think. The SONY protocol for IR is used with INFRAIN, and I think you have some 127 different commenads. I made something similar, remoted a bot with a TV-style remote control. THe Picaxe shop has one “all round” that is quite handy, easyly configured and stuff. (cheap, and I think it can also be included in a… KIT!)

- ANd btw; My robot never worked well, because I did not know of the motor drivers and stuff, so it was really slow adnd crap, driving on the pins from the chip directly :smiley: (But that is another story - before I got the 28 KIT)

 

Oh… my reason for writing; TheCowGod’s bullybot-project would not have a good time with INFRAIN - that was my point initially!

I think you’d be easier off

I think you’d be easier off if it didn’t have to stop when you let go of the button. How do you detect when the button is not pressed when the infrain doesn’t time out? Maybe use a timer to generate an interrupt and then check some state variable that says if you detected button down previously or something like that - just thinking out loud :-).

Would be much easier to do if the robot was set to go forward when pressing one button and was set to stop when pressing another and so on - also that wouldn’t wear so much on your thumb ;-).

I’m looking forward to seeing this guy in action!

**could this be of help? **

could this be of help?

irreceiverhookup.jpg

I found that same diagram.
I found that same diagram. This is different that the sensor I got from Radioshack that I was trying to use before I broke down and ordered that one.

I would like to make a

I would like to make a receiver like a TSOP (with integrated demodulator = basically 1s and 0s come out of its output pin) feed a signal to the microcontroller it is attached to. This is more a problem of Programmin actually… oh yeah, and i do not want to use SERIN, i know it can be done like that but it has limits i don’t like.

Example of what i want to do:

receiver+demodulator(Infrared) receives data, 1s and 0s come out of it. How to combine those 1s and 0s into, say, a variable on the picaxe? (other microcontrollers would also do)