Beam-break sensor w/ reflector panel

Alright, update time…

I just uploaded the sketch IRrelay on an Arduino pro Mini 3.3V and hooked it up with a VS1838B IR receiver. I won’t paste the code right here but essentially it decodes incoming IR signals and outputs it in some format to the Serial Monitor. When pointing a random IR remote to it it reads:

Could not decode message

Raw (70): -15298 150 -50 8550 -4400 550 -600 550 -500 600 -500 550 -600 500 -550 550 -550 550 -550 550 -550 550 -1650 550 -1650 550 -1650 550 -1650 550 -1650 550 -1650 550 -1650 550 -1650 500 -1650 600 -550 500 -1650 600 -1650 500 -550 550 -550 550 -550 550 -550 550 -550 550 -1650 550 -550 550 -550 550 -1600 600 -1650 550 -1650 550 -1650 500

So far so good.

I then uploaded the following code to an Arduino Uno 5v with an IR led hooked up through pin D11 along with a 150ohm resistor.

According to another post i found this should modulate the output to 38 khz although I don’t understand much of it:

const byte LED = 11; // Timer 2 “A” output: OC2A

void setup() {

pinMode (LED, OUTPUT);

// set up Timer 2

TCCR2A = _BV (COM2A0) | _BV(WGM21); // CTC, toggle OC2A on Compare Match

TCCR2B = _BV (CS20); // No prescaler

OCR2A = 209; // compare A register value (210 * clock speed)

// = 13.125 nS , so frequency is 1 / (2 * 13.125) = 38095

} // end of setup

void loop() { }

Now when pointing the IR led to the IR receiver it reads:

Could not decode message

Raw (10): -15530 50 -300 100 -250 350 -150 100 -100 50864

Could not decode message

Raw (44): -3052 100 -400 100 -1050 350 -1800 100 -950 100 -200 600 -300 100 -250 100 -150 100 -200 100 -200 100 -200 100 -150 100 -300 100 -100 24406 -50 250 -200 100 -500 100 -1600 100 -250 100 -1550 50 -1400 100

FFFFFFFF (0 bits)

Raw (28): -6800 100 -1700 100 -150 100 -4350 100 -1000 100 -750 100 -1550 100 -2150 100 -1700 400 -2550 100 -2050 100 -150 100 -800 100 -3450 100

So something IS getting through.

Now I just need to figure out how to make the receiver act as a “beam-break” and do something when there’s no input.

Next step is upscaling the IR LEDs for more power and testing with reflector over different distances.

Any inputs as to how I should code the receiver?