Arduino TX drops voltage on optocoupler input

Discussion in 'The Projects Forum' started by Holchr, May 20, 2016.

  1. Holchr

    Thread Starter New Member

    Apr 18, 2016
    I am having a weird problem i cant figure out. I am trying to optically isolate a computer from arduino. So i got an arduino nano and a usb2serial for arduino. However when i connect the tx pin form any of those to an optocoupler the voltage of the tx pin drops from 5v down to 1.25, 1.33, depending on the value of R1 (see image). The optocoupler does not open at that point given that the forward voltage for the diode is not reached.

    I am quite baffled,
    the optocoupler is HCPL 2201, it is working properly I tested it.
    In a test connection like the one from the image, the current passed through the input stage is about 20uA, where it should be around 3mA.


    I tried posting this question on Arduino forum however I got an answer to "Look up ohm's law", so yeah, got agitated, and decided to come here to ask people that actually know something. :)
  2. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    You are just driving an LED..
    An LED needs to be "fed" a constant current... not a constant voltage..
    The resistor is setting the amount of current fed to the LED..

    The formula is
    (Vin-Vf)/I where I is the current required (in amps) and Vf is the forward voltage rating of the LED.. More specifically its just E/I=R but since the LED is "eating" 1.8V your working voltage is source voltage minus the voltage the LED is eating..

    So t0 calculate the resistor you need this is the math
    1.8 is the forward voltage drop of the LED (I think according to the datasheet) and you should feed it 5mA of current
    (5-1.8)/.005 = 640 ohms (this would be the ideal resistor to feed that LED 5mA)

    Since you are using a 1k resistor you are actually feeding the LED with
    E/R = I
    3.2/1000 = .0032 so 3mA which is fine too..

    Everything is working as it should.. Stop worrying about the voltage..

    And look up Ohms Law... :pSpecifically google images search for "Ohms Wheel" for a simple image showing all the different formulas.. Not really all ohms law but its called the ohms wheel..
  3. Holchr

    Thread Starter New Member

    Apr 18, 2016
    Well the thing is that it is not working as it should. I know about the led and feeding current and ohm's law. That is why i am baffled by the problem. I am measuring current and it reads about 20uA not 3mA as it should. And the voltage across tx and gnd should not drop by 75%.
  4. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    How are you measuring the current? In series? (aka you disconnected the circuit and inserted your meter in series?)
    Good meter?

    Any reason you need isolation? The nano already has the FTDI USB to serial on it already doesn't it.. whats wrong with that?
    I'm not sure what may be causing problems if thats still in the circuit.. Not sure what "magic" the FTDI chip is performing and how it might be loading everything down..
    Its Friday and I just cracked a beer (Guiness Blonde) and have shut my brain off for the rest of the week.. Good luck..

    I've been plugging arduinos in to computers right through the USB plug and never worried about anything..
  5. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    The tx/rx I/O connector pins already have a 1k resistor in series with the chip tx/rx pins on the nano board.