IR serial connection

I'm trying to send and receive ir via an Arduino, this is my code + schematic

#include <SoftwareSerial.h>

#define IR_RX 8
#define IR_TX 9

#define IR_CARRIER_PIN 3

SoftwareSerial IR(IR_RX, IR_TX);

void setup() {
  IR.begin(4800);
  tone(IR_CARRIER_PIN, 30000);
  Serial.begin(19200);
  Serial.println("Hello, world!");
}

void loop() {
  if(Serial.available()){
    while(Serial.available()) {
      IR.write(Serial.read());
    }
  }

  if(IR.available()) {
    while(IR.available()) {
      Serial.println("Data:");
      Serial.println(IR.read());
    }
  }
}

I'm not receiving anything on the receiving Arduino, can someone explain why?

Do you really not have a current limiting resistor in series with your IR LED?

You may be able to check if the IR LED is working by using a mobile phone camera. Test the camera first on a TV remote to make sure that it has no IR filter, then see if you can pick anything up from your LED.

  if(Serial.available()){
    while(Serial.available()) {
      IR.write(Serial.read());
    }
  }

You don't need the if statement since the while is making the same test.

We have a FET driving the IR led. Along with a current limiting resistor. These are not shown in the diagram. We've filmed the IR led. It blinks briefly when transmitting. We've scoped pin 3. It shows a 30khz square wave. We've scoped pin 9. It shows serial data being transmitted.

LuluTheCoffeeAddict:
We've scoped pin 3. It shows a 30khz square wave. We've scoped pin 9. It shows serial data being transmitted.

What does Pin 8 show?

LuluTheCoffeeAddict:
We have a FET driving the IR led. Along with a current limiting resistor. These are not shown in the diagram.

Not much point in posting a schematic if it is not correct.

LuluTheCoffeeAddict:
We've scoped pin 3. It shows a 30khz square wave. We've scoped pin 9. It shows serial data being transmitted.

And what about pin 8? Anything detectable happening there?

Pin 8 on the receiving arduino shows nothing

LuluTheCoffeeAddict:
Pin 8 on the receiving arduino shows nothing

Ok, we'll assume the sensor is not broken.

Try a lower Baud for the sensor - 2400 or less. Check again with the scope for any action.

Turns out the wires on the receiving arduino were connected to the wrong pins, I reconnected them and I am now receiving data. Sadly the bytes I'm receiving are all 255

LuluTheCoffeeAddict:
Turns out the wires on the receiving arduino were connected to the wrong pins, I reconnected them and I am now receiving data. Sadly the bytes I'm receiving are all 255

Your original (seemingly unrepresentative) schematic only shows 1 Arduino?
Did you miss-wire the sensor or what? Because I would have thought you would have seen something on the scope even if pin 8 was connected to a wrong Arduino pin.

Please post an accurate schematic.

This IR Serial Thread may be of interest.

...R