switching using a 4n 25

Discussion in 'General Electronics Chat' started by jonisonvespa, Dec 31, 2012.

  1. jonisonvespa

    Thread Starter Member

    Mar 25, 2012
    49
    0
    hi
    im trying to switch a +5 to a pin on a auduino project, the switch circuit is in a very noisy environment hence i using an opto isolator, first time ive used one

    have i got my circuit correct? ive limited both led and current to the ic pin to 10ma

    thank you
     
    • 25.png
      25.png
      File size:
      11.3 KB
      Views:
      20
  2. ramancini8

    Member

    Jul 18, 2012
    442
    118
    You don't have the circuits seperated, so the opto doesn't accomplish much.
     
  3. #12

    Expert

    Nov 30, 2010
    16,284
    6,797
    The way you have that laid out, the "+5 volt to pin" is always at +5 volts. I think you need to move the 560r to the top of the transistor, not the bottom.

    The result would be a reversal of the logic. If this is not good, explain your wishes better and we can work something out.
     
  4. jonisonvespa

    Thread Starter Member

    Mar 25, 2012
    49
    0
    ok i think ive got it now ive revised my circuit

    just wondering if there is any way i could use the + and gnd in my circuit, for the (opto part switch)

    and isolate that from the rest of the circuit?

    thank you
     
    • 25.png
      25.png
      File size:
      14.5 KB
      Views:
      17
    Last edited: Dec 31, 2012
  5. #12

    Expert

    Nov 30, 2010
    16,284
    6,797
    That will work.
     
  6. KrisBlueNZ

    Member

    Oct 17, 2012
    111
    14
    I'd suggest increasing the pullup resistor on the collector. A 560 ohm resistor will draw nearly 10 mA from the 5V rail when the optocoupler is activated, which is a bit wasteful. A more typical value would be 10k.

    If you want to interface to an electrically noisy environment, I would suggest using series resistors of 1~10k in both of the wires that go out to the switch (which I assume is in the noisy environment) and a capacitor of say 10~100 nF from the microcontroller input to ground. You will lose the electrical isolation, so there's no reason to use an optocoupler.
     
Loading...