Problem controlling a 220V AC Solenoid Valve with Relay and MCU.

Discussion in 'The Projects Forum' started by akirajunto, Oct 21, 2009.

  1. akirajunto

    Thread Starter New Member

    Oct 21, 2009
    2
    0
    I'm having a trouble with my project. I'm making a solenoid valve controller using relay and ATMega8 microcontroller.

    The valve is supplied by 220 V AC. I use the relay to connect valve power line. The relay is driven by a ULN2001 IC and the IC get its input from the microcontroller.

    I tried the controller without connecting the valve to the relay. It worked well, nothing's wrong.

    However when I tried it with the valve connected to the relay, the MCU is reseted every time the relay is switching off to close the valve (the valve is normally closed and the relay is normally opened).

    I think it was because of the EMF suddenly collapsed when the relay was swtiched off. So, I put a diode paralel to the relay input to protect the relay. But it still didn't work.

    Can anyone help me? Should I use a transistor or opto-coupler instead of ULN IC to drive the relay?
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Do you have current limiting resistor(s) between the uC output pin and the ULN2001 input? You should be using a 400 Ohm or larger resistor.

    Do you have the COM pin 9 of the ULN2001 connected to the relay's V+ supply?

    What diode are you using across the relay? Power rectification diodes can be slow. You might try using 1N4148/1N914 computer switching diodes instead. You might also try using a small ceramic capacitor (220pF up to around 470pF) across the diode. This helps to "buy time" for slow diodes to begin to conduct.

    Do you have a 0.1uF bypass capacitor across your uC's power/ground leads?
     
  3. akirajunto

    Thread Starter New Member

    Oct 21, 2009
    2
    0
    I used 1N4007 diode. I don't need a quick switching because the valve is opened and closed between minutes (probably about 15 - 30 minutes).

    Currently, I changed from uln2001 to uln2083 to drive the relays. So far so good. The uC's not restarted when the valves are switching off. I don't know why, but it works.

    I haven't used the limiting resistors. I'll try it if the system go wrong again.


    Thank very much for your advices...:)
     
  4. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    This is not the point. The Diode must be fast enough react before damage is done.
    You still need a limiting resistor.
     
  5. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    I just realized that you didn't post the coil specs on that solenoid. It's difficult to design drivers without this data.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Since the ULN2083 is an obsolete transistor array that was made by Sprague years ago, I think our OP made a typo and is actually using a ULN2803, which is a current part number for a TTL-level 8-channel Darlington array. It has built-in 2.3k base current limiting resistors, so no external resistors would be needed. That was not the case with the ULN2001.

    The 1N400x series will actually conduct fairly quickly; it's the turn-off time that's slow.
     
  7. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Well that would certainly explain why it's not sucking the life out of the Micro.;)
     
Loading...