Go Down

Topic: Infrared communications (Read 844 times) previous topic - next topic

Carrotman42


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?

AWOL

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.
"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.

Carrotman42

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() )

AWOL

You could use the software serial library - the data rate isn't going to be all that high.
"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.

Carrotman42

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.

AWOL

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.
"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.

Chagrin

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.

Carrotman42


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!

AWOL

NE555 -the chicken soup of electronics.
"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.

Go Up