Infrared Communication between Receiving and Transmitting sensors

Hi, I’m new to Arduino so bare with me please.

So my group is making a project where we are making an automated guided vehicle and it is supposed to navigate with infrared sensors. My job is to establish infrared communication with the IR emitters and receivers. The way I would like to accomplish this is by having a transmitter send a specific signal, a hexadecimal value, that will be read by the receiver. My project advisor has said for the transmitter to be able to send this signal like a pulse. For example if I want to send the value 0xFFFFFF, the signal should be on for like 1 second and off for 1 second.

The problem I’m having is that I’m unable to send a IR signal from my transmitter that can be read by my receiver. The transmitter I’m using is the TFSH6210-1766998, the microcontroller is the Teensy 3.6 and I’m using the Arduino Uno IDE.

I’ve tried using the code below to try and get a signal to send from the transmitter but I’ve found out that the code uses pin 3 for the IRsend function and I’ve read it’s hard coded into one of the libraries, I’m unsure of which one. The Teensy 3.6 uses pin 5 for the IRsend function. I’ve knocking my brain on this for a while and I feel like this shouldn’t be this hard of a problem for me to solve but unfortunately it’s proved to be the hardest part of the project so far lol.

#include <IRremote.h>

IRsend irsend;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.read() != -1) {
    for (int i=0; i<5; i++) {
      irsend.sendNEC(0x00ff01fe, 32); // I want the transmitter to send this signal to be read by the receiver
      delay(50);
    }
  }
}

I’ve also tried using this code but it also didn’t work

#include <IRremote.h>
IRsend irsend;

void setup() {
  Serial.begin(9600);
  pinMode(5,OUTPUT);
}

void loop() {
    irsend.sendSony(0x68B92, 20);
    delay(100);
    irsend.sendSony(0x68B92, 20);
    delay(100);
    irsend.sendSony(0x68B92, 20);
    delay(300000);
}

The problem I’m running into is that I’m not getting any voltage being sent from pin 5 and therefore no signal is being sent to the transmitter.

I have been able to get the receiver to be able to read a signal being sent from different TV remotes so I think that part I don’t need help in but I’ll post the code anyway. The IR receiver I’m using is TSOP322-1767012.

#include <IRremote.h>
int recv_pin = 6;
IRrecv irrecv(recv_pin);
decode_results results;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  irrecv.enableIRIn(); //start the receiver
}

void loop() {
  // put your main code here, to run repeatedly:
  if (irrecv.decode(&results)) {
    Serial.print("Protocol: ");
    Serial.println(results.decode_type, DEC);
    Serial.println(results.value, HEX); //receive the next value
    delay(100);
    irrecv.resume();
  }
}

I’ll post the link to the Teensy 3.6 microcontrollers information:
Teensy 3.6 Datasheet
Teensy IRremote library
I’ve also added a schematic and the sensor datasheets.

I’m sorry that this was long but I would really like for this to work because I think the project our group is making is kind of cool. I’ll try to answer and questions you guys have about this.

Thank you.

IR communication schematic.pdf (160 KB)

tshf6210-1766998.pdf (104 KB)

tsop322-1767012.pdf (178 KB)

My project advisor has said for the transmitter to be able to send this signal like a pulse. For example if I want to send the value 0xFFFFFF, the signal should be on for like 1 second and off for 1 second.

Nod politely and never take any advice from that person again. Their answer should have been, "I don't know". In fact, no readable signal can be sent without modulating the IR at 38kHz. Also you can't feasibly send just raw on/off modulation, you need to construct a data packet containing different data fields which support the packet integrity in several ways. Appliance remotes, and the IR library, do all that for you.

Regarding the Teensy pins and so on, you need to do some research into the library to see how it supports Teensy. Try photographing the IR emitter with a cell phone camera (most can see "a little bit" in the IR spectrum). There might be a flaw in the transmit or receive circuit, especially if it is custom built.

See whether the receiver Teensy can receive from a TV remote.

I most likely misquoted what my advisor has said, I’m pretty sure he said that the signal had to be modulated at 38KHz. He said something about generating a sequence for the modulated frequency, about 20 pulses. Then test the 20 pulses at 38KHz to see when they are on/off, microcontroller reads 1 if on 0 if off at a 2KHz rate. The pulse will be about 26 microseconds long, so for 20 pulses it’ll be about 230 microseconds long.

I’m writing all this from memory, so the information might be a little inaccurate lol. I’ll email him again to get fully what he was saying.

Also, do you have any recommendations on how I could get the signal to transmit. Like what I should check for in the libraries and maybe what I could alter in the circuit.

Thank you for your reply.

The IR library for the Teensy is documented here: IRremote Library, Send & Receive Infrared Remote Control

Temporarily swap the IR led for a normal led to see if you get some visual indication that it is working. Also an oscilloscope or logic analyser can be useful here. The pins are usually fixed because the IR carrier signal is generated using a hardware timer.

It is true that the TSOP type sensor you are using works best with short signal bursts.

It is not clear whether you are using IR for transmitting data to the car, that is as a communications channel, or simply as a proximity detection method like sending an IR burst and looking for the reflection from an object. Both uses are possible but the optimal choice of sensor depends on the use case.

Also, do you have any recommendations on how I could get the signal to transmit.

It's called "troubleshooting". If you're in a school course, you're probably supposed to be learning that skill.

what I should check for in the libraries and maybe what I could alter in the circuit.

There are suggestions already in this thread that you haven't responded to, so there isn't much point in adding more.

I'm writing all this from memory, so the information might be a little inaccurate

Rather than rely on your vague memory of what your instructor might have said, consider doing some reading on line about how IR signals are usually transmitted. There are many tutorials, such as this one.

The library you are using is intended to mimic common IR remote controls, and is not at all useful for sending data packets.

This Serial IR communication link may help

...R