Smart IR Beam break monitor.

I'm new to Arduino.
I have a project to build transmitter and receiver pair with IR Led and IR silicon PIN Photo-diode and I have all the parts for it.
I Need to build a Smart Beam Break barrier i want to send a random 8 bit word, modulated on a 5-20Khz frequency to IR led.
In the receiver side a Silicon PIN Photo-diode.
1st thing is: I dont know how to send a random 8 bit word on a modulated frequency.
I wish to start with a simple 5 to 20 Khz modulated fixed 8 bit word to be send every 500ms and analyzed from the photo-diode connected to Arduino input.
I want to be able to change the frequency to study the frequency response from it.
I want to analyze the Time pass from send.
and to analyze the Receiving signal level.

2nd thing is: All IR apps ON Arduino Forums I found where using the 38Khz module detector, I cant use it with the need of variable frequency, and I have all the parts for making it.

Does somebody have an idea of an Arduino sketch for doing it.
I will appreciate any idea or a referred link.

look at interfacing a tv remote to arduino that will give you a good idea on how to proceed

look at interfacing a tv remote to arduino that will give you a good idea on how to proceed

...except that TV remotes typically use 38 - 40kHz modulation.

5-20kHz is a pretty easy proposition to encode, but decode would be tricky, unless you just decide on a single frequency.
Maybe use a common PLL chip like a 567 (?) to help you.

unless you just decide on a single frequency.

i can start with fixed 10 khz
Do you have an idea ?

I found this link Detecting an IR Beam Break with the Arduino IR Library
How i can use it for my need w/out the 38 Khz .
just make it to work with let say 10 Khz using IR photo-diode.

this is the sample of the code from the link.

Does someone have an idea ?

#include <IRremote.h>

#define PIN_IR 3
#define PIN_DETECT 2
#define PIN_STATUS 13

IRsend irsend;
void setup()
{
  pinMode(PIN_DETECT, INPUT);
  pinMode(PIN_STATUS, OUTPUT);
  irsend.enableIROut(38);
  irsend.mark(0);
}

void loop() {
  digitalWrite(PIN_STATUS, !digitalRead(PIN_DETECT));
}

Looks to me like that is written for a 38kHz transmit rate (simple) and a 38kHz (hardware) demodulator.

It has already been pointed out that demodulation at frequencies other than the common 38 or 40kHz ones will require some effort on your part.

What is your reason for avoiding 38kHz?

What is your reason for avoiding 38kHz?

First not to expose to other 38 Khz around (security)
And later to use other kinds of light sensors but the IR one.
if the high 10 Khz is a problem, i can start with less then that, let say 1-5 Khz .
will it be posible to play with this code ??

  irsend.enableIROut(38);

Thanks for your replys
/me

will it be posible to play with this code ??

irsend.enableIROut(38);

Sending (out) is simple.
You seem to be having a hard time understanding this.

Sending (out) is simple.
You seem to be having a hard time understanding this.

I'm having hard time understanding how to get the signal form the IR photo-didoe in and anlyze it.
Send out was not a problem.

The sketch in the sample use a 38 Khz fixed IR decoder.
I need to use other modulated frequency.

So, get some other fixed frequency decoder.
(Hint: the decode wasn't done by the AVR)
Did you read reply #2?

I can imagine it would be quite hard, especially if there are other IR transmissions going on.
Rejection of these tones without hardware-assist makes to fairly sophisticated software.
Remember the software engineer's mantra
Fast. Cheap. Reliable.

Pick two.

I know i can skip my 555 20 Khz hardware and make it with Arduino later.
And sure i have to add hardware to the receiver.
A bandpass and a detector amplifier like the MC3373 i have in stock.

If the Arduinu is able to transmit data to other Arduino on IR connection.
Sure it can do that !
That way of connection is a simple packets of words send over IR.
So it can do that!

So, If I want to send a simple fixed 8 bit word (like any remote control do)
On let say 500 Hz carrier ? sure the Arduino can handle this !

Lets make it simple and skip the carrier first !

The sketch should first just choose, store and send an 8 to 16 bit random word.
Or make it simpler, A fixed chosen word for a start =”1100101010” or what ever.
Include start and end bits, delivered every 500 ms with no frequency carrier.
Then expect the same signal at the AT input pin.
Analyzed it by signal level and duration of receiving -.
By checking 3 parameters, duration,level and a valid word .
after comparing the received word and signal with the stored 8 to 16 bit random (or fixed) word and a fixed level trigger and duration I'll choose by trial, And flag a successful reading.
If it notice a change in parameters for few low level readings it will flag this out.

It should done just by comparing. i'm not sure, or maybe by sampling ADC, what do you think ?
After that we will deal with the frequency carrier and other things.

Should be simple .
Does any one can help me with this sketch ?
I will appreciate any help.

A basic idea is to imitate the olds MC145026-27-28 and make the coding with a software.
Its a simple sketch i think !
/me