0
\$\begingroup\$

I am trying to make sure I have the right schematic for driving my 12 V relays using ESP32 GPIOs.

I am using a 1 kΩ resistor between transistor collector and GPIO. Then taking the transistor base to relay with a diode between relay coils. I have 12 V going to other relay coil label is VCC for that.

I have been trying to test on a breadboard and can't seem to identify what is the right path. I have 2 schematics I believe 1 is correct. Possible to let me know if 1 or 2 is correct or if they are both wrong.

Schematic 1: enter image description here

Schematic 2: enter image description here

New contributor
Maxwell Monson is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$
2
  • \$\begingroup\$ Both are wrong. In both pictures, there is no power to relay coil to do any switching. Also you used base and collector swapped in your text but in the drawing you use the transistor OK. But it can't be guessed what you want to do. \$\endgroup\$
    – Justme
    Commented Sep 5 at 4:40
  • \$\begingroup\$ @Justme Thanks for the quick reply. the end goal is to drive the relays to provide the 2 pin terminals with 12v/ground when triggered. Possible you could let me know what pin #'s are the relay coils. I guess I thought they were either 4/3 or 2/1. which I am providing 12v to 1/3 then gpio goes to 4/2. \$\endgroup\$ Commented Sep 5 at 4:44

1 Answer 1

3
\$\begingroup\$

Neither one is correct. The coil is pins 1 & 4. The diode is correct so either the collector goes to 1 and Vcc to 4 or the reverse. Based on the diagram in the schematic symbol you have and presumably some mapping of those pin numbers to a footprint.

However there is also no standard numbering for that footprint (AFAIK) so you should take care that it matches the relay datasheet

enter image description here

Take particular care that the diagram shown is from the bottom rather than from the top as is typically done for modern components. If you propagate a mistake from the view being wrong, the relay will operate but NC and NO will be swapped.

\$\endgroup\$
3
  • \$\begingroup\$ @ Spehro Thank you for this! I was on this data sheet and just could not figure out how it translated to my schematic. I picked that relay as it is on most relay boards I had used before. Would you recommend a different or is that a good option? \$\endgroup\$ Commented Sep 5 at 4:49
  • \$\begingroup\$ It’s a common design and very inexpensive, whether it suits your application is another question. \$\endgroup\$ Commented Sep 5 at 5:17
  • \$\begingroup\$ BTW, try to suss out the meaning of the symbols. The coil in the relay datasheet represents the literal coil that is an electromagnet. The middle dot to the left represents a pivot, and the contact goes from the 'top' pin (as shown) down to the 'bottom' pin, when it is energized (the relay is shown in the de-energized state). With your numbering scheme you'll measure continuity between 5 & 3 when de-energized and between 5 & 2 when energized (5 is the 'common'). Never between 2 & 3. \$\endgroup\$ Commented Sep 5 at 7:36

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.