Need some help here. I have never worked with photocouplers before, so this is totally new for me.
Ive connected a nec 2501 to control an input to arduino from my car. it should read a car switch (12-15v) on/off.
Connected like this:
Car 12 -> anode
cathode -> 1k resistor -> GND
Arduino 3.3v -> Collector
Emitter -> arduino pin 2
Emitter -> 10k resistor ->GND
The voltage from the car varies from 12V to approx. 14,7V
When its 12V i measure about 1.something volt on the emitter
When car voltage to anode is 14.7Volt, I got 3.4volt on my emitter.
Whats the point of a photocoupler if the voltage varies like this?
Or is it badly connected?
Double check the pinout, what you've described ought to work from what I can tell.
You might also try to ground the Emitter of the Photo transistor and place the load resistor in the collector side from Vcc to the Collector and measure there, A low would indicate that the Diode is turned on, A high would indicate that the voltage on the Anode is below 1.5V. I've used the NEC2501/2/4 in that manner many times with great success. If you need a high to indicate a condition, invert your sketch logic.
I've also used to common emitter configuration described by Docedison with the 2505.
I would be interested in a discussion from knowledgable folks about why one might choose the common emitter versus common collector, if all you are interested in is generating a digital signal to be read by an I/O pin.
(you might also confirm that you are getting the right amount of current through the LED - should be about 10 mA @ 12V with the 1k resistor.
Common Collector circuits are emitter followers, based on the photon energy being the same as base bias... If the emitter is at 3 volts then the base internally is at 3.6V... This is the reason why (MY testing notwithstanding) that IMO an Emitter follower is not a good circuit for an Opto-Isolator . Possibly a cheap way to provide positive logic but basically unworkable...