Serial infraRed data

Greetings all. Glad to be a part of your forum

I am a bit new to all this, so please bear with me.

I want to send basic byte data between two Arduinos.
My first attempt used the IR libraries, and that was fine if I used a TV remote or something.

My data is going to consist of around 150 individual bytes. I could not get the IR library's to let me send enough variables. Plus, there seems to be a lot of error checking within those codes.

Speed is not critical for this transfer.

I connected an IR receiver to a 328p, and read the port using SoftwareSerial.
I have an IR led connected via a transistor on a second Pro Mini, also using SoftwareSerial.

Can I simply send the data (for example - 230) by saying: int bytesSent = IRSerial.write(230); ?

The receiver detects 'something' on the, but its not what I send.

I realise that going forward, I need to add a start and stop marker to make sure the data is identified correctly.

I read this page: Serial Input Basics - updated - Introductory Tutorials - Arduino Forum on serial data use and lifted some of the code. But, I cannot get any particular bit of that code to work with my IR.

I should say that my actual IR wiring works fine. If you load an IR Library example, the receiver works fine.

I would post code, but I have none! Back to the drawing board at the moment.

This data can be send individually, in groups or all at once. Doesn't matter. I can decode it at the other end.

Maybe someone can point me in the right direction or to an example that I can adapt?

Thank you for your attention


Hmm OK. First school boy error

The receiving Arduino is running at 8Mhz external crystal.

The transmitting IR Pro Mini is 16Mhz. That isn't going to help.

I only have 8Mhz crystals here.

Can I halve the baud rate? Or is that total nonsense

edit.... Found a 16Mhz crystal... same results however

I should say that my actual IR wiring works fine. If you load an IR Library example, the receiver works fine.

I don't know what IR library you tested. But sending data via IR (or radio) links never use Serial protocol. A standard for such links is Manchester coding of bits. And data are sent in a block beginning with several synch bits (a sequence of 0's or 1's) and then the data following in a block. For 150 bytes it might be useful to split the data into several smaller blocks.

In an old project of mine I used the "IR Remote" library from playground to receive data from an IR remote control. You can find it on

and there scrolling down to "Infrared". There are also some more libraries there.

For your application you should analyze the code to find where the data are inserted and put your data there.

OK. I have played a lot with this and got nowhere. I have about 7 IR libraries installed.

As a small thing.... I wish the developers of these libraries would include a TXT file that explains what each example they provide does. A lot of them are just baffling or have zero description.
A few have some commented code at the start, but then you have to load every example to see what it does.

Anyway... drifting off there...

Yes, I can get my code to read the IR code from a TV remote. I can get one breadboard to send a TV remote code from one to the other.

But... I have still yet to work out how to send an extended stream of byte data from one place to another.
Using the 'TV remote' method with all that error checking and reverse data sending per value will take forever

I have Googled for hours and found no example I can adapt or understand.

Open a comms link with an address check, send say 20 bytes of data, and close the comm link with another 'message over' flag.

Anyone got any ideas? Thanks!

I found this page, which would appear to be something along the lines I need (Thanks SupArdu - it was in your link).

But, I have NO idea how it works, and the wiring diagrams are missing. I assume the IR led is across pins 9 and 10 on the TX and the receiver is directly in on pin 13?

I am using my mobile phone camera to check output on the IR led, and I can't get anything on the transmitter. Can someone point me in the right direction as to the IR led connections for that TX code? Straight across pins 9 and 10 (with a resistor) doesn't appear to work.

Can someone explain how that transmitter code is working?

Well, no combination of anything works. Using pins 9, 10 across to TX.
I can see the IR led flashing, but nothing transmits, so something is wrong somewhere.

Found the original thread in this forum for the above code, but it still lacks confirmation of connections.

Going with a Picaxe. Found a working circuit for that instead