arduino 4 relay shield


This video, we are going to see how we can use this for channel relay without davina to control, AC load or AC bulb like that. So we can control four separate AC load. That load can be bald. It can be a heater, it could be a fan, anything that you want. You can get the quote for this project by clicking at the link at the description which will take you to Robo jog that console ashland, slash ORD. We know a word of warning if, when you’re working with ez that’s now connected to AC power, make sure you do not touch this area or underneath and make sure that this module is on insulated surface like what plastic something like that, if you’re working you want To adjust something or change, something make sure to disconnect the power from the outlet. This is the relay module and we have four relay that’s why this is called for channel or for relay module the relays. At this point, we have three terminals for each relay, so these two this and this terminal as drawing shows they are normally connected without power or anything. If I connect a power here, a light or a load, it will be connected I’m using my multimeter as a continuity to start here you see the sign and when I connect these two probes, just buzzes I’m, going to show you that this terminal these two folded, This really these two terminals are normally connected without any power or anything, and these two are normally open same thing for this one and the other.

This is normally connected without any signal. When the signal comes here, then this and this plane will be connected when you connect and use it. You always put one of the wire at the metal and the other wire, depending on your application. If you wanted the power to come, when the signal comes to be disconnected, you just put it here, because it’s normally connected and if you wanted the other way do not change anything about the metal. One just switch your wire there and then here we have four terminals, we have sex input. This is ground. G and D will be connected to ground and this VC C will be connected to five volts, and then we have n 1 n, 2 and 3 and n 4. So this has input 1 input, 2, 3 and 4 for these four relays. So this is really one really to retrieve 3 4 and the same way we have four LEDs here to show the status of these relays when they are activated at this on this corner, we have a jumper okay, so let me just put it through the jumper: You can either connect it. You, the jumper, could be either connected or removed. When the jumper is connected, these relays will take the power from the five volts that you connect to this VCC, either Arduino or whatever, so the power will come and will be connected. But if you want to totally isolate this from Arduino, because sometimes because, due to high current and other reasons of connecting expensive equipment, if you want to isolate it, you can do that by removing this jumper.

But you have to supply 5 volts separately by an adapter for this, so you see the bus and now let’s put it. So this understand are connected so remember that the module length is very 5.1 millimeter. Fifty five point: two millimeters, the adaptive eighteen point: eight millimeter! This relay is low regard, meaning that with the value of low or zero volt, the relay will turn on at the input and the value of five or high the relay will turn off so with the low it will be triggered or turned on. So let me connect and show it to you. This is now the ground pen, I’m gon na put it on the ground here and this Arduino, and this is the five volts I’m gon na put it as five volts now. This has the power, but does not have any signal to control so I’m, going to put this on an input one so now I’m going to connect this to five volts. As you can see here, nothing happens really one supposed to turn on now. If I’ve connected to the ground, release or now so that is the meaning of load trigger with low it will trigger and turn on and with the high it will not trigger so it’s possible that you can get or by high trigger, but does not matter. You can just adjust the code and play with us and make it work with any way. You wish think that you remember for the relay.

Each really has a rating, as you can see here, that says: 10 amperes, 250, volts, 50 number, 125, volts and 10 ampere 250, so it’s 10 or 15 ampere for a lower voltage in North America. It will be 15 ampere and for the higher voltage in Europe and Asia it will be 10 ampere, with voltage rating on the region, calculate the rating of the power for the region. That say, you have 240 volts and then times 10. You can correct up to 200 2400 watt or 2.4 kilowatts in each relay, so each are independent, so 2400 watt and that’s 1 2400 watt and this one. But if you are in North America, then 120 volts time 15. So you can correct up to 1800 watt 1.8 kilowatt of node into this. So if you do not follow the rating of this relay, the relay will melt down. It will be very dangerous, so make sure that that is the maximum it doesn’t mean that it continuously can handle so make sure always leave some room for overheating. Let me explain now the code for the beginning. We said number of channels death, a program that I wrote can work with any number of channel 16 channel 20. As long as yours, you have the right type of module. If you have Arduino Uno, you can go up to 12 channels and if you ever do in Omega, then you can go higher, so this 4 determines how many eerily you have and then beside that in the relay array.

Here this is an array that holds the pen number for each relay, so this is the first relay that’s, the second relay that’s, the third and fourth. So it starts from left to right, and these are the pen. This has been two and three and four and five, and then you put comma and then type other one if you have something like eight or whatever, wherever you want to connect it. So for this case we are just going because I have four, then I have four pen here defined after that. This is the wait time 2000. Second, two thousand millisecond, which I’m gon na explain next and then the eye is needed for counting death to make it automated, because we don’t want to write multiple code manually. We want to make it automated after that inside the setup which starts from here and in here these are the important steps. First, we said the serial monitor to print this text. For us and remember, this 9600 is the number that is on this corner and they must match, and then we have a for loop, which starts with I equals 0. I already have been defined, so you don’t, I don’t have to so. I don’t have to define it here and then we say I is smaller, that channel or CH which we have here it. This is SSI if I type 4, so I see less than 4, which means it goes from 0, 1, 2 amp, 3, and then I increments.

So when loop starts, the spy is compared with the CH. I is now 0 compared with CH, which is 4. This is true, now is smaller than 4 and then, after that, it comes here and says really: zero. Zero means the first value, and this is the one that’s, the two that’s the tree, so zero one, two three. So this is zero, so the zero mean so pen two will be output and then we’ll go span trip and whatever for whatever value you have here, it will be set as output and then we are also setting it as high because the relation turned off – and This is low, trigger and high mean off, so we are setting it the same way as off and after that we just put in this text which will be here. You will see it. This text is that so this is the text being printed by death, and then we have a main loop which starts from here and ends here inside the loop. I have two for one here to turn the release on and then one here to turn them off. Now to turn them on again I become 0, 1, 2 and then 3. So the value of I changes so here this line just prints. This text really fool off and remember here, because the value is 0. I have added 1 because we don’t have really 0. So 0 plus 1 is 1 really 1 and then really 2 is actually.

This is 1, so we are adding one more to reflect human readable value, not 0, 1 2, and then this the same way as here it turns the relay on which means it says it low and then waits for the amount of time that we said 2 Seconds so, as you can hear the clicks, each weight is 2 seconds. It turns on and then waits for two seconds and turns the reading and the second relay on and then the third really and then the fourth really after that. Just does the same thing as the above this time we are turning them off here, they’re low, which means on and then high, which means low. So we are doing the full release of this is just 4 general illustration of how to use this, and because I wanted to use all four of them. I use this to show activity of four relay, but in your case, if you want to use it differently, for example, if you want to use it Manimal. So if you don’t want this – and you want to understand it, if you have trouble with the relay array I’m, just removing this so remove it and put this – you can see that we have to put so many lines to do the same thing. So this is turning when you put relate zero, it turns the zero means, death and one two, three and so forth, so it says the output and set it as high and this one ancestor that’s high and then really one.

So this is for really – and this is for really three – and this is for really four – so I’m gon na stay with this and the same thing here. So if you want to turn any relay on or off so do this inside the loop just type here. One that is that relate to, if you type so, if you type this will be really three and then, if you type one it would be really two and so forth. So these are the relays that will be turned on and off. So you can control. So you can control turn on the relay by setting this low and turn it off by setting this as high, and you considered under certain conditions. For example, if something is pressed or some viable, some value of temperature is equal. Sixty five, then you can say really. Yes, really, yes, really number three should be high or turned on else. If the temperature is not that, then turn it off, so you can do. Whichever way you prefer that temperature is larger than 65 smaller than 65 well. This is just an example or any other value of button is pressed or something so this should happen now. Let’S, look at the demonstration of this code. I’Ve connected this AC bulb to the relay number two, so this is really one not really. Two is now often really three is off and really for it off and then really one will be on and then two will be on.

If you can see the light is on and three and four so all of these will be on. So there is a problem, however, that this now totally they can see what about 250 milli ampere, which which is okay for this Ord winner to supply. But if you want this one to be totally isolated, then we can. We have to connect here, external five volts for the relay and this opto coupler or opto isolator, or completely isolated, isolating the Arduino from the circuit so I’m going to show you now. So I have five volts here now to connect it with 5 volts. First, remove this and once removed it I’m, putting there 5 volts connecting it here, and this is a pen, the 5 volts, so the 5 volts I’m connecting it the pen on this side that this side already have the 5 volt which is connected to this wire. The VCC so I’m putting it as you can see, the release of the signal is coming, but the relay is not working. You don’t hear the clicks because they need 5 volts still when I connect this. This will not work because I have to share also their ground with their circuit so I’m connecting this ground and then plug it somewhere on earth. Do you know? I have another ground here: extra ground, so now I’ve connected it and it’s working, and at this time I have completely isolated the relay from the Arduino because of 5 voltage camp coming separately here and 209 pair is a lot, so you can supply it from another Source and imagine if you have 16 relay, it will be and the raw circumstance or the unica supply the current for all of these, because if there is only one relay you have 70 milliampere each relay would consume 70 million people.

Thank you for watching their fourth introduction on how to use this for channel or higher relay using Arduino with AC boot. So the skirt can work with any number of relays just make sure that if you are using a lot of relays – and you want to isolate it – just make sure that connected here. So please subscribe. So you can give up this of my upcoming videos and also, if you have any question, please posted at the description below I’ll try to answer it.


arduino 4 relay shield Video







arduino 4 relay shield news








arduino 4 relay shield Social






A modular, Arduino Mega-controlled delta robot for your desktop.
safe image.php?d=AQDI5lGBL JxubWR&w=720&h=720& content%2Fuploads%2F2019%2F08%2F9154041566833130733 - arduino 4 relay shield

This interactive floor recalls the precariousness of standing on an icy surface, enhanced with imagery, sounds and physical dynamics.
safe image.php?d=AQDDp  jywcEiEdX&w=720&h=720& v6%252Fshare%252Fplay icon overlay - arduino 4 relay shield

Rig #4.1

4 Channel 5V Solid State Relay Shield Module Board SSR For Arduino Raspberry Pi



Originally posted 2016-09-07 17:07:39.

(Visited 56 times, 1 visits today)

About The Author

You might be interested in

Comment (52)

  1. I have a code for only 5v 1 channel relay module. Can you help me making the code for the 5v 2 channel relay module?

    /* — New project — This source code of graphical user interface has been generated automatically by RemoteXY editor. To compile this code using RemoteXY library 2.3.3 or later version download by link To connect using RemoteXY mobile app by link – for ANDROID 4.1.1 or later version; – for iOS 1.2.1 or later version; This source code is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. */ ////////////////////////////////////////////// // RemoteXY include library // ////////////////////////////////////////////// // RemoteXY select connection mode and include library #define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT #include // RemoteXY connection settings #define REMOTEXY_SERIAL Serial #define REMOTEXY_SERIAL_SPEED 115200 #define REMOTEXY_WIFI_SSID “RemoteXY” #define REMOTEXY_WIFI_PASSWORD “12345678” #define REMOTEXY_SERVER_PORT 6377 // RemoteXY configurate #pragma pack(push, 1) uint8_t RemoteXY_CONF[] = { 255,1,0,0,0,20,0,8,13,0, 2,0,20,18,63,30,2,26,31,31, 79,78,0,79,70,70,0 }; // this structure defines all the variables of your control interface struct { // input variable uint8_t switch_1; // =1 if switch ON and =0 if OFF // other variable uint8_t connect_flag; // =1 if wire connected, else =0 } RemoteXY; #pragma pack(pop) ///////////////////////////////////////////// // END RemoteXY include // ///////////////////////////////////////////// #define PIN_SWITCH_1 13 void setup() { RemoteXY_Init (); pinMode (PIN_SWITCH_1, OUTPUT); // TODO you setup code } void loop() { RemoteXY_Handler (); digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH); // TODO you loop code // use the RemoteXY structure for data transfer }

    1. @Robojax i mean is there an earth (ground) for the AC side, as all 240V here have an earth wire for tools, part of the australian standard for electric motors

  2. how much current each input pin draws when they are a high? my question is can a single arduino pin be used to control all the 4 relays simultaneously on and off?

    1. The maximum current and voltage are different when you are using A/C vs D/C though. The relays should have their ratings printed on them. If they don’t you should look it up. Usually they can handle more voltage with A/C than with D/C.

  3. Hello, I have watched this video a few times. I am using a Arduino Uno with a Arduino motor shield. VIN is scraped on shield to prevent overload to the Uno. I have 12v coming into the Motor shield from external source. I have 5v from Uno to Vin input on the relay (The Motor Shield has the same pinouts at the Uno.) This leaves me with the 4 inputs on the relay left. So If I do as you did and ground any of those 4 inputs (IN1-IN4) on the relay, the relay will light up and and click just as your’s did. Then I watched you put that same input wire from the relay to the 5v side of the breadboard, it does nothing just like yours. Fine. I got that part I believe. My question is,,, Do I leave these 4 inputs from the relay connected to a ground on the Uno. Or do they actually go another place/pin.? If you stated where the inputs from the relay actually plug into on the UNO, I must have missed that part. Which pins from the UNO actually need to be connected to the Relay’s IN1 – IN4 ? I’m trying to simply control a Atlas turnout using Arduino/Relay. I saw a video once, but cannot find it anymore. You also powered a light bulb with this config, but never showed how to hook the bulb up to the relay K1 – K4 outputs. I cannot tell by the way your wires look. Since that bulb would only use two wires, I’m guessing that you have them on the closed end of K1-K4?? I hope this makes sense. Thanks

  4. I am using 5 – 4 channel relays…….. Connected separate power supply to arduino with a power bank and shorted Jd-Vcc of all relays to separate supply of 5 volt 2.4 amp but all 20 relays are not turned on instead just 6 Relay are working rest all are working if the turned on Relay is turned off…….. What is the problem…….?

  5. Wait…..can’t you only run 5v from the relay? How is he running AC for lights won’t that be more than 5V?

    1. @Robojax Thanks, I understood. So basically 5V for a 5v relay and 12V for a 12 v relay is to basically magnetize the relay and you can run as high as 250v AC using the relay?

  6. sir, I want to use this relay module for on-off of my air conditioner, so this relay module will work with high load air conditioner?

    1. I told myself how come I did not explain that., I watched the video and indeed I have explained how much power this can handle. So please watch the video and do not escape. It has been explained.

  7. If I’m using multiple relays to power lights, can the lights be powered by the same power supply, or do they each need their own power supply? Would I need to daisy-chain them or is there a single power input that powers all the relays on the board?

    1. for safety reasons, you should connect each relay to AC separately. If you are not sure, asked someone with experience.

    1. why 4 relay? what is the power rating of water pump? it is within the power rating of relay you can use only one (about 2.2KW in 220V AC ). But yes you can make all 4 parallel so they can handle 8.8KW

  8. Hello , really nice sketch , could you make a defferent : Could you write another algorithm, for example, the pins 1,2,3 light up, but 4 not wait for 5 second and then when 4 lights up, but 3 turns off while 4 is up .

  9. The board i got is working on 3.3 v from the NODEMCU ESP8266 board is it ok will it be stable on the long run, I read some place this board works on 5 v Dc. I do not want the board to stop working all of a sudden


Your email address will not be published. Required fields are marked *