Ir emitter receiver deception ....

please advise
I wanted to do 'some kind' of tachometer. I believe that was a simple idea.
An arduino board. IR emitter and receiver. they both in front of each other and counting the interruptions will make me a tachometer ...
The receiver is given me 1 where is not emitter close. When the emitter is close I EXPECTED to get a lot of '0' but I did not I still get 1 mixed with 0 ????
I am printing them in the serial port and lighting the 13 led and despite the emitter is right in front of the receiver I still getting a lot of 1
May be those are not the right sensors for this ?
I know about programing but nothing about electronics....
Any help?

need more detail to assist (type of receiver/emmiter,circuit etc)

Also needed is the schematic of how you wired it up along with the code that got you your results.
Read the how to use this forum sticky for how to post code correctly.

here is the very simple code

int val = 0 ;


void setup()
{
  
  Serial.begin(9600);
  
  pinMode( 45, OUTPUT );
  pinMode( 13, OUTPUT );
  
  pinMode( 40, INPUT) ;      

        
  digitalWrite(45, HIGH); 
  digitalWrite(13, LOW); 
        
  
  
  Serial.println("Hello world");
  delay(1000);
        
}


void loop() {
  
  val = digitalRead(40);
  Serial.println(val);
  
  if ( val == LOW ) {
    digitalWrite(13, HIGH);
  } else {
    digitalWrite(13, LOW);
  }
  

  
}

there are the drivers I bought

http://www.ebay.com/itm/5x-Digital-38KHz-IR-Transmitter-and-receiver-Sensor-Arduino-51-ARM-Compatible-/300767494677?pt=US_Wholesale_Radio_Communication&hash=item460723c215

the one I got looks a bit different than the pictured.
the board is black and I can read the word 'keyes'
any way they have the same connections vcc ground and signal

I tried to make work the only emitter and sensor I could get in town but I could not ... as I said I know nothing about electronics.... :frowning:

so I use those I got from ebay

The IR receiver seems to be a detector/decoder for IR remote signals. It will only give an output in the presents of an
38Khz carrier modulated by remote control codes. For a tachometer you would use an IR phototransistor and emitter.
Then you detect, with the phototransistor, the presents or absents of unmodulated IR light.

First of all thanks a lot for your help

I am not sure if I get I got that right.
Did you mean that receiver is some kind of specialized receiver for remote controls ? and I should use a simple emiter and receiver ? those that looks like leds ?

Yes, that is what I meant.

You could also try to use what you already have, by sending out a continuous 38Khz modulated IR signal from your IR LED.

Your IR receiver, will then output LOW (circa 0V) on the signal line when it receives this modulated signal and HIGH (Vcc 5V or 3.3V) when the beam is interrupted.
This signal line can be fed into pin 2 to drive an interrupt on INT0.

As long as your target timing measurement for interruption is above 100 microseconds this should work for you.

If its close range you should be able to drive the IR LED directly from the Arduino without using a transistor.

Caveat: some of these IR receivers are not optimised for continuous rx, but I expect in many situations it would be OK. Its worth a try as the modulated signal removes most of the potential for interference from ambient light sources, whereas a direct LED to LED soultion could suffer more from interferences.

There are also dedicated sensors for these types of solutions - search for sharp ir sensors.

ANother way to design your solution is to have the IR LED & receiver side by side (but shielded from each other) and to use a reflection approach vs an interruption approach as in your post. The advantage of this is that you can do it all from one location, rather than having your receiver & transmiter on both sides of the 'thingy' that is breaking the beam. Applying something reflective can also help or even just gluing a small piece of white paper.

Caveat: some of these IR receivers are not optimised for continuous rx, but I expect in many situations it would be OK.

No it will not be OK. These sensors need pulsing with modulated IR otherwise they stop responding. Normally they give up at about 50 cycles of modulated light.
There is one specific sensor made for light barriers that is not built like that but this is not the sensor the OP has.

@Mike
I just happen to have a wide range of such sensors from Vishay in my box, so i decided to do up a circuit to test it out on a few 'standard sensors', and as expected it works as per my post. I verified it visually on my oscilloscope.
(I had done something similar a couple of years ago on a hobby project, which is why I suggested it)

I understand your point, in that particular sensors are optimised for different IR protocols etc. The data sheet also says that they will block out "Continuous signals at any frequency" . I suspect that this may apply to signals from across the room (ie normal use), but close up it may be that this part of the internal circuit is somehow overloaded.

In my test I had the IR led a few cm away from the receivers. So the OP should indeed try it out, given the parts are already to hand.

If the OP does find that the continuous signal is blocked out by the IR receiver, then the next step would be to use a reflection approach as I suggested which should overcome this obstacle, if present.

but close up it may be that this part of the internal circuit is somehow overloaded.

I could be.
I have used them at 4" range and they will not work with a continuous modulated signal but I haven't tried them any closer.
Must try that some time.
Thanks.

Is this your device?

There's a pretty recent thread talking about these —

http://forum.arduino.cc/index.php?topic=178137.0

Not sure if will help much....at all? But, more info is usually better, right?

Good luck!