I did a lot of reasearch on Relays, Transistors and Arduino GPIO, and I also followed some schematics on other sites. I put my complete circuit into Multisim 11.0 and it worked, but I cannot for the life of me get it to work IRL.

The main problem is, that on the output (collector of the BC547) is a constant 5-6V (even though the arduino pin is set to switch from HIGH to LOW every 1 second), but in reality I need the 12V supplied by my external source to switch the relay.

Here is my schematic (you can ignore the upper part, It's just a AC-DC rectifier):


And here is my breadboard circuit - I checked it multiple times and even tried some other configurations like common emmiter, etc... Breeadboard

P.S.: I'm really new to this SE, so If I did anything wrong please tell me, I have no idea how or what details to post, and what to not post.

  • 1
    \$\begingroup\$ +1 for clear schematic and picture of your setup, without having to ask about it. \$\endgroup\$
    – pipe
    Commented Oct 2, 2016 at 11:25
  • \$\begingroup\$ Did you check the voltage on the GPIO? \$\endgroup\$ Commented Oct 2, 2016 at 11:54
  • \$\begingroup\$ @Ignacio Yes, when I directly connected the GPIO to the LED it blinked, as it should have. But when trying to switch the 12V (to the relay) using the GPIO and the transistor, it fails. \$\endgroup\$
    – niraami
    Commented Oct 2, 2016 at 12:14
  • 2
    \$\begingroup\$ It looks that you dont have the arduino GND connected to the breadboard (therefore transistor) GND. So your Arduino is floating in relation to your transistor, which is why it might work erraticaly or not at all. \$\endgroup\$
    – Wesley Lee
    Commented Oct 2, 2016 at 12:59
  • 1
    \$\begingroup\$ @Areuz -- there it is. My explanation isn't very good but I linked a nice post about this same topic. \$\endgroup\$
    – Wesley Lee
    Commented Oct 2, 2016 at 18:40

1 Answer 1


Your Arduino seems to be floating in relation to the other half of the circuit (Transistor, Relay, and 12V PSU).

Voltage is relative. What this means is that when something says "5VDC" or "12VDC" its in relation to its own 0V.

When you have two or more circuits that are unreferenced to each other, there is nothing that relates ones 0V to anothers 0V. Which means that when you make only one connection, its signal is going to be for example, whatever or however they manage to capacitively couple to each other (i.e. random and erratic).

That's why you have to connect both circuits 0V. So that the 5V from the Arduino is also 5V for the transistor.

For example, if you connected Arduinos 0V to your PSUs 12V, then the signal on the transistor's base would be 17V. (assuming your USB PSU is floating in relation to the 12V).

This question on meta has some nice answers and explanations.

Please note that not everything that seems disconnected is floating: if you measure a mains connected circuit with a scope you will probably let the magic smoke escape (i.e.: explosions, sparks, etc). Your scope will be connected to your circuit through mains.


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.