Pages: [1]   Go Down
Author Topic: Infrared communications  (Read 798 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I'm trying to create a laser-tag unit with my Arduino. Right now the issue I'm working through is how to tell who tagged whom when a shot is fired at someone else.

I know IR receivers receive signals at a certain frequency, but I am having trouble figuring out how to transmit and receive at that exact frequency. Once I can sync up the sender/receiver, I'm sure I could finagle up some on-off keying system to send a few bits of data identifying the shooter. I'm sorry, I'm probably not being very clear here...

Basically: Does anyone know how to send a few bits of data from an IR LED to an IR receiver?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26621
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does anyone know how to send a few bits of data from an IR LED to an IR receiver?
Serial.print.

That's how IRDA does it.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Serial.print.

That's how IRDA does it.

Well the problem with that is that I'm also going to use an XBee wireless shield for the game, which also uses the serial port. Is there a way to switch between where the serial writes to?

Also, if I were to use the serial pins to send/receive, how would I know at what frequency it will send to use the correct IR receiver? (or is it a setting like when calling Serial.begin() )
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26621
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could use the software serial library - the data rate isn't going to be all that high.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem with just straight sending the bits is that with an IR receiver, it has to receive a signal at a specific frequency, eg the IR receiver only outputs that a signal is detected when the IR LED is blinking (I tried with always on and it didn't work, then I tried blinking it at some arbitrary frequency and it worked sort-of). The SoftwareSerial you provided is actually the first thing I tried to do, before I realized I needed to have an actual frequency along with the data.

I'm thinking that I can blink the LED at the frequency (in order for the receiver to detect it) when I need to transfer a 1 and turn it off when I need to transfer a 0, but I don't know how to easily sync up the sending and receiving to make sure it goes over well.

Here is the spec of an IR receiver: http://www.vishay.com/docs/82090/tsop48xx.pdf  . Look in the section of "TYPICAL CHARACTERISTICS", where it shows that for the receiver to detect the IR light, the light has to be turning on and off.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26621
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you want to modulate the serial stream, look at putting an external 555 circuit to do that bit for you.
Alternatively, do the modulation in software, and pick apart the software serial libraries to see how they transmit bytes, tagging your modulation code at the very end.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2550
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you use a plain, two-pin IR phototransistor you won't have the frequency issues to worry about. The IR receiver you have linked it not a typical IR phototransistor.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you want to modulate the serial stream, look at putting an external 555 circuit to do that bit for you.

Thank you so much! Using the 555 timer plus the SerialSoftware code you showed me (with some tweaking) worked like a charm!
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26621
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

NE555 -the chicken soup of electronics.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: