EveryCircuit
Contact
Reviews
Home
TimoM
modified 10 years ago

Arduino controlled Relay

6
11
346
05:24:44
This version can be used to power devices such as lamp which are connected to the mains. It's based on a BC547 NPN transistor, with a max rating of (I believe) 30V and max 100mA. It is controlled by an Arduino, whose pins have a current max of 40mA. In this circuit, you could power the relay directly, but in my build I will use relays which draw currents of over 40mA. You can use this to power on/off your lamps at a certain time or signal, if you want check out my other latest circuit for an idea of an IR remote control for the Arduino Enjoy!
published 10 years ago
flowDAQ
10 years ago
The ATmega328p is rated at 20ma not 40ma. 40ma is the absolute max. The data sheet says operation over 20ma will reduce it's life.
TimoM
10 years ago
@flowDAQ Thank you for that note! Fortunately this circuit operates at currents far below that, I'm glad for your tip! :)
hurz
10 years ago
I know beginners somehow like more the common collector circuit. But its this way only for Arduino Uno 5V family. Better drive it as 12V relay with OC transistor. Logic negation can be made easy in SW. I like to use the Arduino Due which has a 3.3V interface.
MmmAaaXxx
10 years ago
i made a switch indicator from this.
MmmAaaXxx
10 years ago
its link is this: http://everycircuit.com/circuit/4640475634466816
hurz
10 years ago
Triple-Max cloned this circuit and added 40Watt resistor, awesome bullshit extension. Keep on troll.
flowDAQ
10 years ago
@hurz that Due is made by Arduino.org, so I'm wondering what you think about the little war going on.
flowDAQ
10 years ago
@TimoM consider if the NPN transistor has its emitter connected to the gound. It then needs a resistor (something like 330 Ohm) to limit the current into the transistor base. The transistor could sink current through the coil from the 12V supply (e.g. as a common emitter, see @Hurz suggestion). This would allow most of the 12V to drop across the coil. Unfortunately, as it is shown now only 4.2V drops on the coil, and 7.8V on the transistor. A 12V relay typically needs more than 4.2V to turn on so I am guessing you have a 5V relay. The Due can not source as much current (probably 5mA?) so a 1kOhm may be needed at the base, but the same circuit may work from a 3.3V pin.
hurz
10 years ago
I haven't heard about a war? Why and who about what ;-)
TimoM
10 years ago
@flowDAQ Oh alright that's true! I was using a 12V relay, it would draw 42mA which are 22mA more than the Uno's recommended limit
flowDAQ
10 years ago
An old link but... http://hackaday.com/2015/02/25/arduino-v-arduino/

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2026 by MuseMaze, Inc.     Terms of use     Privacy policy