---
+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Full Member level 1
    Points: 1,726, Level: 9

    Join Date
    Sep 2008
    Posts
    101
    Helped
    3 / 3
    Points
    1,726
    Level
    9

    microcontroller relay circuit

    Hello friends,
    I have problem interfacing 8051 controller with relay. I am using 12V relay to ON/OFF. The output port of the controller is set at logic zero, it gives 5V when it isnot active.
    But when inputs are applied it works according to the requirement but it gives 2V, when it is active.
    So if the relay is active it doesnot gets deactived at this point.
    i have attached the relay circuit.
    Plz help me, I need help soon.



    1K resistor is there between output port and base of the transistor.

  2. #2
    Junior Member level 1
    Points: 904, Level: 6
    jeswanthmg's Avatar
    Join Date
    Jun 2009
    Location
    Bangalore
    Posts
    15
    Helped
    2 / 2
    Points
    904
    Level
    6

    relay interfacing

    Dude just add 10K pull up resistor at the port pin.
    its simple



    •   Alt20th June 2009, 18:34

      advertising

        
       

  3. #3
    Full Member level 1
    Points: 1,726, Level: 9

    Join Date
    Sep 2008
    Posts
    101
    Helped
    3 / 3
    Points
    1,726
    Level
    9

    relay circuit for avr

    Like this:



    But the problem is I couldnot get less than 2V when microcontroller is active(that is when inputs are applied). I am using AT89S51.
    It's output is working on logic zero.
    I want to get less than 1V to properly operate the relay.



    •   Alt20th June 2009, 19:15

      advertising

        
       

  4. #4
    Advanced Member level 2
    Points: 17,827, Level: 32
    ctownsend's Avatar
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    558
    Helped
    87 / 87
    Points
    17,827
    Level
    32

    requirement of pullup resistor in 8051 ports

    Quote Originally Posted by Adil Israr
    But the problem is I couldnot get less than 2V when microcontroller is active(that is when inputs are applied). I am using AT89S51.
    It's output is working on logic zero.
    I want to get less than 1V to properly operate the relay.
    try a 4.7K resistor instead of the 1K resistor you are using. (between the pullup and the base on the transistor)

    I use the same with an 89C52 and it works reliably.



    •   Alt21st June 2009, 00:11

      advertising

        
       

  5. #5
    Full Member level 1
    Points: 1,726, Level: 9

    Join Date
    Sep 2008
    Posts
    101
    Helped
    3 / 3
    Points
    1,726
    Level
    9

    8051 relay

    Everything is right whta you people said but my relay doesn't get deactivated, it activates all right but doesn't deactivate because of 2V.
    My AT89S51 gives maximum voltage of 5V when inputs are not applied, but it gives minimum of 2V when inputs are applied, I want to get less than 1V.
    How can I do this??



  6. #6
    Advanced Member level 2
    Points: 17,827, Level: 32
    ctownsend's Avatar
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    558
    Helped
    87 / 87
    Points
    17,827
    Level
    32

    relay tansistor interfacing

    post your code.

    I see the circuit looks fine. Maybe you have a bad transistor, or one of the pins on your 89S51 is blown. Switch to another pin and change the code.



  7. #7
    Member level 4
    Points: 2,479, Level: 11
    herlambang's Avatar
    Join Date
    Apr 2009
    Location
    Indonesia
    Posts
    74
    Helped
    7 / 7
    Points
    2,479
    Level
    11

    74hc less than 1v

    Your circuit use active low.. you should use PNP transistor.. or change your circuit.

    in your circuit, the pin goes high on power on. it's activate the relay directly.
    Built in double watchdog! *problem solved*



  8. #8
    Full Member level 1
    Points: 1,726, Level: 9

    Join Date
    Sep 2008
    Posts
    101
    Helped
    3 / 3
    Points
    1,726
    Level
    9

    how to connect relay with 8051?

    Actually my controller also works on active low, if I cahange the coding and make it active high. Will it work fine??



  9. #9
    Junior Member level 1
    Points: 904, Level: 6
    jeswanthmg's Avatar
    Join Date
    Jun 2009
    Location
    Bangalore
    Posts
    15
    Helped
    2 / 2
    Points
    904
    Level
    6

    microcontroller interfacing relay code

    Dude i thaught i solved your problem i forgot to check my mail
    ok you could change your software code and try
    actually i had same problem then when i added 10K pull up it worked fine
    1K current limitter is fine may be you should check your transistor also see that emitter of transistor is grounded.



  10. #10
    Full Member level 2
    Points: 2,014, Level: 10

    Join Date
    Jan 2009
    Location
    Pakistan
    Posts
    127
    Helped
    10 / 10
    Points
    2,014
    Level
    10

    code of relay interface with microcontroller

    Hi
    Its a very very bad practice to connect a relay with a microcontroller like this. the relay revers voltage will directly afect the microcintroller. here ic is comparitively high thus need more ib too. Use ULN type driver. or atleast use a 2 stage transistor amplifier. Or you can also use Open Collector Inverter or buffer. Or use a 74HC series buffer/inverter/latch and then use a single transistor drive for rlay.


    1 members found this post helpful.

+ Post New Thread
Please login