Go Down

Topic: Help with a OPB704W object sensor (Read 674 times) previous topic - next topic

Bean35

I would like to build an optical tachometer with this sensor. Not sure if I need to have any resistors between it and my arduino. I have included a copy of the datasheet. I am a noobie and would appreciate any assistance. Thanks!

RIDDICK

the input diode cant take more than 40mA...
so u should limit it to 20mA...
u can use a resistor for that: (Vcc-1.7V)/(20mA)
e. g: Vcc=5V: (5V-1.7V)/(20mA) = appr. 165R

the output current should be far below 25mA...
u could use an internal arduino IO pin pull-up resistor for that (it is somewhere between 18kR and 50kR):
pinMode(inputPin, INPUT); digitalWrite(inputPin, HIGH);
http://arduino.cc/en/Reference/DigitalWrite

take care to get the polarities right... :)
A and C is +... IIRC
-Arne

Bean35

RIDDICK, Thanks for your response! A + C stands for anode and collector I think?  That means there is a resistor on the anode that is hooked up to 5V . So the cathode and emitter are hooked up to ground? Sorry for newbie questions I am learning alittle more everyday. Thanks again for your time!!!

RIDDICK

yes, i think cathode and emitter can go directly to ground...
that would make sense...
but to b sure u should take a look in the datasheet... they often show example circuits...
-Arne

Bean35

RIDDICK, Thanks again for your response! I was able to find an example and the cathode and emitter do go to ground. My only other question is I think this sensor is analog therefore I will be using one of the analog in pins. Is this correct? Again sorry for the newbie questions and Thank You for your time!!

RIDDICK

in what way is it analog?
in my opinion it is either "on" (light is reflected into the receiver) or "off" (no or not enough light falls into the receiver)...
so u can use any pin that u configured with these commands:
Code: [Select]
pinMode(inputPin, INPUT); digitalWrite(inputPin, HIGH);

or do u want to know if "alot" or "just little" light falls into the receiver?
then u might use an analog pin...
but i dont c how that is necessary to build a tachometer...
i think u just need to count the "light on" phases per minute...
or the time between two "light on" phases...
-Arne

Bean35

Thanks for your response! I was thinking the sensor was an analog device hence use the analog in. Wasn't sure if it would ok to use another input, but seeing the code I understand what you are saying. I am only concerned with reading the time between two light phases. Again thanks for your time!!

RIDDICK

-Arne

Go Up