Using Optoisolators

Discussion in 'Embedded Systems and Microcontrollers' started by signalflow, Apr 4, 2014.

  1. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    Hi, I am wanting to use an optoisolator to drive a relay but need some help in how to generate the 2 power supplies needed.

    I have 24Vac coming in and create a 5VDC and GND1 with an LM2596 that takes up quite a bit of board space with the external components.

    So how could I create a separate +Vcc and GND2 for the other side of the optoisolator.

    The GND1 is generated by the bridge rectifier that is rectifying the 24Vac. So if I used say a LM7805 to create a 2nd 5V signal, I would still not have a GND2.

    Thanks.
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    Is there any reason you are wanting two forms of isolation, Opto and a relay?
    Max.
     
  3. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    Yes, a lot of noise is getting back into the system when switching the relay. I have tried many things and relay circuit drivers but noise still gets back in when driving the relay to switch an inductive load.
     
  4. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    Have you used any form of suppression/snubbers etc on relays and inductive loads?
    I have performed low voltage switching of high inductive devices with no problem.
    e.g. P.C. 5v TTL parallel port to VHF AC motor controller etc.
    Max.
     
  5. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    Here is the circuit I am using. I have a 120-V fan connected to the relay contacts. If I turn the fan on and off by hand with the fan switch, a lot of noise is injected back into the system. I can see it because the LCD flashes and displays wrong colors and things and sometimes freezes.

    If I use the controller to turn the relay on/off, then I also get the same noise.

    Any idea what I am doing wrong with my circuit?
     
  6. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    A decoupling capacitor across the 5v supply is also required, 100μf - 200μf.
    If that does not work, does the fan have a ground wire?
    If so if may be beneficial to bond the 5v common to the same earth ground point.
    Also ensure the conductors to the fan are twisted not parallel.
    Max.
     
  7. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    I tried 100uF and 200uF across 5V to GND and I still get noise.
     
  8. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    Even if the fan does not have a ground wire, I would try the 5v common to earth ground.
    In the case of the P.C. example I mentioned, the P.P. is connected to earth ground internally.
    Max.
     
  9. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    OK, just tried connected Earth gnd to circuit gnd and still get noise. This is a very difficult problem to solve.

    The LCD runs off of 3.3V and SPI signals. So the noise is either corrupting the 3.3V or the SPI signals.
     
  10. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi,
    From your description it sounds as though the fan motor itself is causing excessive electrical noise, its customary to suppress motor noise as close as possible to the motor.

    On a side point, why do you have a 20R resistor is series with the relay, the relay is specified as 5V operating and you show a 5V supply.

    I would also reduce the value of the 4.7K connected to T12 Base, to say 1K.

    E
     
  11. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    What are you using to supply the 5v?
    Also what is the exact nature of the fan? Simple shaded pole motor?
    Max.
     
  12. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    24Vac comes in and is rectified and goes through a LM2596 simple switcher to generate 5VDC.

    I am just using a honeywell house fan (120VAC) right now, but will be using the relay to control more powerful 240Vac fans and motors. Trying to get all of the noise filtered out so that the relay can drive anything.
     
    Last edited: Apr 4, 2014
  13. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    Did you make note of the comments eric made?
    You could try a isolated 5v supply, say a 6v cell with two rectifiers in series, just to eliminate the supply side.
    Max.
     
  14. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    Why do you suggest reducing 4.7K on base of T12 to 1K? To drive T12 into saturation further?

    I think I had the 20 ohm resistor just because I reduced the resistor value until I was able to get the relay turned on. I suppose it limits the current that is required, but I could remove that 20-ohm resistor. Would just use more current and I am driving 6 relays.

     
  15. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    Also is there any particular reason for going with negative logic for the outputs?
    Otherwise I would have tended to use a single 2n7000 to drive the relay, less components with positive logic.
    Max.
     
  16. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    I found I was able to get closer to 5V output when just using the 1st transistor (T13) as a PNP than using a NPN. The voltage gets closer to the rail with the PNP for some reason...can't remember why. That way I can use the DIGOUT signal as just a 0-5V signal with some current capability or I can use it to drive a relay.

     
  17. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    With the 2n7000 there is no drive current requirement it drives a relay direct.
    The 2n7000 was designed for this.

    "The 2N7000 has been referred to as a "FETlington" and as an "absolutely ideal hacker part." The word "FETlington" is a reference to the Darlington-transistor-like saturation characteristic".
    Max.
     
  18. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    I connected an external 5V power supply to use for the 5V of T12 and GND of T12, but it wouldn't work unless I connected the GND of the external power supply to the GND of my board. So basically I was able to isolate the 5V supply of the board from the 5V of the relay, but could not isolate the GNDs. I still get noise going when switching on the fan.
     
  19. signalflow

    Thread Starter Member

    Mar 12, 2014
    50
    0
    I also tried replacing the T12 directly with a NUD3105 (specific for driving a relay) and I still get noise problems.
     
  20. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,684
    2,746
    signalflow,

    You are doing something really wrong, but it's hard to tell what. Can you post some photos of your setup?

    What you are trying to do has been reliably done ad infinitum. This has got to be an issue of long wires or ground loops or something like that.
     
    Last edited: Apr 4, 2014
Loading...