Hi,
I am building an IR beacon and a receiving sensor for my robot.
I built the sender out of five IR LEDs a transistor and some caps.
As receiver I want to use two IR Receivers TSOP4838(http://www.produktinfo.conrad.com/datenblaetter/150000-174999/171115-da-01-en-IR_EMPFAENGER_MODUL_TSOP_4838__VIS.pdf) in tubes to get a directional sensor. (need to find the correct angle between them so they both receive if pointed directly to the beacon)
To not produce too much overhead and to get a (timing wise) steady signal I do not want to decode any IR remote signals. I just count rising or falling signals on external interrupt pins as long as I need the sensor. Then I compare the results from both sensors.
So far sender and both receivers work as long as I use the IRremote library for sending valid IR remote signals. When I simply generate a 38kHz modulated signal, the receivers seem to give up after some time. As far as I read that’s part of the logic for noise filtering.
What is required to bypass this and keep the sensors constantly outputting signals? I think it can be concluded from the statements at the end of page 5. But I have difficoulties stranslating it into code.
Especially combining the modulation and the signaling. I think I don't get very far here with the tone library.
Thanks
Robert
Code of the receiver/sensor:
volatile long counter0 = 0;
volatile long counter1 = 0;
long wait = millis();
long countexp0 = 0;
long countexp1 = 0;
void setup()
{
Serial.begin(115200);
attachInterrupt(1, count1, FALLING);
attachInterrupt(0, count0, FALLING);
pinMode(2,INPUT_PULLUP);
pinMode(3,INPUT_PULLUP);
}
void loop()
{
if (millis() - wait > 100){
countexp0 = counter0;
countexp1 = counter1;
counter0 = 0;
counter1 = 0;
Serial.print(countexp0);
Serial.print(",");
Serial.println(countexp1);
wait = millis();
}
}
void count1()
{
counter1++;
}
void count0()
{
counter0++;
}
The sender code which works:
#include <IRremote.h>
IRsend irsend;
void setup()
{}
void loop() {
irsend.sendRC6(0xa90, 50);
}
Code of the sender with only the modulated signal (it will be a dedicated sender, so no fancy things with timer or interrupts are needed):
void setup ()
{
tone (3, 38000);
}
void loop () {}