 In this video I'll guide you through everything you need to know about submersible water pumps like this one right here. We're going to cover how they work, how to set them up, how to wire them up to an electrical system and how to control them with an arduino and some super simple code. Let's get started. The pump contains a small motor that is sealed to keep the water out. Here's the o-ring that seals it out. The motor is like the engine of the pump. Connected to this motor is a special fan light component called an impeller. This is like what you would see on a boat. As the motor spins the impeller it creates a swirling motion. This swirling motion sucks water into the pump through an inlet which is down here and then with the impeller forces out through the outlet which is right here. That's how we can create a super high stream of water using the pump and an impeller. And if we were to just put the impeller on the motor like this nothing would happen but because of the inlet and the outlet and the little chamber inside we can create pressure and use that pressure to have a high stream of water or a high stream of thrust. And then once you connect a tube to your outlet you can direct that flow of water wherever you'd like. For our demonstration we're going to keep it pretty simple. We're going to need a couple of different parts. First off our pump and a power supply. Then some tubing I'm going to use half inch pecs, some connectors for the tubing, two buckets to move the water from one bucket to another, some wires and a relay, and then just a basic Arduino to control it all. Now I'm just going to connect everything together quickly and then we can get started on our wiring. Okay, so second pipe and then that's all we need for that. All right straighten this up a little bit. So we're going to be doing this into this. Try and get as nice as we can. Before we do that I'm just going to set up some Teflon on our pump. Teflon is a nice way to seal up any type of water situation you got. All right so now we have our pump going up and over because our pump is submersible so it's going to be the bottom of this tank up and over and into the next one. Now this will be going like that. Okay now from here I'm just going to do a simple elbow, push that in nice and that will go like that. You don't have to do this but I'm going to be using pecs tubing with these little collars to make sure that no water leaks out and sprays towards my computer and any other electronics and then under that I do have some Teflon here. Let me just unscrew this so I'll just be using some Teflon on these pump outlets and inlets to make sure that there's a nice seal between the tubing and this to not lose pressure. This squeeze that's done. Should be a lot easier to just do this and now just squeeze. Just to go over quickly before we start we have our submersible pump which is in this bucket full of water then it's going to go up and around and then back down into our second pump. This setup is not like the one we did previously with the peristaltic pump. This one is one way so water goes from here to here and we can't pull it out of here to here without doing some weird finicky stuff. The wiring itself is going to be pretty simple. We've done this before. If you want to learn how relays work or how to use Arduino's with relays I have a video on it. I'm going to post it in the description below. So we're just going to skip that whole step and we're just going to wire it all together. First step is going to be plugging in our relay to Arduino. The relay has three different ports so let's plug those in. I'm just going to plug in the relay into the five volt port for power into the ground for ground and into part number four for digital control. Then from there we have the relay and the relay is going to connect into a couple different things. The power supply, this little adapter I made for the power supply and then the actual pump because we don't want to just connect the pump directly to power. We want to use the Arduino in between the two. So let's connect our power supply and our pump together in the relay. First off we'll start with the pump. The pump has a red cable and a black cable. The red cable is positive the black one is negative. We'll be connecting the positive to the com port on the relay. Most relays that's the middle one but make sure you look and you see which one's written COM. So now we're just going to connect our power supply to the relay. We're going to have our negative which is the black piece of tape right here and then our all white which is our positive. Our positive is going to go to normally closed. So now both positive from the power supply and from the motor are connected. Now let's connect our negative to negative. Since there's water involved in this project I'm going to try and seal everything up properly. So I just have this black piece of shrink tube. I'm going to slide it over one and then put it into the other. So that goes right there. Let me just take a lighter after and seal it up. All right so to go over everything we have our power supply. The positive from the power supply goes into NC on the relay. The negative goes to the negative of the pump. Then the pump positive goes into the relay but in the middle COM port and then the relay connects to our Arduino. The 5V for the 5V the ground for the ground and then pin number 4 to control it on the digital side of their Arduino. If you are going to do this at home please do be careful because we're using electricity next to water. Make sure you have your power supply away from the project so that you can always rip it off and shut down everything. All right so now that we're done with our wiring let's put this to the side plugging the Arduino into the computer and write some code to make everything work. So for this just open up the Arduino editor. We don't need anything just open a simple project that has nothing inside of it. So for this just open up the Arduino editor. Make sure you're connected to your board which is mine is right here and then just start with an empty project. The first step is to declare a pin which is where you connect your relay. Us we picked number 4 so I'm just going to change that to 4. Now we have setup and loop and setup we're going to put this relay pin which is this one and we're going to make sure it's an output. So we're going to direct from the Arduino to the relay information so it's an output from the Arduino to the relay. It's not we're not receiving information from the relay to the Arduino. Then in our loop we're going to do a couple different steps. First off we're going to turn on the relay then we're going to put a 5 second delay so the pump will run for 5 seconds then we're going to turn off the pump and then we're going to wait 10 seconds. So the pump will go on for 5 seconds then it will go off for 10 seconds and it's going to repeat repeat repeat repeat until we unplug either the relay or the power supply. Now just for the video I'm only going to put this on 2 seconds or I'm probably going to mess around with it but you can put whatever numbers you want here and it's by milliseconds so 2,000 is 2 seconds and 10,000 is 10 seconds. That's it for the code it's super simple this is the kind of the part where you would add different things and play around with it but this is kind of the base you need to turn on the pump turn off the pump that's it. Now let's run the code without connecting the power supply so the pump doesn't start going without water in the tank. Let's just see that the relay turns on and turns off you should hear a loud clicking noise. So I'm going to upload this code into my Arduino. Now look at the relay how the light turns off for 5 seconds turns off for 10 seconds and then it's going to repeat over and over. Let's just change this to one second and one second just to make sure. So upload a new piece of code the relay is currently opened off on on off on off. So we know that works. Now what I'm going to do is add a long delay quickly on the off part and I'm going to plug in and make sure that nothing smokes. Nothing goes crazy. Okay so we have a problem we connected the wrong pin on the relay we put normally closed and we should be on normally open so I'm going to unplug the Arduino I'm going to unplug the power supply we're just going to go with a little screwdriver here we're just going to take our white cable from normally closed and we're going to swap it over to normally opened that's why you test things so nothing blows up in your face and you don't start breaking parts that seems tight enough all right let's plug it in let's keep the pump unplugged on for one second off for five one two three four five okay perfect now let's plug this in the pump should make noise for one second and then be off for five so here so five seconds off and then on perfect so now we know our pump works I'm going to unplug it I'm going to fill this bucket up with water and then we're going to start with the demo okay so I'm going to be as careful as I can I got a full bucket of water here like a lot of electronics and stuff on the table now we're going to take our submersible pump and we're going to dump it in the water it's unplugged right now push that all the way in now I'm going to leave the Arduino unplugged and I'm just going to plug in the power supply and listen and look for any noise or smoke make sure everything is safe okay now we're going to plug in the pump on the power supply it's hard to see on video but right here there's water coming out let me see if I can do it safely so now for every five seconds we have one second of submersible water pump on our pump is flowing from this first tank going up here and into the second one then we have our Arduino which controls the relay and the relay which controls the power supply to the pump so now no hands my hands are right here in the picture putting out water some good real life examples for pumps like these are water well systems for houses when people don't have a water supply and they're living out in the woods they can use one of these in a lake and then pump water to their house for bathroom for kitchen whatever for agriculture so planting and things like that when people have a massive bin full of plant juice and they want to pump it out to all their plants they would use like this if you've ever seen those ponds where the water just shoots up in the area uses a submersible pump like this one right here and for flood control so if your basement floods you just get one of these pumps you put it all the way down in the basement you run a hose out the house and it would clean out the flood instead of you having a tube and like sucking out all the water like your ghost busters you could just throw this in the basement and as long as there's water going into the pump it's pumping into the next container and there you go that's how this submersible pump works we went over how the pump works on its own how to wire it up how to tube everything up how to set up a whole demo and now you can do it yourself at home if you enjoyed the video just do me a favor and like the video and then when you subscribe hit that little bell notification so when i post more videos like these you can get notified right away if there's anything else you'd like to see in future videos let me know in the comments below and if you're looking forward to the next video we're going to be using this demo but with pressure sensors flow sensors and a bunch of other electronics in this tube right here thanks for watching and see you in the next one