0
\$\begingroup\$

This is circuit diagram

I'm working on a project where I'm using 8051 microcontroller as a primary microcontroller which is interfacing with 4 relays. I have tested relays with two of my arduinos but when it comes to AT89S52 it hardly turn on a single relay.

I measured output voltage of Arduino pins with was connected to relays which was 5.12 V and 5.8 V respectively but when it comes it AT89S52 it gives 4.86 V. My relays need 5 VDC as an input which I'm giving externally and grounding nicely everything.

This is my relay board This is my relay board

I'm powering Arduinos by my PC and AT89S52 is powered by 12 V which is converted to 5 V with LM7805.

Need help!

\$\endgroup\$
12
  • 2
    \$\begingroup\$ A microcontroller can't drive relays directly, buffer the signal with a transistor, for example. \$\endgroup\$ Apr 4, 2023 at 18:00
  • \$\begingroup\$ You need to provide schematics what you connected to where and how. Otherwise we don't know what the error is and where so we can't provide an answer how to fix it. Although you say you need help, you don't say with what exactly you need help with and you also don't ask a question, so edit in the question you want answered. \$\endgroup\$
    – Justme
    Apr 4, 2023 at 18:02
  • 1
    \$\begingroup\$ Without the resistor you would not measure 4.86V on the output, it would be more like 0.7V to 1.0V. Perhaps you have a wiring problem and the transistor is not getting the signal from the output. \$\endgroup\$
    – user253751
    Apr 4, 2023 at 18:31
  • 1
    \$\begingroup\$ I also checked the first image from post which does not have them. \$\endgroup\$
    – user253751
    Apr 4, 2023 at 18:33
  • 1
    \$\begingroup\$ You now have two different schematics. Which one is which? \$\endgroup\$
    – winny
    Apr 4, 2023 at 18:33

2 Answers 2

0
\$\begingroup\$

From the AT89S52 datasheet:

enter image description here

The device only guarantees 60 uA (and that at 2.4 volts output). This is not enough current to drive your relay board properly. You should replace Q1 on your relay board with a MOSFET with a logic-level gate threshold voltage.

\$\endgroup\$
10
  • \$\begingroup\$ Can you please name few of them? a MOSFET with a logic-level gate threshold voltage. \$\endgroup\$ Apr 5, 2023 at 3:17
  • \$\begingroup\$ Look for a N-channel enhancement mode MOSFET in a TO92 package with a gate threshold voltage of around 1 volt. 2N7002 will probably work \$\endgroup\$ Apr 5, 2023 at 13:14
  • \$\begingroup\$ I have 2N7000 FET - N-Channel Enhancement Mode FET TO-92 Package. Will this work? \$\endgroup\$ Apr 5, 2023 at 13:23
  • \$\begingroup\$ It should be fine - the output high voltage is 0.9 Vcc (4.5 volts) at 10uA, and you will be providing less than 1 uA. \$\endgroup\$ Apr 5, 2023 at 13:49
  • \$\begingroup\$ I was going through datasheet of 2N7000 and found ||Gate threshold voltage||V DS = VGS, ID = 250 μA|| 1V || 2.1V || 3V I didn't understand what is V DS = VGS, ID = 250 μA as my microcontroller can source only 60μA according to its datasheet. \$\endgroup\$ Apr 6, 2023 at 4:09
0
\$\begingroup\$

Yes, that circuit won't work, for many reasons.

Typical 8051 MCUs have open drain outputs, they can sink current in but can't source much current, if any at all.

You may want a high side PNP driver for the relay, and a base resistor to limit the current. You may also want to add a flyback diode for the coil so the transistor does not damage the first time you turn the relay off.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.