Go Down

Topic: TSOP34156 Beacon (Read 2144 times) previous topic - next topic

Andy R

I am trying to use an LED as a beacon to a TSOP34156. The receiver successfully reads 12 bit Sony messages using Ken Shirriff's IR library.

The trouble is it is rather slow, at about 30 messages/second. It does not work reliably without the 10 ms delays (see the code below.) Besides speeding it up, the next step would be to add multiple receivers to see which direction is strongest. Ken Shirriff's IR library supports multiple receivers, so this is easy to try. And will also try multiple beacons.

How can this be speeded up? What message format should be used? Any advice on this approach?

Here is the sender's sketch:
Code: [Select]
#include <IRremote.h>

IRsend irsend;

void setup()
{
}

#define WAIT 10

void loop() {
      irsend.sendSony(0xa90, 12);
      delay(WAIT);
      irsend.sendSony(0xa91, 12);
      delay(WAIT);
      irsend.sendSony(0xa92, 12);
      delay(WAIT);
      irsend.sendSony(0xa93, 12);
      delay(WAIT);
      irsend.sendSony(0xa94, 12);
      delay(WAIT);
      irsend.sendSony(0xa95, 12);
      delay(WAIT);
}


Here is the receiver's sketch:
Code: [Select]
#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

int i = 0;

void loop() {
  if (irrecv.decode(&results)) {
    i++;

    if(i % 120 == 0) {
      Serial.print(millis());
      Serial.print(" ");
      Serial.println((long)results.value, HEX);
    }
    irrecv.resume(); // Receive the next value
  }
}

Go Up