To drive the relay, you need more than 20mA – the current can help one pin drive. This is why you cannot connect the relay directly to the pin of the microcontroller. To drive the relay, you need to connect a simple amplifier made of one transistor.
One important part of this circuit is the diode, which protects the circuit from induction caused when switching the relay.
This circuit is more general than relay; you can connect any other load like lamps, DC motors. If you need to control more than one relay, you might consider using ICs like ULN2003 or ULN2803. These ICs have Darlington transistors inside and can drive up to 500mA each.
In this case, you need to simply write ‘1’ to a port pin to switch on a relay. And current doesn’t exceed the allowed limit of the microcontroller.
Hi,
can you please tell me what is the name of the first cntroller?
thanks,
Belal
hhhhh it’s the AVR Microcontroller (http://www.atmel.com/products/microcontrollers/default.aspx)
can be done by directly connecting relay to a pin and change the status of the pin to hi-Z and sink.(read datasheet)