I am trying GP2Y0A21YK0F Infrared Distance Sensor for detecting movement for two directions, Let’s suppose Left and Right. I am using two GP2Y0A21YK0F sensor for this purpose. It is working fine If I take analog readings and process that data with Arduino Nano.
I wanna convert this analog reading to Digital one to be used as digital input to trigger an interrupt function. For this purpose I am trying LM393 dual comparator. Schematics of How I have connected all the hardware is attached.
When there is nothing in front of sensor, It gives voltage of 0.18-0.20v on multimeter and it’s value may increase to 0.5-0.8 volts if an object is in front of sensor. I have set the reference voltage for LM393 at 0.35v, as I want 0 signal (LOW) as output if the voltage across analog pin of sensor exceeds 0.35 volts which is adequate for sensing movement of an object from one direction to other within range of 2.5 feet.
My problem is, LM393 returns 0.30 to 0.60 volts across it’s output pin when there is an object in front of sensor (I have connected Red wire of multimeter with +5v and Black wire to output pin of LM393) while it should give 0 volts as being connected to ground.
Moreover, this output value fluctuate 0.05-0.1 volts and I cannot set the interrupt for Rising or Falling.
May someone helps me?