Fan Speed Control With & Without Internet
In this video we’re going to make our own friend regulator that works for internet via blink, and also with a manual regulator switch, along with the real time feedback on the blink application. And not only that, if the internet is not working or maybe internet is down, you can still control the speed of the fan, with the manual regulator switch, without internet. So let’s see how to make it. Now those who already watched my previous. So yeah, I’d be using this for speed controlled fans which, which had knee shoulder from the regulator circuit. And after that, I’ll connect all of its terminal with ESP three two board in this manner. So here is the complete circuit diagram of all the components connected with the ESP three tool.
So that’s all about the hardware. Now let us jump on to the laptop and seeing the coding part. This is the code used for this project. So first of all need to have a blink library already installed on your system, or which you can get it by clicking on this link which that has the code itself. After that, these are the pins are defined for the fan regulated, and these are the pins defined for the relays attached to the ESP three can work. After that, the by default mode of this project is with the internet Okay, you’ll get the detail of this more later in this video. After that, here you have to provide the authentication token which must be sent to your registered email id as soon as you create your uplink project we must copy that and paste it here. Great. After that you need to put the city name and password of your router. Okay, so now let’s jump on to the setup part. So one important thing to discuss in the setup part is this line. Okay, so here we will define one timer which will call the function called check blink, every three seconds.
Now let’s see what’s inside the check brain function phrases template function now check blink function will check whether this project is connected with the blink application or not. So ultimately it will check whether it is connected to internet or not. Okay, so if it is connected, then it will go inside the group and the mode will become zero. Now here is zero mode is for within the network. And if a project is not connected to the server, it will return false and it will change its mode to one. Okay. So basically, if it is internet it will change the mode to zero, and if it don’t have internet it will change its mode to one, that’s what we are doing instead the plain check link function. Okay, now why it is important. Just imagine your product is running in without internet always do it don’t have internet and I should turn on the router, how the project will come to know that hey there’s a router is turned on internet is magnetic is connected to it. Okay. So with this function, every three second it will check for the connectivity, okay so if we don’t offer our opposition, it will automatically get connected to the router and switch itself do with internet mode, that’s the benefit of this timer. And then with the loop side, so here if I use keyboard is not connected to the Wi Fi will just print not connected and disconnected, it will just print connected and it will run the blink function. Okay. This means that only when the project is connected to internet run the blink function. Otherwise, don’t run it.
After that here we have to initialize a timer by using the timer dot run function. It’s pretty simple. And here is the main switching point. If the mode is zero that means with internet, it will just call the with internet function as, that means if the mode is other than zero, that means one, it will just all without internet function so these two functions are called like this see what’s inside that function. First of all, we’ll see the function called without intent. Okay. Okay, so here is the function called without internet, let’s just jump inside that function. So first of all, yet here we are checking for the switch now this switch is nothing but the fan regulator switch. If the switch one is load that means, it is speed one okay with me, ultimately call the spearmint function, and inside the spearmint function we have the release to find a way which to turn on and which way to turn off that’s defining speed one speed two up to speed four Okay, that’s pretty simple. Okay, so whenever the switch one is low, we have to call the speed one function, and it will print speed one inside the serial monitor. Pretty simple. Now one question arises, what is this feed one flag, I’m out by if I remove this watch offline, let’s see what happens. Okay, so whenever the open regulator is at speed one, this condition will be satisfied and speed one function will be caught.
So it will be continuously inside this if condition or this loop only and with this as constant switching of the relays will happen inside this function. So what is the solution for this a solution is, we just need to satisfy this if condition, only once whenever the switch is at position one, and for that I have used this flag for speed one flag. So initially, on the flip side position one Okay, now let’s see what happens. So as soon as we switch the fan regulator switch at position one, this will be satisfied and initially the speed one flag is one, that means this will also get satisfied, it will go inside this function it will call the speed one function will switch the relays to speed one position. And after that, as you can see, the speed one flag is assigned the value zero. So for the second time when it goes inside this loop. This condition won’t get satisfied because of this treatment flag.
And for that reason I use the speed once we took the speed for flag, just to make sure that nice conditions are satisfied only once. Okay. And so the things are pretty safe, and if the switch two is at position low call the speed to function. If the switch two is low and switch three is also low or the speed, the function. And if the switch four is low, or the speed for function. So this is what is going inside without internet connection. So according the petition of the Fed regulator, the particular release will be turned on. Pretty simple. And let’s see what happens in the width internet function. So there is a width internet function. The first line is same as the width of internet, if switch one is low and if speed one flag is high, then only go inside this function called the speed one function as soon as the switch is at position one even more line is added called Blue Dot virtual right now. This light is just to send a feedback to the blink application.
Okay, so as soon as we call this payment function, this line of code will send one to the virtual pin v zero of blink application. So with this will not only able to turn the fan speed at speed one, but you’re also able to get the real time feedback inside the blink application. Okay, so that’s the only difference in with internet and without it and for this one light is added. And now what about controlling the appliances with the blink application. Well, for that we are using a function called blink right visit Okay, so what is the data received from the virtual visit, we’ll be calling the particular speed. Next speed to speed three etc. So that’s all about the with and without internet code for controlling the fan speed. I hope you’ve got to know about how the code is working how things are going inside that hardware Okay, make sure you hit the like button if you, if you’ve got to know about this coding and if you know let me know in the comments. Now let us select the right board and code and hit the upload button. So now it certainly is pinned to the board inside the PCB part of the circuit, and let’s see this project in action.
As you can see I’m able to control the speed of a fan, using blink application, and also using that physical and control switch, along with its feedback on the billing application. The router. Now the project must have switched to without internet port. Now let’s test this project in manual mode. Okay, so I’m able to control the fat using this fan regulator switch, like we regularly do in our day to day life. So with this now we can make a complete home automation project, along with the Fannie Mae, that works with and without internet. So here in this project I haven’t made the custom PCB Hans’s sizes a little bit bigger but I’m sure if I make a custom PCB for this project, its size will become way more smaller.