I watched many videos on relays and you are the only one so far who explained why a diode is used in the circuit. Great video, thank you and I look forward to watching more videos from you in the future
This is a great video that I'll refer all of my beginning electroncis/maker/arduino/pi friends to. One note is that the type of relay shown in the video, designed for use with micro-controllers like the Arduino, often comes with the clamping diode built in. I would personally recommend people check for that and order that type to save the hassle of doing it manually and the worry of forgetting about it or installing it backwards. On another note, because this video is going to get people thinking about all the cool projects this knowledge opens up, maybe you should do a follow up video covering latching relays. What they are, how they work, using them with micro-controllers, etc. Thanks
Hey there I am glad you mentioned the diode. The voltage spike can really destroy a micro or transistor if the relay coil is big enough. I usually use a 1n4007 or similar if I am using relays that don't have an onboard diode. Cheers
To not complicate stuff: Relays are automatic switches that are typically positioned where the use of regular/manual switches is impractical. Thank me later.
Thank you so much for posting this video! I've watched several videos explaining relays (and their practical applications) and yours is one of the best explained out there because your simple sketch was actually compared with the actual setup a good eye opener. Thanks again! Keep up the good work!
Thanks for that Dylan. Sometimes it gets a bit tough hearing people complain about free videos- but when someone like yourself leaves a genuine, simple, honest feedback- it is truly appreciated. Good luck in all your projects. Eric
Good stuff Eric, I realize that the relay schematic you drew was deliberately simplified for illustration, but it's very much worth mentioning that the arduino can't source enough current to drive anything bigger than the smallest relays, minimally a transistor should be used to switch them. The boards with an integrated driver (likely an opto-isolator) like your boards are a big help and not particularly expensive.
+TheWreckingYard Indeed. In hindsight I wish I did the video a bit different but for the audience that will actually be searching/viewing the video I figured this would do. Hard to draw the line and not make 20 minute videos that no one will sit through :)
The relay board he is using is active low. If you notice, whenever the lcd read "Relay On", the relay led went off, and when it said "Relay Off", it would come on. That because it is active low, which is the opposite of what the blink sketch logic is doing. In other words, if you want to activate the relay, you must write "LOW" to it, and to turn it off you must write "HIGH"...Just a heads up, although I'm sure most of you would figure this out when testing your relay boards.
Planning on making a fish tank heater here, with the arduino, relay and thermistor. (store bought ones fail in the on position, and I believe this can be made to protect against/replace the built in thermostat in those heaters. I was wondering what the "extra" components on the prebuilt boards were.... I didn't know I needed a diode in-line with the coil pins, never needed one for auto's applications. Now, just have to learn to set up the programming side.
I have 2 reef tanks and if I didn't already have a Reef Keeper on each of them I would definitely build the circuit you are building. Stuck heaters have killed many tanks. Super easy to add a tonne of functions like temp display/alarms. ph alarms/display, water level switch etc etc.
I've noticed that, been shopping around for a new one and on every product theres warnings for one or more person about how theirs broke in a closed loop and killed everything. It was at that point I looked over at the printer and wondered..... it's basically the same... kinda. I'm just starting to learn (or trying to learn) the programming side. I would love to add a small display to show temp or set temp and actual temp. I think that would be a really cool feature to have. And advice on display to use and where to best learn how to program it? So far the extent of my arduino knowledge is simple tweaking an arduino/ramps for 3D and making a custom thermistor table.
Thanks for the video and love the way you explain with simple languages:" The funny part coming....... wacking the Arduino" which help me learn faster. lol. I'm trying to learn how to make stair light.
This is the 2nd Relay Video I have watched, the 1st Relay video was an Indian man using just bare hands and twisted wire joints with live voltage. I then went to the comments section expecting some funny comments about his technique only to find more Indians praising him for such a good video. 😂🤣😂🤣😂FML
You may have answered this, but I'm having trouble creating code on my arduino to control dwell times in .5ms increments. I need to then add the code to a GUI for a touchscreen that I can manipulate for a sprayer. The relay will power a solenoid valve for a simple on/off operation to apply product to our samples at work. Any help would be greatly appreciated.
I thank you for the good will. I am trying to set a timer circuit on an iDrive 300 motor control for shades. the iDrive has cube contactor for close shade and another for open shade. The controls have manual open and close positions as well as auto position. the cubes are wired for manual, can I lap a set of timer wires onto the existing connections for timer operation? using the same input voltage (24vac).
Hello Great Video and thank you for your time in making it. I need to ask you a quick question on which relay I will need to operate 230v input and 0 volt or 5v output. Basically need a relay so when I plug it into wall socket motor turns oneway and when I unplug from wall socket it turns other way. The motor has its own power and is plugged in the socket all the time.
Good vid, thanks. I would like to setup a relay that reads battery voltage. When the battery voltage gets below a certain voltage, the relay should turn off. Example - I am running a battery with 4.2 volts. As I am using the battery , and it falls down to 3.5 volts, the relay should switch off. I am hoping I can use a relay to disconnect a power line to the battery. Thanks.
Hi Eric, in the video you stated that for those who wanted the more elaborate code you would put the link below but I can't find it. I am particularly interested in the oled code. Thanks Eric good video as usual................................. Berni UK
+berni ken Hey Berni. Added it to the description but it is really messy and needs the junk from the pulse sensor code removed. You will get the idea though but if you need just the OLED go check out my OLED example video and grab that code- much cleaner :)
I want to control my very small solar setup, i have ordered an orange pie one and one of the two bank relay boards. Im new at this so it should be interesting. I just want the DC current from the panels to switch from the batteries to my grid tie when the batteries are charged. Thinking this should be relatively simple any suggestions?
I'm hoping to use this technique to create a quick-shifter system for my motorcycle. Quick summary: Instead of cutting throttle, disengaging the clutch and shifting gear, which can take hundreds of milliseconds at least, one can simply cut ignition to the engine momentarily and shift gear. Without ignition, the transmission momentarily "floats" without torque on the system and allows the gears to engage without stress (normally wears or even breaks gear teeth). I started with the idea for simple electromechanical system; A spring loaded piston in-line with the gear shift linkage allows you to push on the gear shifter until it encounters resistance. Subsequently your spring compresses, which closes a circuit that grounds the engine's ignition coils, which cuts spark to the engine. With the transmission now unloaded, your gear shifter would have no resistance as it pushes the transmission into a higher gear. As you finish actuating the shift lever, the spring loaded piston returns to open the grounding circuit and your engine continues its ignition sequence. Notice this still limits shift times to hundreds of milliseconds that your foot is pressing on the gear shift lever, grounding out the engine ignition system. I know there must be a similar analog method to hold a grounding circuit closed for a set time interval from some kind of input from the spring piston system, but I do not know how to do it. I'm thinking it will be easier and allow more refinement to use a simple Arduino microcontroller to receive that signal from the spring piston and then open a relayed grounding circuit for a set interval, in the 10-100ms range. There are several quick-shift systems available on the market, I'd rather build my own as proof of concept. What are your thoughts?
My 2 cents- The times you are looking to get are beyond what a relay can do and you should look at using MOSFETs. Another issue you need to handle is the fuel- unless you stop the supply you will run into a large backfire out the exhaust when ignition is re-engaged. On fuel injected systems this should be easy for you- if carbureted, this is much harder. Good luck with your project.
Hi guys, I'm building a custom portable laptop-like-UPS, in order to feed my NUC (the Intel Skull Canyon) when not plugged in the wall-socket. I've determined more of less the rest of the components I need, but I have difficulty of finding a proper relay for the purpose of switching from the main-power to the battery when main-power is off. I'll need a relay with 2-inputs (one for the main-power, and one for the battery) and 1 output (to the NUC). The closest type of relay I've found is a DPDT type /looking at its basic diagram it actually has 2 outputs, but I can always link them into one/. The NUC needs up to 120W (19V @6.32A) which is why good old laptop scavenging is not likely to work (most laptops have lower consumption than the NUC, which is also the reason to consider building my own UPS. Also I think the switching relay circuit is actually in the laptop body rather than in the battery, and I don't have many dead laptops laying around). Anyway, most applications of relays on the net I've found (like this one too) depend on outside control of the control-coil, and are often of different type /than 2INs-1Out auto-switching/. My case I believe should be simpler, because both the inputs will be DC (the battery obviously without inverter will give me about 22VDC, and since its charger also requires DC, I plan on using common AC/DC adapter which will output 20ish V DC). So I was thinking that if I link the main-power not only to one of the relay's INs (lets call it A) but also to the control coil terminals, which under current should keep the relay in A-input closed position, and will feed the NUC. Then when the main power is lost, it would also lose the current in the control coil, so it should automatically switch to it's normal position closing the B-input circuit. Would that work? And could you recommend such relay capable of say up to 27V and 7A (or up to 120~150W) /could be stronger of course/ disclaimer: I'm complete newbie regarding electrical stuff, so please correct me if I'm wrong /or missing/ something! For my own safety! :)
hi sir. by the way thanks for the video. its very helpful. but Im asking about if posible that im using heater 220v in relay module v3.1 in arduino. what diode can i use? and can you help me in connection?
I'm not sure how to wire the relays for my 12V system in my camper and requires 15, 20, 30, and 40 amp fuses to run my awning in and out with a switch, can these be used instead of those 5 wire relays?
Hi, I wonder if you could help please. I'm not much good with this sort of thing. I have a twin relay module and I can't get the relays to trigger. I'm ok with the output, but on the 12v input side I am unable to wire it. The terminals I have are CL2. CL1. DC - and DC + any help you could give will be very much appreciated. Thanks, Terry.
Hi Eric, i would like to run a freezer and a water pump with PV energy ( without electrical storage ). To switch the pump and the freezer on and off i am planing to use relays. To make best use of the PV energy i am thinking of using uv LED light strips to sterilize the pumped water. So my question to you is, how would you control the uv LED light strips, with MOSFETs or relays? Thanks in advance
How about adding the relays as a reversing (DC) circuit .. My actuator needs a control box that will go fully open then close then back to open again (cycling).. I was wondering if there was a way to set up something for my hay baler ...
If we look at the diagram on the left and name the points around the square from the top left as A, B, C, and D wouldn't it make more sense to put the diode between points A and B (between pin 13 and the coil)?
Actually, never mind. I just solved my own question. The collapsing field generates power and continues to flow around the new circuit feeding the current controlled current source over the coil. Makes sense. If anybody wants to see a visualisation of this I put one up on imgur: imgur.com/EZKTr0G
thanks for the info! question: I want to run an air filtration system with an ir controlled relay with remote, since the unit will be hanging from the ceiling. But I'd like to have a couple options, ON, OFF, 2HR, 4HR & 8HR run times. Can I do this with relays only and some type of timer or would I need to incorporate a pi or arduino? Thanks
You could do either. Easiest would probably be to use an Arduino and a real time clock to control the relay. Just use the code for my Arduino Urban Kitchen Garden project and adapt it. Easy. th-cam.com/play/PLxyM2a_cfnzgLjCoJ04S2Z812JrdFKbFX.html
@@MkmeOrg hi dude read your comment and watched urban kitchen, nice nice. Ive got some GM5 far red 12v led pucks that i wish to power from 12v CC led driver triggered by a 12v signal from chilled drive controller. Im a new twat at diy electronics but i love it! Ive had to learn a lot building a new indoor garden as eco as possible. 2KW of led still!! Any help much appreciated
Hi Mkme Lab, Hope you can help. im confused about which type of relay to get. The relays in your video say "SRD-05VDC" does that mean you need 5v to get the relay to work? Iv saw other relays that say "SRD-12VDC" so would that one need 12v? I need to get a relay which can be switched on by 5v and which will be switching on a 12v line. Thanks
Yep- As the collapsing magnetic field cuts through the coils it induces a voltage opposite the normal polarity and very large in magnitude. This needs to be conducted back to the source (the coil) to protect any micro controller.
The relay board he was using already has a flyback diode built into it, so you can just plug and go with the arduino. It is important, however, to use a flyback diode if using a relay by itself. Make sure you also check out the relay specs to make sure the arduino can handle the the coil current. Max I/O pin current for the uno and mega are ~20mA and ~40mA, respectively.
even if I use the relay controlled by arduino into 240V line to neutral would it still be possible depending on the specs of the relay and the diode connected?
Hello! This is a very informative video. In connection to using relays, I would like to inquire on how to use them in four way solenoid valves? Thank you so much. Keep it up!
Got an 8 relay module and i'm looking forward to cut off 5 outputs on my arduino by using an 8 bit shift register 74HC595 IC chip. Boy will this be a fun project. Mine has optocouplers to seperate the input section from the coil and needs a seperate 5VDC supply there, and is an active low module. Problem is I'm not sure what approach should I take when dealing with latching relay states internally when using the IC. Don't want to add 1 to my byte variable every reading cycle and start glitching my relays by flicking at a crazy rate. Should I use an array of booleans or bits or anything else for shifting out (function used to write the output states in the IC)?
Gud day mate. Would like to seek help from you.. Would like to build a overheat alarm on our diesel fed generator. From the signal coming from engine thermistor at 55 celsius but dunno if how to use relay for this set up. Please help.
Just Awesome! Thank you so much. You are the man. Would you be kind and make a tutorial video on how to connect an AC well water pump to a relay? If you could also advise on the correct relay spec to purchase please. I plan to control my pump for the house from my cell phone using my Arduino UNO and a WiFi sheild. AC Well Pump Specs: -> 240 V -> 50 Hz -> 1.5 HP -> 6.6 A -> 2800 rev/min -> HEAD: 30 Feet If there is anything else you would need to know, kindly let me know. Eagerly awaiting your reply. Thanks & Best regards, Philip
Get a 10 to 15 amp 240V relay and you will be good. Could use a very small relay (aka interface relay) to run a contactor as well if you really wanted to get overkill.
Thank you so much. Just if I may clarify please: 1) Are interface relays generally expensive? 2) How do I connect the pump wiring to the relay? Warm Regards, Philip
Hello dear friend, can you kindly answer this question? Is it possible to directly connect(without Arduino) a pir hc-sr501 which has a 3.3v output to a relay that requires a low trigger level? If so, how should the link be? Thank you very much
I have a question, can we use this relay on 2 power input to 1 output light...1 power input using normal switch on off and 1 more power using sensor motion...
I have a pool pump 220V motor (L1(110v) and L2(110v) connections). The motor has a max load of 15.0/7.5 amps. I have a 2 relay board 10 amps a piece that I was hoping to connect one relay to L1 and the other relay to L2. My program would turn on both relays on the board at the same time. What are your thoughts on doing this?
I want to use a relay to turn on/off a common household 20" box fan (with arduino on a schedule)? I'm going to do some googling to see if there are perhaps charts with relays and typical applications vs loads.
Sir i don't know how to give power to the relay?Can i give it from the arduino mega board which i am having or externally? If i give it from the board will it damage it or if externally then how should i do it?
Do it externally. Remove the jumper on the relay and remove the ground wire coming from the Arduino. Connect your 5v power supply to the relay GND pin and the JD-VCC pin (or whatever it's called on your relay board, where you removed the jumper). Otherwise, you may encounter Arduino resets when the relays are under load.
So I need an additional power source to run a servo as my arduino cannot provide enough current to it. Would the relay also work to control a DC circuit or should I use a transistor instead.
So I need an alternative power supply to my 5V arduino as driving a servo from my microcontroller is not enough. Would the relay also work to manipulate a DC circuit? Should I be using a transistor to to this or could I also use a relay?
You can use either. An analogy would be that using a transistor in that case would be akin to using a flyswatter to kill a fly. The relay would be akin to a Howitzer cannon to kill the same fly. Both would get the job done.
You need to figure out what your control circuit is drawing and add the relay coil draws. Depending on brand they are usually 50-100 mA each in my experience.
MKme Lab I’m just going to be using it to turn a heater on and off. Leaving the plug intact and just snipping the positive wire and wiring that into the relay. So really I only need the 5V supply to be able to activate the relay. Correct?
Hello, I'm having trouble with my low level relay : - when I power it with 5v, the input from the arduino works (green LED turns on and off) but the switch isn't actually actuated. - When I power it with 9 or 12V, the switch triggers, but the input is not recognized (the green LED just stays lit) What do you think is causing that ?
im new to electronics so i dont know how to use a transister yet :/ so do anyone know if i can use a relay instead for my LED Cube and will the timing be right?
hi, i gone thru some video that they recommend to supply separate power supply for the relay, but some don't, i not sure is it really necessary to have a separate 5v supply to the relay?
At 3:03 he basically explains why you shouldn't connect a relay directly to the arduino or any other microcontroller. For that you have control circuits like Yan Mong Chan explained which basically work like this: Output of an arduino or microcontroler triggers a transistor (who in this case operates as a switch) which then triggers the relay, so if anything goes wrong with the relay, the control circuit will get damaged while arduino will be safe. If you want to control more relays or other components like motors the easiest way would be to use a Darlington Transistor Array for example ULN2803 (www.ti.com/lit/ds/symlink/uln2803a.pdf) as they require minimum components. All you need for this is the ULN IC and power supply which has to be the same as the power requirements of the device you are controling (12V if using 12V relays, 24V if using 24V relays,...).
hi I'm using a relay and Arduino to switch on and off a solenoid door lock my problem is on power up of the Arduino the relay activates unlocking the door I set the Arduino pin low but dos't help. Again my problem is when the Arduino power is restarted the door opens as the relay gets a pin high from the Arduino any help please
MrBildo thanks for your help I made the change setting the pin HIGH and made the changes in the loop from high to low etc and it works great so thanks again
For that you would need a solid state driver like a transistor- Relays are a bit too slow for dimming and would cause massive back EMF issues as the relay coil becomes similar to an ignition coil :)
I am sick of my 91 corolla, leaving the light on, it does not have any beep or warning to let me know that I did left the light on, so I am going to connect two relays horizontally to have two positive voltage from the door switch(fuse) and the head light switch(fuse), so with the two on, I will power on a beep device that I will connect the circuit, like this I will save my battery :), what do you think? sounds like a project? :)
why is everyone so concerned about 110v i can understand being concerned by 220v. i've been shocked more times then i can count by 110v and i am fine. (some of my friends may disagree with that but trust me i am fine :D )
I hooked up an 8 channel relay module board one of those typical ones you buy from amazon. I wrote a simple sketch to check it out as I want to use it to power some linear actuators. On power up all relays go high and turn on power to all linear actuators and everything that could be connected to them... this is not good. Once the program rolls through the loop the first time it functions as programmed where I'm cycling through the 8 relays turning one on at a time with a 1 second delay and then back off. So how do I get around this problem on power up where everything turns on?
prokiller grape what you can do to trick the pi to think it is at g or 0v is to set it as an input. Be sure to add the diode as he mentioned in the video so the excessive voltage don't go into the pi when you turn it off (switching to input). This all has to do with that the pi and the relay don't have the same specifications on what is classified as HIGH and LOW. Hope it helps!
it uses a magnet, an electro magnet to open and close a switch that is more hefty and can switch circuits with much higher voltage and current ,the electromagnet is powered by low voltage like 3v or 5 v the relay can switch things that are 120V, think of it as a light switch in your wall that you have glued a small powerful magnet to , then positioned an electro magnet with in an inch or 2 of, the electro magnet is being powered by 9v say, when you energize the electro magnet it pulls the switch closed the circuit that runs the electro magnet and the circuit that is being switched on or off are not physically connected with any sort of conductor one runs on 9v DC the other on 120v AC hobby boards like the arduino and the rpi run at like 3 or 5 v DC so they can not be used to switch things that run on higher voltages and currents like 120v AC ,the relay lets you open and close switches for higher voltage and higher ampere circuits and different types of current curcuits,or acts like a switch for those higher current higher voltage circuits ,the lower voltage circuit that is controlling the higher voltage
I watched many videos on relays and you are the only one so far who explained why a diode is used in the circuit. Great video, thank you and I look forward to watching more videos from you in the future
Thanks David. Lots more videos on the channel. Glad to have you. Cheers.
I was trying to understand how can a raspberry pi control high voltage device. This video helps clear those doubt. Thanks
Perfect. This video contains exactly the info I was looking for to build an automated irrigation system.
This video helped me alot figuring how im supposed to control a 9V 5A Peltier module for my mini fridge with a microcontroller like Arduino
Excellent!
This is a great video that I'll refer all of my beginning electroncis/maker/arduino/pi friends to.
One note is that the type of relay shown in the video, designed for use with micro-controllers like the Arduino, often comes with the clamping diode built in. I would personally recommend people check for that and order that type to save the hassle of doing it manually and the worry of forgetting about it or installing it backwards.
On another note, because this video is going to get people thinking about all the cool projects this knowledge opens up, maybe you should do a follow up video covering latching relays. What they are, how they work, using them with micro-controllers, etc.
Thanks
Hey there I am glad you mentioned the diode. The voltage spike can really destroy a micro or transistor if the relay coil is big enough. I usually use a 1n4007 or similar if I am using relays that don't have an onboard diode. Cheers
+misperry Sure can. Cheers Sir
Relay boards do have diodes right?
To not complicate stuff: Relays are automatic switches that are typically positioned where the use of regular/manual switches is impractical. Thank me later.
HK Felimban thanx
HK Felimban thank you later.
What a great video. Thank you so much for posting this. Really interesting to hear your comments with the relay diagram.
Thank you so much for posting this video! I've watched several videos explaining relays (and their practical applications) and yours is one of the best explained out there because your simple sketch was actually compared with the actual setup a good eye opener. Thanks again! Keep up the good work!
Thanks Hector.
I think this video was very satisfying.I LOVED it!Best video ever made by man!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
lol cheers ;)
Great video, I was having a hard time understanding this but this video helped.
Thanks for that Dylan. Sometimes it gets a bit tough hearing people complain about free videos- but when someone like yourself leaves a genuine, simple, honest feedback- it is truly appreciated. Good luck in all your projects. Eric
Good stuff Eric, I realize that the relay schematic you drew was deliberately simplified for illustration, but it's very much worth mentioning that the arduino can't source enough current to drive anything bigger than the smallest relays, minimally a transistor should be used to switch them. The boards with an integrated driver (likely an opto-isolator) like your boards are a big help and not particularly expensive.
+TheWreckingYard Indeed. In hindsight I wish I did the video a bit different but for the audience that will actually be searching/viewing the video I figured this would do. Hard to draw the line and not make 20 minute videos that no one will sit through :)
This, so much. Arduino resets will plague you if powering relays from the Arduino. Remove that jumper and power the relays separately.
Awesome tip for beginners, Eric! Thumbs up as always :)
P.S. hope you're enjoying the sunshine ;)
+ZakkBlog Thanks Sir. Cheers
The relay board he is using is active low. If you notice, whenever the lcd read "Relay On", the relay led went off, and when it said "Relay Off", it would come on. That because it is active low, which is the opposite of what the blink sketch logic is doing. In other words, if you want to activate the relay, you must write "LOW" to it, and to turn it off you must write "HIGH"...Just a heads up, although I'm sure most of you would figure this out when testing your relay boards.
Planning on making a fish tank heater here, with the arduino, relay and thermistor. (store bought ones fail in the on position, and I believe this can be made to protect against/replace the built in thermostat in those heaters. I was wondering what the "extra" components on the prebuilt boards were.... I didn't know I needed a diode in-line with the coil pins, never needed one for auto's applications. Now, just have to learn to set up the programming side.
I have 2 reef tanks and if I didn't already have a Reef Keeper on each of them I would definitely build the circuit you are building. Stuck heaters have killed many tanks. Super easy to add a tonne of functions like temp display/alarms. ph alarms/display, water level switch etc etc.
I've noticed that, been shopping around for a new one and on every product theres warnings for one or more person about how theirs broke in a closed loop and killed everything. It was at that point I looked over at the printer and wondered..... it's basically the same... kinda. I'm just starting to learn (or trying to learn) the programming side. I would love to add a small display to show temp or set temp and actual temp. I think that would be a really cool feature to have. And advice on display to use and where to best learn how to program it? So far the extent of my arduino knowledge is simple tweaking an arduino/ramps for 3D and making a custom thermistor table.
Thanks alot for this video, now i gotta use this same concept to control my light through a bluetooth module.. I wonder how :)
Great video, making relay and power board for school project-Underwater robot.
Nice!
very good explanation. thank you
Thanks for the video and love the way you explain with simple languages:" The funny part coming....... wacking the Arduino" which help me learn faster. lol.
I'm trying to learn how to make stair light.
:)
Could I ask what specs you would recommend for the clamping diode?
i want to use relay to move the 12volt dc motor left and right.. the relay cooperate with two infrared sensor.. can u xplain further?
This is the 2nd Relay Video I have watched, the 1st Relay video was an Indian man using just bare hands and twisted wire joints with live voltage. I then went to the comments section expecting some funny comments about his technique only to find more Indians praising him for such a good video. 😂🤣😂🤣😂FML
Ugh their vids are such shit
You should have shown a close up view of how the relay was wired.
I'm extremely thankful for this video!!! Helped me a lot!!! Thank you!!!
You may have answered this, but I'm having trouble creating code on my arduino to control dwell times in .5ms increments.
I need to then add the code to a GUI for a touchscreen that I can manipulate for a sprayer. The relay will power a solenoid valve for a simple on/off operation to apply product to our samples at work.
Any help would be greatly appreciated.
Good explanation, an even easier one : remote switch.
Richard T Indeed it is, nothing more than a remote switch. The 'basic' people certainly don't need to know more than that.
Thank you, it's very informative. One question for you, if we are on and off the circuit every second, does it harms the relay?
I thank you for the good will. I am trying to set a timer circuit on an iDrive 300 motor control for shades. the iDrive has cube contactor for close shade and another for open shade. The controls have manual open and close positions as well as auto position. the cubes are wired for manual, can I lap a set of timer wires onto the existing connections for timer operation? using the same input voltage (24vac).
Hello Great Video and thank you for your time in making it. I need to ask you a quick question on which relay I will need to operate 230v input and 0 volt or 5v output. Basically need a relay so when I plug it into wall socket motor turns oneway and when I unplug from wall socket it turns other way. The motor has its own power and is plugged in the socket all the time.
Good vid, thanks. I would like to setup a relay that reads battery voltage. When the battery voltage gets below a certain voltage, the relay should turn off. Example - I am running a battery with 4.2 volts. As I am using the battery , and it falls down to 3.5 volts, the relay should switch off. I am hoping I can use a relay to disconnect a power line to the battery. Thanks.
Hi Eric, in the video you stated that for those who wanted the more elaborate code you would put the link below but I can't find it. I am particularly interested in the oled code. Thanks Eric good video as usual................................. Berni UK
+berni ken Hey Berni. Added it to the description but it is really messy and needs the junk from the pulse sensor code removed. You will get the idea though but if you need just the OLED go check out my OLED example video and grab that code- much cleaner :)
Thanks for the video. The explanation is amazing.
Glad you found it helpful. Good luck in your projects! Check out the other vids on the channel. Plenty here ;)
I want to control my very small solar setup, i have ordered an orange pie one and one of the two bank relay boards. Im new at this so it should be interesting. I just want the DC current from the panels to switch from the batteries to my grid tie when the batteries are charged. Thinking this should be relatively simple any suggestions?
I'm hoping to use this technique to create a quick-shifter system for my motorcycle. Quick summary: Instead of cutting throttle, disengaging the clutch and shifting gear, which can take hundreds of milliseconds at least, one can simply cut ignition to the engine momentarily and shift gear. Without ignition, the transmission momentarily "floats" without torque on the system and allows the gears to engage without stress (normally wears or even breaks gear teeth). I started with the idea for simple electromechanical system; A spring loaded piston in-line with the gear shift linkage allows you to push on the gear shifter until it encounters resistance. Subsequently your spring compresses, which closes a circuit that grounds the engine's ignition coils, which cuts spark to the engine. With the transmission now unloaded, your gear shifter would have no resistance as it pushes the transmission into a higher gear. As you finish actuating the shift lever, the spring loaded piston returns to open the grounding circuit and your engine continues its ignition sequence. Notice this still limits shift times to hundreds of milliseconds that your foot is pressing on the gear shift lever, grounding out the engine ignition system. I know there must be a similar analog method to hold a grounding circuit closed for a set time interval from some kind of input from the spring piston system, but I do not know how to do it. I'm thinking it will be easier and allow more refinement to use a simple Arduino microcontroller to receive that signal from the spring piston and then open a relayed grounding circuit for a set interval, in the 10-100ms range. There are several quick-shift systems available on the market, I'd rather build my own as proof of concept. What are your thoughts?
The motorcycle can supply constant 12~14VDC from a DC battery and regulator/rectifier.
My 2 cents- The times you are looking to get are beyond what a relay can do and you should look at using MOSFETs. Another issue you need to handle is the fuel- unless you stop the supply you will run into a large backfire out the exhaust when ignition is re-engaged. On fuel injected systems this should be easy for you- if carbureted, this is much harder. Good luck with your project.
is there a special diode to be used or a specific name or are they just all the same? im new to this and a few tips with these would be nice!
hey thanks for the vid. what sort of gloves did you have on? are they rubber? wondering if I could use my rubber dishwashing gloves
Hi guys,
I'm building a custom portable laptop-like-UPS, in order to feed my NUC (the Intel Skull Canyon) when not plugged in the wall-socket.
I've determined more of less the rest of the components I need, but I have difficulty of finding a proper relay for the purpose of switching from the main-power to the battery when main-power is off.
I'll need a relay with 2-inputs (one for the main-power, and one for the battery) and 1 output (to the NUC). The closest type of relay I've found is a DPDT type /looking at its basic diagram it actually has 2 outputs, but I can always link them into one/.
The NUC needs up to 120W (19V @6.32A) which is why good old laptop scavenging is not likely to work (most laptops have lower consumption than the NUC, which is also the reason to consider building my own UPS. Also I think the switching relay circuit is actually in the laptop body rather than in the battery, and I don't have many dead laptops laying around).
Anyway, most applications of relays on the net I've found (like this one too) depend on outside control of the control-coil, and are often of different type /than 2INs-1Out auto-switching/.
My case I believe should be simpler, because both the inputs will be DC (the battery obviously without inverter will give me about 22VDC, and since its charger also requires DC, I plan on using common AC/DC adapter which will output 20ish V DC).
So I was thinking that if I link the main-power not only to one of the relay's INs (lets call it A) but also to the control coil terminals, which under current should keep the relay in A-input closed position, and will feed the NUC.
Then when the main power is lost, it would also lose the current in the control coil, so it should automatically switch to it's normal position closing the B-input circuit.
Would that work? And could you recommend such relay capable of say up to 27V and 7A (or up to 120~150W) /could be stronger of course/
disclaimer: I'm complete newbie regarding electrical stuff, so please correct me if I'm wrong /or missing/ something! For my own safety! :)
hi sir. by the way thanks for the video. its very helpful. but Im asking about if posible that im using heater 220v in relay module v3.1 in arduino. what diode can i use? and can you help me in connection?
thank you so much
You are very welcome
Hi - thanks for the direct and informative video. Do you have the link to to the relay you're using?
Just search Arduino Relay :) Sorry I dont have links anymore.
Thank you so much for this Video !
You are very welcome. Lots more on my channel. Eric
Thanks Eric.
+berni ken Welcome :)
I'm not sure how to wire the relays for my 12V system in my camper and requires 15, 20, 30, and 40 amp fuses to run my awning in and out with a switch, can these be used instead of those 5 wire relays?
Why didn't you give a close up shot of how it's actually wired? I'm having a hard time finding a vid showing how they have it wired.
Hi, I wonder if you could help please. I'm not much good with this sort of thing. I have a twin relay module and I can't get the relays to trigger. I'm ok with the output, but on the 12v input side I am unable to wire it. The terminals I have are CL2. CL1. DC - and DC + any help you could give will be very much appreciated. Thanks, Terry.
Hi Eric, i would like to run a freezer and a water pump with PV energy ( without electrical storage ). To switch the pump and the freezer on and off i am planing to use relays. To make best use of the PV energy i am thinking of using uv LED light strips to sterilize the pumped water. So my question to you is, how would you control the uv LED light strips, with MOSFETs or relays? Thanks in advance
+Coco Mbella If there isnt need for dimming etc- Good old relays work great and the current consumption for the coil activation is quite low.
great video! and hey, how do i know if my relay board has a diode or not?
It will almost always be marked on the relay case with a diode symbol across the coils connections.
Thanks!
whats a good way of testing that your diode is absorbing the back emf without an oscilloscope?
Awesome! Thanks.
+Michael Grace Welcome!
How about adding the relays as a reversing (DC) circuit ..
My actuator needs a control box that will go fully open then close then back to open again (cycling).. I was wondering if there was a way to set up something for my hay baler ...
If we look at the diagram on the left and name the points around the square from the top left as A, B, C, and D wouldn't it make more sense to put the diode between points A and B (between pin 13 and the coil)?
Actually, never mind. I just solved my own question. The collapsing field generates power and continues to flow around the new circuit feeding the current controlled current source over the coil. Makes sense. If anybody wants to see a visualisation of this I put one up on imgur: imgur.com/EZKTr0G
Can I use this for 48v DC?
thanks for the info! question: I want to run an air filtration system with an ir controlled relay with remote, since the unit will be hanging from the ceiling. But I'd like to have a couple options, ON, OFF, 2HR, 4HR & 8HR run times. Can I do this with relays only and some type of timer or would I need to incorporate a pi or arduino? Thanks
You could do either. Easiest would probably be to use an Arduino and a real time clock to control the relay. Just use the code for my Arduino Urban Kitchen Garden project and adapt it. Easy. th-cam.com/play/PLxyM2a_cfnzgLjCoJ04S2Z812JrdFKbFX.html
@@MkmeOrg hi dude read your comment and watched urban kitchen, nice nice. Ive got some GM5 far red 12v led pucks that i wish to power from 12v CC led driver triggered by a 12v signal from chilled drive controller. Im a new twat at diy electronics but i love it! Ive had to learn a lot building a new indoor garden as eco as possible. 2KW of led still!! Any help much appreciated
Hi Mkme Lab, Hope you can help. im confused about which type of relay to get. The relays in your video say "SRD-05VDC" does that mean you need 5v to get the relay to work? Iv saw other relays that say "SRD-12VDC" so would that one need 12v?
I need to get a relay which can be switched on by 5v and which will be switching on a 12v line.
Thanks
codoyen
You can operate a switch that doesn't actually draw from the 12V supply.
Does that relay board also require a diode on the arduino? I didn't quite get the diode part.
LetTheWritersWrite I think the collapsing magnetic field from the relay can back feed and cause damage
Yep- As the collapsing magnetic field cuts through the coils it induces a voltage opposite the normal polarity and very large in magnitude. This needs to be conducted back to the source (the coil) to protect any micro controller.
MKme Lab how do you run a relay from an arduino? even relay current is big
The relay board he was using already has a flyback diode built into it, so you can just plug and go with the arduino. It is important, however, to use a flyback diode if using a relay by itself. Make sure you also check out the relay specs to make sure the arduino can handle the the coil current. Max I/O pin current for the uno and mega are ~20mA and ~40mA, respectively.
:D I always wondered how people use ardunios to control their lights
Glad it helped. Cheers!
even if I use the relay controlled by arduino into 240V line to neutral would it still be possible depending on the specs of the relay and the diode connected?
Hello! This is a very informative video. In connection to using relays, I would like to inquire on how to use them in four way solenoid valves? Thank you so much. Keep it up!
Hi there, thanks for this awesome tutorial dude. Anyway, I want to know how to connect bluetooth module to relay. Thanks dude.
Bluetooth to Arduino. Arduino to relay
Got an 8 relay module and i'm looking forward to cut off 5 outputs on my arduino by using an 8 bit shift register 74HC595 IC chip. Boy will this be a fun project.
Mine has optocouplers to seperate the input section from the coil and needs a seperate 5VDC supply there, and is an active low module. Problem is I'm not sure what approach should I take when dealing with latching relay states internally when using the IC. Don't want to add 1 to my byte variable every reading cycle and start glitching my relays by flicking at a crazy rate. Should I use an array of booleans or bits or anything else for shifting out (function used to write the output states in the IC)?
Gud day mate. Would like to seek help from you.. Would like to build a overheat alarm on our diesel fed generator. From the signal coming from engine thermistor at 55 celsius but dunno if how to use relay for this set up. Please help.
Just Awesome!
Thank you so much. You are the man.
Would you be kind and make a tutorial video on how to connect an AC well water pump to a relay?
If you could also advise on the correct relay spec to purchase please.
I plan to control my pump for the house from my cell phone using my Arduino UNO and a WiFi sheild.
AC Well Pump Specs:
-> 240 V
-> 50 Hz
-> 1.5 HP
-> 6.6 A
-> 2800 rev/min
-> HEAD: 30 Feet
If there is anything else you would need to know, kindly let me know.
Eagerly awaiting your reply.
Thanks & Best regards,
Philip
Get a 10 to 15 amp 240V relay and you will be good. Could use a very small relay (aka interface relay) to run a contactor as well if you really wanted to get overkill.
Thank you so much.
Just if I may clarify please:
1) Are interface relays generally expensive?
2) How do I connect the pump wiring to the relay?
Warm Regards,
Philip
..can the arduino be powered from the main too via the relay instead...stepdown bridged
Can I use the same battery for both outputs on the relay for 2 different circuits? I did this but the relay keeps clicking. It can't stay on.
Hello dear friend, can you kindly answer this question? Is it possible to directly connect(without Arduino) a pir hc-sr501 which has a 3.3v output to a relay that requires a low trigger level? If so, how should the link be? Thank you very much
Can I switch using either the hot or ground side of the relay coil? Does it matter, or is there a convention?
Hello Sir, can i connect a 450 VAC with less than 1 amp to these ice-cube relays?. Though the rating shows 240VAC - 7A.
Nope
I have a question, can we use this relay on 2 power input to 1 output light...1 power input using normal switch on off and 1 more power using sensor motion...
hey can i control it for my dc battery charger??
I have a pool pump 220V motor (L1(110v) and L2(110v) connections). The motor has a max load of 15.0/7.5 amps. I have a 2 relay board 10 amps a piece that I was hoping to connect one relay to L1 and the other relay to L2. My program would turn on both relays on the board at the same time. What are your thoughts on doing this?
You need to get an electrician (or their help). You cant split phases across separate relays. You need to use a contactor.
I want to use a relay to turn on/off a common household 20" box fan (with arduino on a schedule)? I'm going to do some googling to see if there are perhaps charts with relays and typical applications vs loads.
Relays are rated for load. Easy math ;)
Sir i don't know how to give power to the relay?Can i give it from the arduino mega board which i am having or externally?
If i give it from the board will it damage it or if externally then how should i do it?
Do it externally. Remove the jumper on the relay and remove the ground wire coming from the Arduino. Connect your 5v power supply to the relay GND pin and the JD-VCC pin (or whatever it's called on your relay board, where you removed the jumper). Otherwise, you may encounter Arduino resets when the relays are under load.
In relay 2 module. Why must have a jumper at VCC and VCC, if I plug in at VCC and GND will happen?
lol just checked the merchandise page. awesome
Great Video.. Is the diode embedded into the relay?
Yepper
So I need an additional power source to run a servo as my arduino cannot provide enough current to it. Would the relay also work to control a DC circuit or should I use a transistor instead.
So I need an alternative power supply to my 5V arduino as driving a servo from my microcontroller is not enough. Would the relay also work to manipulate a DC circuit? Should I be using a transistor to to this or could I also use a relay?
You can use either. An analogy would be that using a transistor in that case would be akin to using a flyswatter to kill a fly. The relay would be akin to a Howitzer cannon to kill the same fly. Both would get the job done.
lol, wut
You saved my 10 dollars
I've just bough a Dushbutton from amazon (5$) ...is possible to use an arduino micro with a wifi module and a relay to turn on a light? :)
Sure you could.
i see u Atmel, practicing your photobombing :P
What kind of power supply do I need to purchase to power an 8 channel version of the relay?
You need to figure out what your control circuit is drawing and add the relay coil draws. Depending on brand they are usually 50-100 mA each in my experience.
MKme Lab I’m just going to be using it to turn a heater on and off. Leaving the plug intact and just snipping the positive wire and wiring that into the relay. So really I only need the 5V supply to be able to activate the relay. Correct?
I'm working on making a timer to turn a motor on and off on my pellet stove.
Hello, I'm having trouble with my low level relay :
- when I power it with 5v, the input from the arduino works (green LED turns on and off) but the switch isn't actually actuated.
- When I power it with 9 or 12V, the switch triggers, but the input is not recognized (the green LED just stays lit)
What do you think is causing that ?
Hello MKme Lab, Great channel. Can ask what type of gloves you are using in your video. Thanks in advance.
Just standard 1000V gloves
im new to electronics so i dont know how to use a transister yet :/ so do anyone know if i can use a relay instead for my LED Cube and will the timing be right?
If you are doing any high speed switching/dimming- no a relay wont work. Cheers
Does this kind of relay only switches AC current output, or would I be able to control a DC current with it?
Both
hi, i gone thru some video that they recommend to supply separate power supply for the relay, but some don't, i not sure is it really necessary to have a separate 5v supply to the relay?
Yan Mong Chan , thanks for your reply. if my relay has lesser ohm, should i add a resistant in series with the relay? will it works?
At 3:03 he basically explains why you shouldn't connect a relay directly to the arduino or any other microcontroller. For that you have control circuits like Yan Mong Chan explained which basically work like this: Output of an arduino or microcontroler triggers a transistor (who in this case operates as a switch) which then triggers the relay, so if anything goes wrong with the relay, the control circuit will get damaged while arduino will be safe.
If you want to control more relays or other components like motors the easiest way would be to use a Darlington Transistor Array for example ULN2803 (www.ti.com/lit/ds/symlink/uln2803a.pdf) as they require minimum components. All you need for this is the ULN IC and power supply which has to be the same as the power requirements of the device you are controling (12V if using 12V relays, 24V if using 24V relays,...).
hi I'm using a relay and Arduino to switch on and off a solenoid door lock
my problem is on power up of the Arduino the relay activates unlocking the door
I set the Arduino pin low but dos't help.
Again my problem is when the Arduino power is restarted the door opens as the relay gets
a pin high from the Arduino
any help please
Try setting your pin HIGH initially. Make sure you do this in the setup() phase.
MrBildo thanks for your help I made the change setting the pin HIGH and made the changes in the loop from high to low etc
and it works great
so thanks again
What can we use if we want a output voltage between minimum and maximum voltage (not as on and off switch but as a fan regulator)?
a mosfet
Can I make a sketch that gradually fades the light bulb in and out?
For that you would need a solid state driver like a transistor- Relays are a bit too slow for dimming and would cause massive back EMF issues as the relay coil becomes similar to an ignition coil :)
Ok, I've found out I can, but it's too hard for my electrical skills. I'll probably buy my way out of it
Can someone tell me if a ssr can be used for 5v direct current? would be to control an injector in a fuel injection project managed by arduino
Just use a mosfet. One like IRFZ44N is good for 49amps.
MKme Lab thanks
HOW ABOUT USING MORE THAN 1 LIGHT BULB, HOW WOULD YOU DO IT ?
Wire the bulbs in parallel. Make sure you use a relay that can handle the load of all the bulbs combined.
I am sick of my 91 corolla, leaving the light on, it does not have any beep or warning to let me know that I did left the light on, so I am going to connect two relays horizontally to have two positive voltage from the door switch(fuse) and the head light switch(fuse), so with the two on, I will power on a beep device that I will connect the circuit, like this I will save my battery :), what do you think? sounds like a project? :)
Absolutely!
nice
why is everyone so concerned about 110v i can understand being concerned by 220v. i've been shocked more times then i can count by 110v and i am fine. (some of my friends may disagree with that but trust me i am fine :D )
+Beginner's Tech 110 at the amperage available is way more than enough to kill you.
I hooked up an 8 channel relay module board one of those typical ones you buy from amazon. I wrote a simple sketch to check it out as I want to use it to power some linear actuators. On power up all relays go high and turn on power to all linear actuators and everything that could be connected to them... this is not good. Once the program rolls through the loop the first time it functions as programmed where I'm cycling through the 8 relays turning one on at a time with a 1 second delay and then back off. So how do I get around this problem on power up where everything turns on?
Tom Collins - I’m having the same issue - how did you manage to resolve this? Thanks
be useful if you showed which ones are the NC and NO connectors on that blue-colored relay.
They are labelled on every relay and differ by brand.
Some would say this video is “relay” (really) basic
My relay will turn on but not off I have to restart my pi every time to turn it off please help me!
prokiller grape what you can do to trick the pi to think it is at g or 0v is to set it as an input. Be sure to add the diode as he mentioned in the video so the excessive voltage don't go into the pi when you turn it off (switching to input).
This all has to do with that the pi and the relay don't have the same specifications on what is classified as HIGH and LOW.
Hope it helps!
Christer Garpenlund thanks that was the problem.
wait. what does it do again?
Maaaaaaaaaaaaaaaaagic
:'(
it uses a magnet, an electro magnet to open and close a switch that is more hefty and can switch circuits with much higher voltage and current ,the electromagnet is powered by low voltage like 3v or 5 v
the relay can switch things that are 120V, think of it as a light switch in your wall that you have glued a small powerful magnet to , then positioned an electro magnet with in an inch or 2 of, the electro magnet is being powered by 9v say, when you energize the electro magnet it pulls the switch closed the circuit that runs the electro magnet and the circuit that is being switched on or off are not physically connected with any sort of conductor one runs on 9v DC the other on 120v AC
hobby boards like the arduino and the rpi run at like 3 or 5 v DC
so they can not be used to switch things that run on higher voltages and currents like 120v AC ,the relay lets you open and close switches for higher voltage and higher ampere circuits and different types of current curcuits,or acts like a switch for
those higher current higher voltage circuits ,the lower voltage circuit that is controlling the higher voltage
It's a digital switch, that can switch high voltage devices.
Its not digital it is z simple electro mechanical device
It is just a magnetic switch