How to use relay with Arduino to control AC or DC load with bare relay
HTML-код
- Опубликовано: 17 авг 2024
- This video explains how to use or drive 5V relay with Arduino and shows you schematic .
**** Free Arduino Course worth $200***
Arduino Step by Step Course (over 100 lectures) Starts here robojax.com/L/?...
I will reply to all Subscriber's 🔔 questions. So make sure to Subscribe.😊
Please like 👍 the video and type simple word in the comment. It helps me a lot.
Get the code and other resources for this video robojax.com/L/?...
** Purchase Bare Relay from **
Amazon Canada: amzn.to/3B1iu9Z
Amazon USA: amzn.to/3AXO6xc
All other Amazon: amzn.to/3AWxeaj
Banggood (1 pcs): www.banggood.c...
Banggood (10pcs): www.banggood.c...
AlExpress (10pcs): s.click.aliexp...
** Purchase Arduino Start Kit **
Amazon USA: amzn.to/3z88F9G or just UNO board amzn.to/3aY7KOL
Amazon Canada: amzn.to/31an88J or just UNO board amzn.to/3pYxSNN
Amazon Europe (all Europe): amzn.to/3pMCHge or Just UNO board amzn.to/2PgGItD
AliExpress: s.click.aliexp...
Banggood: www.banggood.c... or UNO board www.banggood.c...
eBay: ebay.us/B1JWLi
***** Purchase Authentic Arduino Uno from ***
Amazon USA: amzn.to/2KApAwK
Amazon Canada: amzn.to/37LZ8sW
All Europe Amazon: amzn.to/36YDSzn
00:00 Start
00:40 Introduction
01:13 Hardware explained
05:00 Wiring explained
06:17 Code explained
10:43 Demonstration
Watch my video on 5V relay module to control AC bulb: bit.ly/5v-relay
Tutorial by Ahmad Shamshiri form Canada
****************************
Arduino Step by Step Course (over 100 lectures) Starts here • Lesson 00 What is Ardu...
****************************
If you found this tutorial helpful, please support me so I can continue creating contents like this. Here is PayPal link paypal.me/robo...
Follow me on Facebook robojaxTV
Follow me on Twitter: / robojaxtv
Follow me on Instagram: / robojax
Tutorial by Robojax.com
Get other projects code and learn Arduino
robojax.com/lea...
*** AFFILIATE PROGRAM ***
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.
#robojax #robojax_relay Наука
This is so far the best arduino basic tutorial! Good job
Thank you for your kind comment.
Finally somebody who explained it in a good way.
The best " How To" videos. Thanks !
you are welcome.
I'm starting off from ground zero building an electronically controlled air / wood gas carburetor , using Arduino, an O2 sensor and servo motor to operate the carb's butterfly valve in order to compensate for rich/lean conditions. Your videos have proven to be a great help towards this goal. Much appreciated !
Best Tutorial Ever !!
I am glad you liked it. You may watch my $200 udemy course for free ruclips.net/video/-6qSrDUA5a8/видео.html
Excellent! I think this video is good! Your video was great! I can do things myself with the Arduino! Thank you! 👍😉😎
Glad it was helpful!
well explained ... my quesstion is ,, is it possible to use IN5399 Diode?
You are the best sir, thanks for sharing this video
You are welcome. I am glad you found useful. Ahmad from Canada.
Absolutely fantastic description. Keep up the good work. Brilliant!
Thank you.
can i use it without the transisor, only with a HIGH pulse and ground connect to the coil ?
No you can't. why would I have bothered to waste time and efforts to make DRIVER? without driver your Arduino board will die. This relay needs 70mA while Arduino digital In/out pin can supply only 30mA see it here and click "TECH SPECS" store.arduino.cc/usa/arduino-uno-rev3
This video was perfect for my application and I was able to complete my PCB. However, I just learned about optocouplers and this may be a far easier approach. Nonetheless, thank you for your time, schematics, and explanation!!
Yes optocoupler can be used to protect or isolate stages of project, but it will as extra component to the circuit and cost. If isolation bid not critical, we should not use any extra components. Good luck and stay safe.
I just connected 2 pin of 4 pin-relay (SRD-05VDC-SL-A) . One to pin 9 and one to ground of arduino pro mini - without any resistor. And one cable of 220 lightbulb to relay's NO pin, and it worked perfectly. Is that dangerous? Can I fry or destroy my arduino this way?
what resistor(Diode) should be connected to 5 volt relay to avoid flickering?
value of resistance please...
Here is the video ruclips.net/video/x2YxfV1L02Y/видео.html you could just search for "resistor" on my channel.
What is the power rating of the bulb you have used?
it does not matter. the relay is a switch. Just read your relay. if it says 10A, then connect it to 10A or so.
Great! Is it possible to put a potentiometer to speed on/off? ✌️
Search my channel to find more or see this ruclips.net/video/6DGQhQgr7Ak/видео.html
great video
Merci, clair et précis 👍👍👍👍👍
Je vous en prie. Merci de ne pas sauter les publicités et de continuer à les regarder. Cela m'aidera beaucoup.
Hello sir. May i know which pin the load connected? Is it the coil or the common and normally opened pin? Ive been trying to connect from the power supply to relay then the relay to the load thrn back to power supply. Can u tell me in more details because the figure u have shown is a bit confusing to me. Thanks
Hello, I have fully explained it. You have to watch and do not skip the video. I am sure you will know it if you watch .
can this relay be used as, basic gates for home brew 4 bit computer ALU ?
relay is just a switch. it turns ON or OFF DC or AC load as long as the current of the load does not exceeds the relay rating.
is this 5V relay is undervoltage or overvoltage...this ques asked in viva
Hi, please watch this ruclips.net/video/58XWVDnB7Ss/видео.html
Thank you for the tutorial! Question: If you use a 5V relay, can you just connect it directly to the Arduino without needing the transistor?
you are welcome. from your question, I know you have not watched the video fully or skipped. The answer is in the video.
@@robojax I watched the whole thing, but I guess I missed it. I’ll watch it again.
@@robojax I watched the complete video 2 times now, and did not find any answers to my question.
you made me watch the video. at about 00:40 I said "you need to be able higher current" may it was not clear to you. you can't connect higher current loads like bulb or fan directly to Arduino as Arduino supply very little current, so we use relay to handle higher current.
@@robojax My question was about connecting the relay *coil terminals* to Arduino, not the common or outputs. We can activate the 5v coil terminals using the Arduino directly, so why do we need a transistor?
if the relay load is connected between emitter and ground does the transistor going to face any kind of damage?
if you connect it between E and GND, it may not work. The relay needs about 40-80mA and I've selected 2N3904 and I have provided the datasheet which show it can handle 200mA see it here media.digikey.com/pdf/Data%20Sheets/ST%20Microelectronics%20PDFS/2N3904.pdf
Hi sir I would like to control the DC voltage power supply on off button using arduino. What kind of relay should I use.
you can use this relay ruclips.net/video/58XWVDnB7Ss/видео.html or this ruclips.net/video/7tUGUXyloXQ/видео.html and here is how to control relay with push button ruclips.net/video/7CCSRs5bvH0/видео.html
Thanks
You are welcome.
good day sir nice video, very informative. i wish to control a universal motor using an ir sensor, relay with arduino. your video has been helpful in the relay and transistor circuit part. now is it possible for me to connect an ir sensor to the arduino and the sensor will be the one that will tell the arduino to switch on the motor? please give me feedback Robojax
Hello, you learn from this video ruclips.net/video/T3Li128GBlM/видео.html and combine it with relay . here video using relay module with Arduino ruclips.net/video/58XWVDnB7Ss/видео.html
i have the NPN Transistor PN2222. Would that work?
with your question, you make me watch the video and I realized that you have not watched the video. please watch again if you want to learn and use it. I saw the answer in the video.
Nice sir
Why can't we use arduino as a switch? What if we send low and hight outputs to the relay directly through arduino? Why we use transistor? Please tell.
Thanks!
Hi, I made this video to answer all. That Please watch the video I can assure you, the answer is there.
I was wondering this as well even after watching the video a couple of times. I did a search and I understand that the current supplied from the Arduino pins is limited and not reliable enough to consistently hold the relay open. There is an explanation here. arduino.stackexchange.com/questions/17022/reasons-why-it-is-not-ok-to-connect-a-relay-directly-from-an-arduino-digital-pin
Does anyone here could explain to me, why do we need to use a diode to this project? Is there problem if we don't use it? Thank you!!
Hello, I have mentioned what it does. Full details here resources.pcb.cadence.com/blog/2020-modeling-a-relay-with-diode-for-surge-protection
Can use bd139 transistor ? Instead
Yes you can . I checked the datasheet and it is NPN transistor www.st.com/resource/en/datasheet/cd00001225.pdf
@@robojax ❤️
Thanksssssss
Thank you for your video! Do you think that a 2N2222A transistor will work for this application?
You are welcome. Yes it will work. The best "thank you" for me is to subscribe to my channel. thank you.
@@robojax Doneee!
Sir , jo relay pe LED & Resistor mount kiya hei uski value bataiye....pls
sorry. English please.
Is VCC must 5 v ??
Can we use 12 v as VCC?
Yes you can if you get the 12V relay. This relay is 5V
How can I Drive a rele with humidity or water sensor, I mean the code
Thanks
Hi, Here are my videos on Temperature control so you can use them depending on the type of temperature sensor: ruclips.net/user/robojaxTVsearch?query=temperature
what is the purpose of the transistor ?
you have to watch the video. at 00:54 I have explained it. Later in wiring I have explained it. you can't turn ON directly using Arduino. Relay needs 70mA or higher. Arduino can provide only 30mA so you need to drive the relay using transistor as amplifier. Please watch the video and do not skip. I have not said anything excess.
@@robojax thx for the explanation, i did not notice the part about relay needing 70mA
you are welcome.
السلام عليكم ورحمة الله وبركاته رمضان كريم
وعلیکم السلام و رحمة الله وبرکاته. رمضان کریم.
Why do you use a diode?
Watch the video without escaping, I have explained it.
How to connect multiple relays to the arduino
you could have just searched this without waiting but here is the link ruclips.net/video/Wbm3MCMgM_s/видео.html or see all relay related videos ruclips.net/user/robojaxTVsearch?query=relay
@@robojax i dont have relay module i need to know how to connect 4 individual relays how do i do that
what is this video for? just make 4 of this and you have 4 channel relay.
Hello, I am working on theft detection meter. For this I have used two current sensors. I want to turn off the load when values of these two sensors are not equal and turn the load back when both values of sensors are equal. I have write a code and used while and if statement for this purpose. When sensor 1 is less then it turn off the load and displays phase line bypass . For this case the code is working perfectly and it turn off the load until the phase line back to normal condition but when I go to second case which is if sensor2 is less than sensor 1 by using the same code part then it didn't work. It keeps turning on and off the load .
Here is the code. can you please help me in this and tell me where I am doing wrong? It would be helpful for me. Thanks
// THEFT PART
while (ecurrent1 < ecurrent2){
CT1(); CT2(); // calls current measuring function of both sensor 1 and sensor 2
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Phase Line Bypass");
digitalWrite(13, HIGH);
if(ecurrent1 == ecurrent2)
{digitalWrite(13, LOW);
lcd.clear();
lcd.print("Back To Normal");
delay(200);}
}
while (ecurrent2 < ecurrent1){
CT2(); CT1();
lcd.clear();
lcd.setCursor(0,1);
lcd.print("N Line Bypass");
digitalWrite(13, HIGH);}
if(ecurrent2 == ecurrent1)
{digitalWrite(13, LOW);}
why you have the "if" inside "while" loop? this will never run because ecurrent1 == ecurrent2 will not be true as you have while (ecurrent1 < ecurrent2).
if(ecurrent1 == ecurrent2)
{digitalWrite(13, LOW);
lcd.clear();
lcd.print("Back To Normal");
delay(200);}
@@robojax Thanks for your reply. As I said earlier for "Phase Line Bypass" that part is working fine but when the same goes for "neutral Bypass then it didn't work. Can you please tell me how can I achieve my results?
I did not understand "neutral by pass". My be draw diagram and post the image here snipboard.io/ and then share the link
Please subscribe. I appreciate it.
Poor video.. unable to see pin connection
you skipped. watch without skipping. it take 5 seconds to write comment but you need to watch it for 12 minuets to learn. unfortunately you've skipped thinking you are "smart"
@@robojax Dear Friend, consider my apologies if I heart you in any way, by the way I am one of your fan from Pakistan, please continue doing good thing and keep helping people like me. Regards
Isn't someone better off using a realy module instead of using the relay and attaching all the resistors and diode?
of course it is better. but you never learn how it works and what it does. This is in case you want to make your own relay driver. here is the module ruclips.net/video/58XWVDnB7Ss/видео.html
4:57
what about it? say something. this video already has chapter and you see them like this snipboard.io/6sIgKA.jpg
Circuit diagram
I have not only shown it but fully explained it as to how it works. please watch.
my relay burned
It never burns unless if relay is 5v and you connect higher voltage. Only higher voltage will kill it . Overloading is also killing it
Badly explained
Thank you. Tell me please what did I leave out? I will fix it and re-post it.