IR-based data packets

I've been able to get two Arduino's send and receive IR signals at 38KHz using libraries that mimic TV codes (so I know both my systems work).

Now I'd like to be able to send raw data back and forth between the two systems. Nothing large... let's say 10 or 15 byte payloads at a time.

I tried combining the send and receive sketches for the TV signals into a single sketch, but it did not succeed - too many issues to list here.

And at any rate, I'd like to create a sketch from scratch that does something like this:

1 - Listen for Incoming IR Data

If No Data coming, GoTo 1, else

2 - Read data into a buffer

3 - Print data in Serial.print

4 - GoTo 1

Something to that effect.

Any guidance would be appreciated. Thanks in advance.

The "GoTo 1" means return from loop().

How do you (your library, hardware...) encode transmitted bits? Do you have to check the length of incoming pulses, or how are the bits decoded?

This Thread about IR serial comms may help.


DrDiettrich, I want to start from scratch as the TV IR libs are not suitable for what I need. I simply want to tx/rx small chunks of data between two arduinos - so I'm open to any implementation.

Robin2 The thread you sent is definitely helpful and very very clever. I'm gonna give it a try soon as I get back in my garage (lab). Thank you.