Thats it our circuit is complete now we can upload the code to the arduino to turn on or off the relay.
Arduino transistor relay circuit.
In this arduino relay control circuit we have used arduino to control the relay via a bc547 transistor.
The arduino can only provide 40ma at 5v on its digital pins.
Usually an npn transistor in a common emitter configuration used as a switch drives the relay.
An ac bulb is used for demonstration.
Basically when 5v flow through the 1k resistor to the base of transistor a current of about 0005 amps 500 microamps flows and turns on the transistor.
Circuit diagram and working.
The parts you will need.
We have connected transistor base to arduino pin a0 through a 1k resistor.
First leg of the potentiometer is connected to 5 volts.
The picture above shows the circuit you need to build.
The optocoupler is the most important part it isolates the circuit from the relay using.
Arduino board jumper wires breadboard.
2 x 220ω resistors.
Here is a simple circuit that uses a bipolar junction transistor bjt to drive a small 5 v relay coil.
The transistor in this example completes the motor s circuit to ground.
Schematic view of a potentiometer and transistor connected to an arduino.
The second leg connected to analog in 0 of the arduino.
The base of the transistor is connected to digital pin 9 of the arduino through a 1 kilohm resistor.
A transistor can act as a digital switch enabling the arduino to control loads with higher electrical requirements.
The third leg is connected to ground.
1 x 1n4001 diode.
Basically when 5v flow through the 1k resistor to the base of transistor a current of about 0005 amps 500 microamps flows and turns on the transistor.
Thats it our circuit is complete now we can upload the code to the arduino to turn on or off the relay.
1 x sharp pc817 optocoupler.
I just programmed the arduino and attach with my homemade relay circuit board and connect all four appliances with the relay board.
Most motors require more current and or voltage to operate.
So whenever i turn the arduino the first relay is on and its on for 3 seconds and after that it goes off and the second relay is on 3 sec similarly for third and fourth and after fourth all will be off for 3 seconds and after that all four legs will be turned on.
1 x tip120 darlington transistor is recommended but any one that will handle your relay will work.