1
\$\begingroup\$

I'm working on a project with a raspberry pi involving some sensor and a relay. Actually I'm Using a board like this one: enter image description here So I connect GND,5V, and a GPIO to the IN pin to control the relay state: ON/OFF.

Now I'm starting to move from the prototype stage..

I'm working on create the PCB, and I'm wondering if I can drive the Relay, with a "naked" version like this:

enter image description here

  1. is it possible? Why all the other components are required on the board, figure 1? resistor, transistor etc..

  2. I'm expecting to connect:

    • D to the source and one between A or B to the destination
    • C to GND
    • E to a GPIO ..correct?
  3. Maybe I'm using "rocket to kill an ant".. I'm using the relay for control a low voltage (between 12V and 24V DC)..is there any more appropriate component or integrated circuit that you can propose?

\$\endgroup\$
0
\$\begingroup\$
  1. The transistor is used to drive the coil that activates the relay. The diode is a flyback diode which is used to discharge the coil when switching the relay off, otherwise the transistor will be damaged. You need to design those components onto the board if you want to use this relay "naked".
  2. Basically, you are right but you need a transistor to drive the relay because the microcontroller can't deliver the required ~90mA at 5V.
  3. It looks a bit overdesigned if you only want to switch 24 VDC. It depends on many parameters (current, voltage, switching frequency) which relay you can use.
\$\endgroup\$
  • \$\begingroup\$ 1) ok so it works also as a protection 2) I suspected it.. :D 3) it's a signal \$\endgroup\$ – Andrea De Gaetano Dec 28 '16 at 12:49
1
\$\begingroup\$

1) You cannot control the relay directly from an Rpi board, you have to use at least a transistor with base resistor (or a mosfet) and a flyback diode. That is what is on that small board.

2) no that is not how you should connect it. It will not work like that.

3) Yes there are other ways to control a different low voltage but I do advise to stick to a relay solution using that small board as it is cheap and reliable and you do not need to think about shared ground connections etc. You could implement the circuit from that small relay board yourself but believe me, it is not worth the trouble.

\$\endgroup\$
1
\$\begingroup\$

It probably uses this circuit: -

enter image description here

By the looks of it the diode is a 1N400x type and the input resistor looks like 150 ohm (marking 151).

Maybe I'm using "rocket to kill an ant".. I'm using the relay for control a low voltage (between 12V and 24V DC)..is there any more appropriate component or integrated circuit that you can propose?

Yes, if the load shares a common 0V with the RPi, you can use a MOSFET like this: -

enter image description here

There can be some simplifications if the supply is only 12 volt - the zener diode can be removed and the lower resistor shorted in most cases.

\$\endgroup\$

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.