How many relays can I connect to one Arduino?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
did you ever have one of those projects that got just a little bit out of hand i have hey everybody i hope you're having a fantastic day i have been asked several times how many relays can i connect directly to one of these mega boards without blowing the thing up well i am about to find out now before i get started i want to say that although i've hooked a fair number of relays directly to arduinos without problems and ran them for years my favorite way of doing it and the way that you should do it is by using external power on the relay boards now my favorite way to accomplish that is to take an old usb cable this is an old micro usb cable and i took the power and ground lines of the usb cable and what i like to do is find these cheap this is a samsung clone charger and i actually use one of these to power the relay board and use the other one with the usb cable to power the arduino now that being said i don't think we're going to get to the point where i have to multiplex relays but we are going to find out exactly how many i can hook up without crashing the thing without burning it out let's get started so i've written a few torture tests to put both the arduino and these relays through their paces and i'm looking for the arduino to either reboot or looking for these things to not trigger reliably or to skits out but before i do that i wanted to figure out exactly at what phase is the arduino using the most power now that may seem obvious that when i write these pins high it would be but that's probably not the case because these relays trigger when i write the voltage low on the pins and so when i write the voltage low the led comes on so my hypothesis is that this thing is actually probably using more power when the arduino pins are written low than when they're written high so i've written a simple sketch to test this i am writing all of these pins low for five seconds and you'll be able to tell that because the leds will be on and then i'm writing them high for five seconds and the leds will be off and we're going to get an idea of how much current is being used and it's going to loop through that so let's hook it up so it looks like we are using about 400 milliamps with all these relays triggered and about 90 milliamps with them all off so that is a gigantic difference we're using more than four times the current with them triggered versus not so let's start torture testing so just for simplicity we're going to start using the terms on and off uh on will be representative of writing these things low and off we'll be turning them off writing them high so i've written my torture test and what it's going to do is it's going to boot up it's going to set all these pins as outputs and then we are going to turn all the relays off then we're going to turn each relay individually on off on off then we're going to turn them all on for two seconds and then off for two seconds and we are looking for any sign that something is skitzing out so right now as you can see we're getting nice clean clicks we're not getting any kind of jumpiness you can see a little bit the leds dim here when they're all turned on and off but otherwise we're getting nice clean clicks and it seems to be operating very well okay here we go 24 relays uh i'm guessing there's about a one percent chance that this is going to work and i'm sure some of this would depend on how much of a load you had on these relays and how snappy you needed them to be but let's give it a shot here's the test that was clean they all go through pretty cleanly 32 relays contact so as you can see while all 32 relays worked individually we did not have enough power to trigger them all on at the same time now some of that could be do some to some losses in the breadboard but uh i'm guessing we've just hit the limit stick around to the end of the video and i'm going to attempt to hook a relay up to every single gpio pin on this board both analog and digital but in the meantime there are a few conclusions that we can draw the first one is that although it's not advisable you can hook an 8 channel relay up to the arduino power it with the arduino and trigger the relays on and off in any combination you want it will work the second thing that we've learned is that intermittently you can connect up to a total of four of these boards you can't power them all on at the same time but you can intermittently use some relays if you want to now that is not advisable so the question is what is advisable and that is to use external power but there's conflicting information on the internet so i want to show what i've learned the first thing is that when you look at this relay board you will see that there is a jumper here that is inconveniently labeled jdd hyphen vcc and that jumper is connected now you might think that by moving this jumper over to this side you would get some different mode but you do not want to do that what you want to do is you want to completely remove this jumper and the way this works is that you will connect the ground of your external power supply to this side you'll connect your voltage or five volts of your external power supply to this side and this doesn't make a whole lot of sense at least it's not obvious but you will also connect the vcc on this side directly to your arduino and you absolutely do not want to connect the ground on this side to your arduino in fact you might want to store the jumper there so you remember not to connect it but so that's ground to your power supply vcc to your power supply vcc to your arduino and no connection here and what that will do is that will both allow you to power this externally so that you're not drawing too much power off the arduino and it will allow you to properly isolate this relay board from your arduino so how do i do that my favorite way is to take an old usb cable the higher quality the better and i cut the ends off and strip back and get the red and the black to be my hot and my ground and this hot and ground will go to the vcc and the ground over here on the relay next i will connect the vcc from the relay to a 5 volt pin on the arduino and that is my connection between the two but how do i power it i love using these samsung style dual usb chargers and so what i do i make sure that i have at least 500 milliamps for every single one of these relay boards that i'm trying to power up so if i'm going to power up four of them i want to make sure that i have a 2 amp charger to support this ideally though i generally use one little usb charger per relay bank just for the heck of it so what i like to do is plug the relay into the charger and then i use the second port of the charger to power the arduino so now we have a nice neat package that gives you electrical isolation and powers your relay bank and powers the arduino that is how i like to do it in the field okay here are 72 relays 68 of them are hooked up i am using every digital output pin as well as every analog pin on the arduino no multiplexing i'm not going there but let's see what happens you're seeing this for the first time just like i am oh goodness that's a lot of snapping [Music] wow four amps of current 68 relays one arduino if there's any jank i would blame it on my wiring or the relay but not the actual arduino itself there you have it ladies and gentlemen 68 relays one arduino very loud snap you
Info
Channel: AnotherMaker
Views: 34,548
Rating: undefined out of 5
Keywords: relay, 8 channel, 4 channel, arduino uno, arduino mega, mega 2560 relay, mega 2560, arduino mega relay, max relays, most relays, maximum relays
Id: e5mT-tp_lYg
Channel Id: undefined
Length: 9min 38sec (578 seconds)
Published: Sat Dec 19 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.