The average microcontroller like on your Arduino has only limited ‘strength’ on the port pins. Typically it might be 2..20mA. Your relay might require 60mA at a guess so you require some means of amplifying the port pin. A transistor or mosfet is commonly used.
Note your diagram is missing a resistor in series with the transistor as the transistor only requires around 0.7V to turn it on. The resistor drops the port pin voltage from 5V down to 0.7V.
I am trying to use a simple Arduino circuit to turn an AC lamp on and off. This is the circuit I was about to try which I got from a website. I don't understand why a transistor is required there. I
electronics.stackexchange.com
در سایت بالا ، فردی سوال پرسیده چرا به ترانزیستور نیاز داریم تا آردینو را ه رله وصل کنیم.... جواش را در بالا من زدم.....گفته خروجی آردوینو باید ۲ تا ۲۰ میلی آمپر باشد ولی رله به ۶۰ میلی آمپر نیاز دارد...
سالک: من فکر کنم وقتی مقاومت مناسب قبل ترانزیستور گذاشتم ، خروجی از میکروکنترلر به فقط ۲ میلی آمپر رسیده بود ... واقعا مقدار خیلی کمی است.
در تصویر بالا از سایت فوق ، ترانزیستور bc547 و یک مقاومت ۱ کیلو استفاده شده..
ترانزیستور bc547 یکی از رایج ترین و معروف ترین ترانزیستورهاست ، من هم چون خونه داشتم ازش استفاده کردم.. ولی حالا می بینم در سایتها هم از همین استفاده شده، ...