I have a detector that is basically a single IR receiver at one point, and a series of IR emitters/led's located in various places -- one by one I turn on an emitter and see if I can sense it... This works; if one of the emitters is turned on and I can't receive the light signal, I know there's something covering up the led.
However, I am trying to avoid a future problem (that may or may not exist) which is what if something else generates IR light enough to sense it inside the box (which is white plastic). So my thought is to send a modulated signal...In my head the only way I can work this out is to know what is turned on -- ie: turn on light read it; turn off light, make sure I don't see it, etc. Is there a way to buffer the signals so I can say "Send 3 short and 1 long flash" and then check to see if 3 short & 1 long flashes were seen?
My gut just tells me "no" so I don't want to redo the project only to find out it doesn't work...
You could do the sending with a simple change or 3 to the Blink sketch, using delay to time the length of the flashes and the gaps between.
At the receiver, I think you would need to adopt some timing, perhaps along these lines: (very rough and not thought thru fully)
have two counters, for the long and short flashes, initialise to 0
have a flag (initally set to low),
record the current time with millis() when the receiver first detects input,
set the flag to say the transmitter is being seen,
do nothing each time through loop as long as there is light and the flag is set
when there is no light take the time,
see if the elapsed time was a long or a short,
clear the flag
increment the counter for long or short
check if the counters match the requirements
if so, you saw the transmitter, so clear the counters for next transmitter
if not, carry on
You'll need to work on that though: as I said it's very rough.
Thanks -- that's kind of what I had thought of.
FYI....may still be of interest?.....you can use the fact that IR receivers introduce a lag of the order of 50-200uSecs, which means that if you send a modulated signal, you have 50-200uSecs to detect the signal from the IR receiver after you stop sending. Useful to have an oscilloscope for testing.
I would only uSecs for time measurement for this type of IR project.
See a related article here... Infrared Receivers - signal lag and distortion - AnalysIR Blog
Once you crack this, you should be able to meet your other requirements.
I recently bought a windshield mounted rain-detector (specifically for a bmw, but they all seem to work the same)
It works by sending an IR beam & checking to see if it's bounced back -- so in essence, it is sending and receiving at the same time...
I haven't figured out how I can hack it yet, but there's only 4 lines so I presume 1 pair for power & the other pair for a received signal...
most likely an emitter & photo sensor pair. 2 independent circuits.
something like this...
You can verify one side to be an IR led with your DMM, but always better to get the datasheet from the vendor, as it could already have internal resistors already. Photo? Link?