6
\$\begingroup\$

Are there any microcontollers on the market that would be able to drive this relay directly?

If not, what is the most cost effective way to have a microcontroller control 5 relays?

\$\endgroup\$
  • 2
    \$\begingroup\$ your relay needs 12 V to drive its coil, so you're not likely to find a microcontroller to drive it directly. I think this question addresses the rest of your question: electronics.stackexchange.com/questions/15960/… \$\endgroup\$ – The Photon Jan 25 '12 at 23:41
  • \$\begingroup\$ you may also refer that they explain very clean with c code. Complete tutorial project " Interfacing Relay with PIC Microcontroller" @ nbcafe.in/interfacing-relay-with-pic-microcontroller \$\endgroup\$ – user3220494 Feb 6 '14 at 7:23
  • \$\begingroup\$ Personally I'd describe that tutorial as "very low quality" instead of "very clean". But either way link-only answers are discouraged because they become useless if the link dies, instead you should include essential parts of the answer here. \$\endgroup\$ – PeterJ Feb 6 '14 at 7:45
  • \$\begingroup\$ While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. \$\endgroup\$ – alexan_e Feb 6 '14 at 10:02
8
\$\begingroup\$

No uC (microcontroller) operates from 12V (except for 1 pin per uC for very niche application pins in a very few cases).

30 mA is more than the rated current from any uC

Drivers are easy and cheap.

  • 1 x ULN2803 or similar
    8 lines. $US0.89/1 pricing and datasheet.
    uC drives one input per relay. Relays connect output to +12V. No diodes or resistors etc needed. ie 1 IC and nothing else needed.
    Note that pin 10 (com) should also connect to V+ (12V here).
    Also note other family members (ULN280X).

Hundreds of related web pages


Circuit below same for FET or bipolar EXCEPT FET does not need base resistor.

enter image description here


Relay driving basics

Transistor relay driver

And again

MANY ICs made for the job

\$\endgroup\$
  • \$\begingroup\$ How is using a relay driver different than using a transistor and diode or are they the same? \$\endgroup\$ – Alexis K Jan 26 '12 at 0:54
  • \$\begingroup\$ @AlexisK they are the same, the IC just integrates the transistors and diodes into a single package. The IC drivers will also often employ a darlington pair for more current drive capability. \$\endgroup\$ – vicatcu Jan 26 '12 at 1:39
  • \$\begingroup\$ I have been trying everything out! One quick thing is I switched to a 5V relay. At first I did it the 5 x Mosfet way, like in the picture. It works! Then I wanted to see if I could simplify it a little so I used the ULN2803. However, this chip seems to work, but after about 5 seconds causes the mC to freeze. Any idea? With the mC I am connecting the output pin directly to pin 1,2,3... of the ULN2803. ULN2803 is grounded on pin 9 and at 5V on pin 18. One side of each relay is connected to 5V and the other side is connected to pin 10, 11, 12... \$\endgroup\$ – Alexis K Jul 26 '12 at 21:48
  • \$\begingroup\$ Do I need a resistor between the output pin of the mC and the ULN2803? Any idea about what could be happening? \$\endgroup\$ – Alexis K Jul 26 '12 at 21:49
  • \$\begingroup\$ @AlexisK - No resistor needed usually as ULN2803 has a 2k7 input resistor. Adding an external resistor of a few k ohm will redcue drive loading but too high will cause operating problems due to lack of drice. \$\endgroup\$ – Russell McMahon Jul 27 '12 at 5:59
4
\$\begingroup\$

No, none operate at 12V. Use five suitable BJTs.

\$\endgroup\$
  • \$\begingroup\$ I agree best way is using transistor but why BJT verses MOSFET or other transistor types? \$\endgroup\$ – user968102 Jan 26 '12 at 0:20
  • \$\begingroup\$ BJTs are cheaper. \$\endgroup\$ – Leon Heller Jan 26 '12 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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