Blynk IoT (Blynk 2.0) App w/Arduino Uno R3, ESP8266 ESP-01 Module, Blynk Cloud & 4 x LED [TUTORIAL]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys welcome to this 4 led iot light home we're using a blink iot arduino uno r3 and an esp-01 module you can see in the video we have done a little simulation for a four light home so bedroom light living room light bathroom light and kitchen light each color is represented and you can use a web browser as well as the app on a phone and we're also uh using blink 1.0.1 with wi-fi so this is the fritzing diagram we've got four leds with a re respective resistor for each led as well as the wire going from port 8 all the way to port 11. these are the digital ports we also have digital pin 2 and 3. if you look from the arduino uno r3 board we've got an orange wire on pin three that's for the tx that's the transmit and the green wire which is on digital pin 2 is for the rx for the receive and the purpose of this is to communicate with the esp-01 module for the wi-fi the iot and so forth we also need to uh power this thing up with a 3.3 volt circuit we cannot use anything higher than that so that is connected uh via 3.3 uh we also yeah we also need uh two of these red wires to power this thing up and of course we need to plug in the negative wire also so as per the fritzing diagram in order to build this blink iot device we're going to need all these components we're also going to need to use a smartphone as well which is right here and you can use an iphone or an android you've got to use the blink iot app i'll get into that uh just a little later but let's just put that aside for now and focus on the device so let's just uh look at the components that you need so you're going to need five male to female jump wires you're going to also need six male-to-male jump wires of course you have your arduino uno r3 board you're going to need a half breadboard you're going to need four 220 ohm resistors four led lights you're going to need the esp-01 module and this thing here is quite important this is the esp8266 esp-01 wi-fi module downloader also known as the esp-link version 1.0 and we need this in order to adjust the settings for the esp-01 module now before we build the device we need to configure this esp-01 we want to make sure that the the uart and the board rate is correct we want this to be set at 38 400 board uh by default it's a hundred and fifteen thousand two hundred board what we don't want to have is problems with the packet size say if we're using a phone uh or a browser to transmit signals like something as simple as turning a light on and light off and the packet sizes are so big it causes problems with the device and causes the thing to cut off so we need to configure this to be 38 400 board and in order to get that done we're going to uh we're going to use our esp link 1.0 so how do we link this up together how do we put this together what we do is we take this and we insert it like that so you see these mail pins are uh not being covered by this and this part and this part are facing that way so we need to put this into a usb port of our computer with arduino ide so let's do that right once we plug the esp link in with the esp-01 module on the top we're going to load up arduino ide we're using 1.8.19 in this video if you've done it correctly uh you should be able to load the serial monitor but just make sure that you've got the right port so uh it should be yep we're connected to the right port if you go to serial monitor um we're 115 200 board if you type in a t just make sure that the module's working and it is if you want to check the uart and the board rate it's a t plus uart and then a question mark and you can see it's 115 200 and with 8101 right we want to change that to 38400 so we're gonna we're gonna punch in at plus u a r t equals three eight four zero zero comma eight comma one comma zero comma one for the baud rate and the uart okay and um you'll notice that when we try to do that remember we need to set this now to 38 400 board otherwise we can't read it just to make sure that it's working a t is okay a t plus uart question mark and now it's at 38 400 with 8101 respectively right and once that's done we can take out the esp-01 esp link and uh we'll start building this device okay let's start building the device so we've got the arduino board and the breadboard and let's just move this stuff aside so first thing we're going to do is we're going to connect the uno board with the breadboard so we need to power up these rails so let's start with the 3.3 volt all right make sure you get it into the right pin okay and put that in to the positive rail as shown and similarly you want to do the same thing with the negative the black wire into the ground put that in okay good so far so good now we need to um let's connect the esp01 module all right so we're going to need the male to female and the reason for that is because right you can see the pins the reason why we have to use the male to female wires is because of the nature of the mother the nature of the breadboard i was about to say motherboard the nature of the breadboard and this you can't simply just jam it like that it will not work right it will not work because of the way that uh these channels go this way and it will not work like that so these these pins all have to be separated and not connected with each other so this is not friendly with this so we have to use these wires okay anyway let's uh make a start so we're going to connect the positive and the negative together sorry that's the wrong wire we should be using the male to female so let's let's work on that so all right so this is going to be all right let's just jam that in there and we also want the black wire just put that there let's make sure you get it in to the right rail there are times where i have put these components into the wrong rail sometimes it just doesn't power up it could be even worse sometimes it could be catastrophic but okay you also want to make sure that you you want to align it and i'm looking at the fritzing diagram on my screen you can't see it but i can see it you want to make sure you put the right wire into the right pin on the esp-01 all right so we're going to power this thing up so we've got to plug the two 3.3 volt on the on the channel the positive channel right and uh yeah the module will just dangle just like that it will dangle it's okay it's fine as long as the wires don't fall off then it should be fine right now the rx and the tx so remember we want number two green wire and orange wire you can use any colors you wish i mean i'm just i'm just using i'm just using these colors because i i um i'm so used to rx and tx being orange and green for all the projects that i've done on youtube and school and so forth but you you are free to use your own colors okay so there we go all right so it's all connected so there should be one two there should be uh three on that side and two on the other side so there should be five all connected we do have some pins another one for the reset and another one for the flash if you want to uh flash this device and program it but we don't need to do that for this device for this simulation right you notice how it just kind of dangles with the wires and it holds it in place and it should be fine now these wires we need to connect the leds now also we well we have the resistors they're quite long so if you have a pair of scissors handy you could trim the resistors i think i've done this on a couple of other videos you can trim the resistors so they are not too long so if you have if you happen to have them like this just just trim them all at once and trim them we don't want to have these resistors sticking out we want to we want it to be flat on the breadboard at the same time we want to be able to make sure that it goes into the breadboard so we don't want to make the legs too short right now we've got four small resistors and bend them right l shape or a 90 degree angle and right we're gonna go red orange yellow oh sorry red yellow i'm thinking of the colors of the rainbow so it should be red yellow green blue no orange sorry we don't have an orange led in our position okay now we want the uh positive sorry we want the anode leg to be left and we want the cathode leg that's the short leg to be facing right so let's uh let's do that so let's put let's put that there so that's the red one and i don't think it needs to be so far to the left we could sort of smack it in the middle let's just try okay it should be fine so red yellow again make sure that the anode long leg is on the left and the cathode short leg is on the right okay so but now they're all in so now the next thing to do is we want to get these resistors in there so i'm going to turn this around so you can see it better we want to plug the resistor into the negative rail and plug the uh anode the long legs in to the digital pins so let's get that sorted so we should have hold on so just remember we flipped it around so now the uh the short leg is on the left side reason why i'm going for four leds is because you can have four bedrooms in your iot smart home okay so let's let's get that in there right i think that's it now we want to get these wires connected now because these are short wires you can use long wires but i don't want to long wires dangling all over the place so what i do is i um have the digital pins here and i have access to the anode here so i can just use a short wire no problem so we use the red wire to connect the red long leg and that should be on pin 8 so luckily we have the actual arduino board this is the genuine board mind you so it has all the numbers on the sides really convenient so we just push the number eight just like that so number eight and number nine just connect all the colors and number ten and number eleven you can put them in any ports you want but you're going to have to remember or at least you're going to have to know which ports you put them into because that's going to be important when we start programming on the blink cloud and we'll get to that in just a moment okay now that looks like and uh that's what we get all right so we've got ourselves the we've got the lights got the arduino board and we also have the esp-01 module just like that so there we go brilliant now we can also grab ourselves the usb wire so one end here and uh let's plug in the other end let's plug that in so three two one and yep lights up no problem okay at least we know it's powered and it's supposed and it's going to work we've got to get the program in so let's move on to the next part so for this part we're going to set up the blink iot app we're also going to use blink.cloud on computer so first you need to go on your phone whether iphone or android you need to download blink iot right and once you've downloaded that you can open up the app and you'll get this we're going to use a computer to sign up so let's switch to computer now on google chrome a web browser let's go to blink.cloud and we're going to sign up for a brand new account for blink.cloud right so first you need to sign up and put in your email address and you want to press the box for i agree and hit the sign up button as shown right you'll get an email and you need to verify your account and just go to your email and verify and once you've done that you should be able to uh well you need to set yourself a password so we're going to do that now so set yourself a password and once you've done that you should be able to continue yep put your first name right there we go we now have an account so if we go back to the computer go click on the back to login so put in the email address that you used to register with and this is going to be your username from now on and put in the password that you just created on your phone and press login and there we go now before we start creating and uploading code to our blink iot device we have to go on to blink cloud blink.cloud and create a template for a device to prepare that so that we can upload the right keys and the right tokens and so forth into the board so just bear with me for a moment and i'll show you how it goes and it will all make sense okay so now we're in blink cloud so what we need to do first is go to templates on the left hand side and we're going to create a new template so click on that now give your template a name so i'm going to call it iot home lights you can call it anything you like just uh something catchy something relevant okay now for hardware we are using arduino there's lots of different hardware you can use but we are using arduino the connection type is wi-fi uh you can put a description but you don't need to and then hit the done button now you'll notice that uh there is a template id and a device name you're going to need that for your code later for arduino ide we'll get to that later we're not quite done yet now something else you need to do is you need to specify which pins do what which pins are input devices and which pins are output devices so what we have to do is go to data streams okay we're in the template iot home lights mind you go to data streams and press new data stream now we're going to if you remember the fritzing diagram we have four leds and we are going to have a red yellow green blue for digital pin 8 9 10 11 respectively so what we do go to new data stream go to digital and we're going to call this let's call it led underscore pin 8 and you can choose a color if you want to you don't have to it's usually automatic and remember to assign that to the right pin it's an led so it's an in it's an output so click create okay that's that now you want to do the same for the others now you could just go to new data stream go to digital and do the same thing now i could call these like bedroom bathroom living room kitchen whatever but i'm just going to call it by the pin number okay now this one i'm going to make yellow so and then this will be pin 9 and you just keep going you can't use pin 8 because it's already been used for the red light okay right uh you can also copy them as well i believe so if you you can duplicate them so you can say uh copy nine and put that into ten instead of pressing new data stream all the time it's entirely up to you how you how you do it so and this will be green okay and then do another one and this will be pin 11 just make sure you choose the right pin and yep and that should be blue so there we go right and don't forget to save now we want to make a user interface for blink.cloud when we use it on a web browser so this is google chrome uh so if we're going to use a web browser we need to have a youtube user interface so we go to web dashboard we'll do the mobile one on phone later now for the web dashboard uh what we have to do is create a press edit we need to create the buttons so we want to be able to have four buttons each button is going to turn on one of the lights okay so we need four switches so lay out the buttons on the screen you can lay them any way you like there's all these other ones as well that you can add but we're going to keep it simple we're just going to be turning lights on right and you can resize them as well if you uh if you so choose so we need to start labeling them and we need to start referencing the right led uh the right pin numbers as well all right so we start with this one go to settings and go to the data stream so we want pin 8 okay and pin 8 could be the bathroom light and you could have the on off labels and this is what it would look like right and you can test the button like that so you can either have the name on or have it off i just like to have it like this again it's entirely up to you how you do it right so that's a bathroom light and this one could be the uh i don't know living room light make sure you choose the right data stream so each one is going to be different so do this one bathroom light living room light okay just stretch that out slightly bathroom light living room light and then this will be a kitchen light maybe so this is a bit like a smart home an iot home where you can turn lights on at a home using a phone or using a web browser that's connected to the cloud with wi-fi okay now for this one uh we'll call it the um bathroom light oh wait hold on did we do did we do bathroom hang on oh we did sorry that will be the bedroom light sorry it should be bedroom okay let's do that so that's the bedroom light okay if you don't like the name just go in and just rename it no problem right so there we go now we save it and this is how it would look on the device and we can just flip the switches we still have to upload some code we still have to create some code for our arduino device so just bear with me um right okay there's our template and if we go back to templates you'll get this now let's go to the phone so on the blink app on your phone this is the iphone version go to the developer mode so it's the option at the bottom and you'll see the template that says iot home lights now you will recall that we created an interface but that was only for the web version the blink cloud version the one from blink.cloud on a web browser does not carry over to the phone the phone version and the web browser version are two separate interfaces so we have to make a standalone version on the phone so to do that in developer mode we press iot home lights okay and you'll get something that looks like this now on the top right corner you'll see a plus button hit that button and you'll see under controllers it says button so press that and now you've got one button right and press that button and now we want to uh give it a name so uh if you remember what we called it so uh i think the first button was uh let me see the first button was bathroom light wasn't it yes okay and remember bathroom light we set to number eight you can change the color if need be all right it's again as i've said before it's entirely up to you so bathroom light is eight now you want to make sure that you use uh switch because i think if you use push let me show you what happens if you have a push button right if you have a push button oh hang on if you have a push button you have to hold i can't show you now um because the device is not online if you use a push button you have to hold the button down and you turn it off by letting go which can be quite quite repetitive because you've got to keep your finger on it so we use switch by using switch you just push the button and it's already on you turn it off by just hitting the button again and so every button that we put on this uh interface should be switch all right you'll see in a moment later what i'm talking about all right so now let's keep going i think right hang on sorry let's go back all right let's uh hit the uh let's just do what we did for all the other buttons so this one will be living room light and this will be pin 9 on the board so that's a switch and this will be the yellow button so we've got the colors conveniently at the bottom and let's yep that's good now we want another button and this is the kitchen light and this will be pin 10. excuse me did that wrong and switch and that will be pin digital pin 10 and that's the green button last but not least we have the bedroom light so bedroom light and that will be pin 11 and that's blue all right make sure that's a switch okay right we want to organize these buttons a little better so uh let's put the kitchen light and the bedroom light at the bottom so you need to hold the button down and then you can just drag it to wherever you want it to go now i want this button to go on the right if you hold the button down you can stretch it out like that anyway you see fit right so once you've got them in the right size and the right position then you are good to go after this we're going to create some code and we need to upload it to our arduino board the blink iot arduino device with esp-01 for wi-fi all right that'll do okay so there we go now the next thing we're going to do is create some code and upload it to the arduino uno board now in order for us to do that we have to use arduino ide again we are using version 1.8.19 at this moment in time so we also need to use a code generator and the easy way to do that is we're going to use something called the blink example browser now let me show you what that looks like so it's example examples actually dot blink dot cc just like that and this will help to generate the code for the arduino uno board so first thing we need to do is choose arduino uno as the main board and we're going to use the arduino uh sorry esp826 wi-fi shield which is the equivalent of the esp-01 module right and you'll notice when we use that particular drop-down box it will generate the respective code now over here you will see it says template id device name and auth token and what this does is this will help us to connect our arduino uno board via wi-fi to blink.cloud right the problem is we don't have all these details yet because we have to go to blink.cloud and sort it out so that's what we're going to do now so we'll just put that aside for the time being the arduino ide or we could just minimize it all right we'll get back to that later so we're going to open up another browser and we're going to go to blink.cloud right and yep we're signed in we should be signed in already if you're not sure yet we are signed in okay good now in order to for us to set up a new device we have to go to search and down at the bottom there's a button that says new device right now we have no devices we're going to create a device from the template that we just made before so this was the template okay if you remember from you know all the leds and we've got the web dashboard and we also have the mobile dashboard on the phone so go back to search and hit new device we're going to use the template that we created before and that's the iot home lights and we'll call it we'll just call it the same name it doesn't matter iot home lights it is okay now if you see this it says this is the template id the device name and the auth token and this is going to connect the blink cloud with our device but in order for that to happen we need to put this code into the board so we need to copy this and it will copy it to the clipboard right well actually sorry we're supposed to copy and paste each bit line by line although what we could do instead we just click copy example it will copy all of this code to the clipboard and now let's get back to arduino ide and what we do is we simply just delete all this and just command v and just paste all the code onto the screen into arduino ide into the sketch now uh we can just go back to the console uh the blink dot cloud console and just copy all of this and inside the code you will see it actually says template id device name and auth token so all we have to do is just highlight this by the way i might just uh might just make this a bit bigger a smidge bigger okay we just highlight that and command v and it will paste all of that accordingly right now around here where it says ssid and password you want to put your wi-fi credentials uh in here so uh in order for that you've got to put in your wi-fi [Applause] ssid right and then put in your password now down here um you have to specify are you using a mega board leonardo board or a micro board and if you are you're going to use hardware serial but since we are not using that we're going to take it out so put the double slash to rem this out uh since we are using the arduino uno similarly uh we we have the nano as well but we're using the uno you have to take out the slashes because we need to include this in the sketch in the code all right the esp8266 board rate is 38 400 we said that already with the uh with the esp link excuse me right and uh let's see yeah the serial debug console will be at 1 15 200 that's not a problem now for this part here this is what is needed to connect the arduino ide the arduino uno board to the blink cloud now i would like to try and make sure that we do connect to blink cloud and not the old blink server so in order for that to happen if you rem this out and we're going to use this line here so it always guarantees to connect to the new system blink.cloud because there's actually two versions of blink there's the legacy version and then there's blink cloud for blink iot so there we go that's what we want and that code is pretty much it's ready to go so we can it should be saved automatically and then we want to verify that okay now you might notice that uh it's missing a library so what we have to do is we need to install the blink library into arduino let's go to google and let's search for the library so search for blink library it's on github so the first one and you'll see this scroll down to the very bottom or no go to the arduino library sorry it's right here and yep version 1.0.1 that's what we've been using and down at the bottom you'll see blink release v 1.0.1 just download that and it will download accordingly and go into your downloads folder so it should be there and just double click and you've got the files right there so in that folder you'll see two subfolders one called libraries and one called tools we need to put that into our arduino folder in the documents so let's open up another tab let's take that out okay so we can have them side by side and what we'll do okay so this is the documents folder and we go to arduino if you're on windows you'll have something similar in your in your own documents folder uh go to libraries okay and now in libraries you want to copy all of this just drag and drop in there and um copy the tools folder in there okay just like that we want to verify this code and it says done compiling i mean that means the code is all ready everything uh has been validated and uh yep that should be fine so we want to make sure now that we are connected okay you want to go to tools go to the board make sure it's arduino uno make sure you've got the right port everything should be up and running and simply just upload right and that should be that now go to the serial monitor and let's see if that thing connects so you just got to wait you might have to wait a little bit all right seems to be doing its thing right says connected to wi-fi right it's uh assigned an ip address for the esp-01 and once it says ready then it's ready now let's give this a try let's test it and see if it works so let's see if we can get this working so we've got our blink iot device right there with arduino uno and the esp-01 and the four leds for bedrooms and bathrooms living room and kitchen we also have just to make sure that everything is working we have the serial monitor as part of arduino ide we are connected to the wi-fi we have the ip address also on there um okay so that's gonna be fine and on the right hand side the blink cloud right with all of the buttons and everything on the web dashboard and we also have the phone oh hang on we have the phone as well which is right here and uh we've got the blink iot app iot home lights right there let's hit that now let's give this a try so we've got the bathroom light yep it turns on and notice the bathroom light turns on on the web dashboard as well so it pushes accordingly so it's all real time kitchen light living room light and bedroom lighted you can have combinations just like that and if you don't want to use the phone you can simply just put it aside or turn it off or whatever you choose and just hit these buttons instead if you have a touchscreen monitor even better or you can just use a mouse right so i'm using a mouse right now to adjust the buttons uh the switches so let's say i'm in the bathroom and i want to turn the bathroom light on yep someone might be using the bedroom so turn that light on and you get the idea now i did say earlier i would show you the difference between a push button and a switch so let me show you on the phone now right now these are all switches because if i push them they the lights will stay on okay they will stay on however if i press this let's say i want the bedroom light hang on tell you what before that let's turn them off first if i hit the wrench and what i'm going to do is i'm going to press the bedroom light right now it's on switch if i change that to push and if i get out so again right so bathroom living room and kitchen lights will stay on but if i press the bedroom light it turns on for a fraction of a second and it goes off so if i hold it down it will stay on if i let go it will stay off quite repetitive hence the reason why it's better at a home to use a switch and that way if you press it it stays on yeah pretty common okay and of course this being an iot device this being a smart home device you don't actually need to have this connected to a computer you can hook up a battery you could take out the usb wire and hook up a battery and and it will work just as long as you're connected to wi-fi to the blink cloud if everything's connected to the blink cloud it shouldn't be a problem so there we go it works and thank you so much for watching i wish you all the best of luck with this project if you have any problems any issues and so forth please feel free to ask so thank you so much for watching and we'll see you soon goodbye thank you
Info
Channel: Paul Marriott - CHANNEL of STUFF
Views: 84,559
Rating: undefined out of 5
Keywords:
Id: hZAX2d8qrbs
Channel Id: undefined
Length: 39min 57sec (2397 seconds)
Published: Sun May 08 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.