Arduino Tutorial 65: Creating Useful Commands from IR Remote Buttons

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys this is Paul McCarter from top tech boy comm and we are here today with lesson number 65 in our legendary our epic new series of Arduino tutorials I will need yourself you to pour yourself a large mug of iced coffee I will need you to get out your super starter kit for me Lego if you don't have one look in the link down below in the description you can go to Amazon pick one up for $35 and you'll have all the components that I am using in this build now I have said that as we're getting to these more advanced lessons I have moved from the Arduino Uno that comes with the starter kit and I've moved to an Arduino Nano you can pick the nano up at a link down in the description if you guys have made it this far treat yourself get yourself a nano and then also instead of using these loopy these loopy jumper wires I have moved to these nice straight connection pins to allow for a much neater build as you see here now this is lesson number 65 it starts where lesson 64 left off and that is what we did in lesson number 64 let me see if I can get this get this focus give me just a second here please let's see one in focus you aggravating thing there it goes okay sometimes it just needs a little encouragement to focus well there that is a good shot okay so what we're going to do is we're going to come over here to the code view and this is where we left off in lesson number 64 if you haven't done this yet you probably need to go back and do lesson number 64 if you go to WWE Tag Heuer comm go to the new Arduino tutorial series if you look at tutorial number 64 you can get the code here and you can also watch how we hook this thing up so you do need to catch up because this is starting where less than 64 left off and just to kind of show you where we left off if perhaps I can get out of your way even a little bit further what we do is we have a remote and when the remote sends a signal to the remote module on the Arduino you will get a unique signal so if you look I pressed it and I got the unique signal at the Arduino of FF a 25 D now what we did in the earlier lesson we went ahead and coded that one up and said that if the value that you read off of the module is FF FF a - 5 D then you hit press the PWR button ok the PWR button the other one that we coded up was the zero button that if zero is pressed that it recognizes that as a zero but these other unique codes like if I press one ok I will press 1 the unique code for that is FF 3 0 C F and we haven't come into the code and we haven't turned that into a meaningful command so what we are trying to do is we're trying to take all the buttons on the remote see what unique signal they send and then change that unique signal into something that makes sense because FF 3 0 C F does not make sense so we want to turn that into something that makes sense so if I press the 1 button I should change that into the command the string o in E this should make sense this should really make sense if you watch the earlier lesson if you haven't then go in and do that so let's go ahead we've done 0 let's go ahead and let's do the buttons 1 2 3 4 5 6 7 8 9 and so those should be very very some or to this one that we did here 4-0 so I'm going to ctrl C copy that and then I'm going to ctrl V 4 1 2 3 4 5 6 7 8 9 so now I just need to go in and I need to modify all those if statements for the different ones now we're keeping this one right because that was the first one the 0 now this one we want to change for the 1 so what do I do I take the remote and I I bring the remote in I'm going to press the button let me scoot that back a little bit so you can see it I'm going to press the button 1 and what I see pop up over here is one sense the command F F is 3 0 C F so I am going to copy that and then I'm going to come over here and on this part I'm going to paste now remember this seat at the zero X is just telling the Arduino that what follows is in hexadecimal so it's just cueing up that a hexadecimal number is coming well in that case what do I want my command to be my command was not zero but it was 1 oh and E and then we will print that ok now the next one that we will want to do is what the next one we will want to do is yes your guessed it - and - sends out FF 18 east 7 so let me come over here control copy and then I will come here and I will control V that is the code for - and so in that case I got an extra carriage return there in that case my command is going to be what TW oh all right now this next one what is that going to be we will want that to be 3 so I will press the 3 button and I want to make sure that I got a good read there 3 yes so that is 7/7 ff7 885 control copy and then I come over here control B and this is what thr EE T hree try to be consistent in your capitalization so that you don't you know it just makes it easier alright the next one will be what it will be for I can't press 4 and I got ff10 yep did you guys do this this was homework you know did you do this or did you just come back and copy me did you do this control B and then that was for you are fo you are okay and then we're going to come down here and the next one will be we will press the button 5 and then we see that we get this so I will copy that I will come over here will paste it get rid of the extra carriage return and then that was fi ve fi ve hey the next one will be 6 and so I will press 6 and we get F F 5 8 a 5 control copy come over here control V and then this was si X if I did it right si X ok then we come up to number 7 and number 7 comes out to FF 42 BD I copied that I come over here I paste it and then that is 7/7 be careful of typos just be careful of typos then we are going to come it's it going to be eight right the number eight I will press and that gives me F F for a be five so I come over here I paste it and that was what I believe that was a TIG HT and then finally we come back over here and we are going to press nine and this is the key for nine control copy and then we come over here and control V and that is going to be that is going to be nine okay that is a good thing for us to test let's go ahead and download this all right so we're gonna download it and then I just want to see if this thing is working for those okay so remember we had power working so I'm going to come in and let's see if I can show you this a little bit clearer okay so you want to watch what I'm pressing and then you want to watch the serial monitor behind me so remember PWR was working so we pressed that and let's see we get PWR and then i press and also we got we got the code for it above okay then i'm gonna press zero and it says zero and then one says one and we'll take these other print statements out after we get the whole thing mapped that's three four five six seven eight nine boom okay guys we are getting this done all right now we have let's see now I'm just going to start like the power or one here I will copy and paste because the other ones will be like that so I am going to control copy and then I'm going to control paste and now I need to see this volume plus what does it give me the volume plus if I hit it gives me this so I will copy that control copy and then over here instead of doing power again I will control V and then that was let's call it V Plus V Plus and then this next button even though I don't anticipate using all of these I don't anticipate using all of these oh let's see I did not copy that time the end curly so I need to put that in all right so this time I will copy this control copy and now now you guys do not quite have the whole view do you let me fix that so you see everything okay and then I need to move that over just a little bit move that over just a little bit okay so now I need to get this control copy and control V and this time I want to do the little function stop button and see what that is that is this control copy come over here control V and then that is going to be we'll just call it fu in for function okay and now I will get this again control copy ctrl V this time I want to look at the what would you call that would you call that three one the rewind button RW rewind okay let's call this control copy control D what do we want to call that how about re dub rewind okay and now we what do you think you think that we should call the play button okay so let's see what the play button does it gives me this I will come and copy and then I did not make a new one of these so control copy control B I will do a play and then I need to get this again over here I need to copy this control copy and then I need to control V and that was play we are getting through these pretty darn fast okay this time I need to not forget to get these control copy control V and now I am going to do fast-forward so I will click the fast-forward button and this will be control copy and then we will come over here and control B and we will call this F F for fast-forward we will copy and paste this again ooh I need to get rid of that like that okay we will copy we will paste and then that was fast forward now this is going to be the down okay so we will copy that and we will come over here and paste it and we will call that down DN and now we have this one right the volume mana and so that is in need of another one of these so we'll do control copy control V and then this was control C for copy come over here and control V and now I have probably forgotten what that one is that's V down V - okay so I will call this V - like that okay we I think now are getting through these pretty darn quickly so we'll go control copy enter control V and now we want to see the the up button so I press the UP button and it comes out to be this control copy this will be control V and now this is the simple up alright and now I think we have what two more I really don't know what we would use those two for but we're gonna do them anyway so we'll do control V vector copy control copy control V and now I will come over here and that's the EQ so I will press it and now I have the code for the EQ come and copy and then I will be okay and that is EQ and we up one more to be finished with this control copy control D and now we want this little step or repeat so we will hit that we will get the code will copy we will paste and then we will call that it says st like maybe start or repeat we'll just say st in case we need that button alright we are going to download the have you done this okay one two hold your breath is it gonna work is it gonna work why is it taking so long thumb at least it downloaded okay so let's see can I get a view here let's see if I can make a nice view for you where you can see the action you can see the action here we want a dramatic live-action shot with the remote but then you need to be able to see the serial monitor so let's see if I can add that darn serial monitor let's see come back over here I will say add okay and we are going to add a screen capture and let's see if we can get lucky and add that and let's see if it is going to recognize it it added a serial monitor I hope you can see it let me get incised over here okay and let's come here alright I think you see the serial monitor so you want to watch what I'm pressing and then you want to watch and see what pops up so I press that and I get PWR all right you know one thing I want to do now that this is working I want to take this code out this other print so let's go back to the code view and this extra print I don't want the raw command anymore and so up here where I print this command dot value I want to take that out because I only want the one now that means something okay so I'm going to redownload that that looks like it's going to like it this takes a little while to download I'm not sure why okay now let's come over here now you are watching the serial monitor as I press each button so we will start with power the power volume up is volume up function is function rewind is rewind fast-forward is oh no that's play right okay and now we'll go fast forward okay did we get fast-forward let's try that then fast-forward okay now we're gonna go we've done that one we're gonna do down we didn't get down down okay now we're gonna go volume minus volume - we're going to go up we're going to go 0eq ast1 you see sometimes it misses two three four five six seven eight nine boom did you see that did you see that we got a remote going we have a remote control going uh-huh do you like that yeah that is pretty darn slick okay so now what that saying is I can send unique commands and then I can end up with over here a command that makes sense so as I'm programming I don't have to keep going back and trying to figure out I don't have to keep going back and figuring out what this F F 6-8-9-7 this hex means I've met I mapped the hex that it ends up with you know receiving into commands that make sense so what is your homework for next week let's see let me see what your homework is for next week hmm I think that I want you to and I need to look something up here I want to go back and look I'm trying to see if I can tell you where we did it was a very earlier lesson where we were it was dead back about lesson number 39 okay 39 was controlling a DC motor with the joystick you remember that we controlled the DC motor with the joystick do you see how you have a little fan do you see your little fan I want you to control the little fan with your remote okay so let's look at this remote and let's figure out what we are gonna have you do okay so if you come in and just start right if you just start the if you just start the Arduino if you just download the program the motor should be off okay if you download the program the motor should be off if you hit the red button if you hit the red button what I want you to do is turn it on forward full speed okay and then any time you press this button I want you to go forward any time you press this button I want you to turn it and go backwards okay if you hit the volume plus I want you to go faster if you hit the volume - I want you to go slower so this is faster this is slower this is forward direction this is reverse direction okay so if you're going forward slow and you hit reverse then you should be going reverse slow if you're going forward and fast and then hit this you should go the same speed backwards and then plush at whichever direction you're going increase your speed and Mohnish should whichever direction decrease your speed okay if you hit this then that should turn the motor back let's see if this turns it on let's say that this turns it on and then the st we'll turn it off so I'll make it a little easier so you can use two different buttons for on and off so we're going to be using forward reverse faster slower and then this will turn it on and st will turn it off okay that is your homework and we will come back in lesson number 66 and we will go over that and we will see if you all could do that again if you go back to my Arduino tutorials series this playlist on on YouTube you can see like lesson 37 is understanding how to control DC motors lesson 39 is using the joystick to control the motor if you go back and look at those two you can see how to operate this little motor but what I want this time is I want you to control it with remote okay guys if you like this give me a thumbs up think about subscribing to the channel make sure you ring that bell hit the little bell so that you get notifications for this channel hey guys share this with other people see can you get some other people interested in an Arduino because the world needs more people that are building things making things designing things creating things we need more doers and less watchers what are most people they're Watchers playing a video game that's watching you're doing nothing useful watching TV that's watching movies that's watching argh we know Raspberry Pi fusion 360 those things are doing I need you to be a doer palmach order from top tech boy calm I will talk to you guys
Info
Channel: Paul McWhorter
Views: 20,548
Rating: undefined out of 5
Keywords: Infrared, IR, Remote Control, Arduino
Id: C_bewYEZpjI
Channel Id: undefined
Length: 27min 2sec (1622 seconds)
Published: Tue Jun 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.