Arduino Tutorial 1 For Beginners! How to Write Programs and Build Circuits for Home Automation!
So the kit Im going to be using in these initial few projects is the official Arduino starter kit. I got it from Amazon and Ill put a link to it in the description section of this video. If youd like to get the same kit to follow along with these projects exactly or you can just get the board its quite a bit cheaper and all you need at a minimum to connect it to your PC is a USB a to USB B cable. Also, typically called a printer cable, I can leave a link to one of those via Amazon as well, but, honestly, you probably have 10 of these floating around your house somewhere. So take a look before buying a new one. For no reason, this starter kit comes with some cool DC motors and servos, as well as a ton of basic electrical components, including LEDs, resistors switches, tons of connector cables and jumpers, and a lot more local, electronics and hobby shops should have all the basic components that We use in each of these projects, so if you decide not to get the full kit Ill, tell you what components youll need for each project, so you can just get what you need each time if you do have. The kit first thing to do is pop the inserts out of the orange plastic frame it comes with these inserted pieces, have functions in the upcoming project, so dont throw them away. Four of the pieces fit right into the bottom of the orange board now and serve as the feet of your Arduino holding board.
You then, can screw your Arduino board onto the orange holding plate and the included breadboard thats, the cool looking rectangle with all the holes in it has adhesive and can be stuck right next to the board. If you just have the Arduino and not the full kit, I highly recommend getting yourself a breadboard from any electronics store. While you can technically build these same circuits without one, it would be a total headache and end up being way more effort and way more janky. Looking any way you do it now that you have the board assembled, you want to verify your computers ability to talk to your Arduino and get the free, Arduino programming, software and IDE download their website. Arduino.Cc forward. Slash download will take you straight to the page where you can get the downloaded instructions for Mac windows or Linux, Im doing mine on a Windows PC, but they have step by step instructions for download and install on any OS. So just follow those for your operating system, it downloads quickly and can be installed and started with all the default settings. I didnt have to change anything from the defaults for mine to get it up and running once you open the software up plug the Arduino into your computer via USB cable, you should immediately get the green on LED on your Arduino. Some will also have the orange built in LED blinking when its first plugged in no worries if yours doesnt, though, as long as you have the green light on your board, your board is being powered from your computer.
Your Arduino IDE software is likely going to ask automatically to install a bunch of drivers, and, once you finish, you should see your Arduino in the drop down menu at the top of the IDE. Where the drop down labeled select board. Is you can select your board? You should have a default Arduino program Open automatically. Now this is technically its own version of C plus plus, but as youll see throughout these tutorials C, plus plus Concepts. You have already learned almost all applied these projects and, if you dont know any c plus already dont worry because well cover everything from scratch. As we do it. The basic default program gives you two sections to put code in a setup function where you code what you want to run once this should be stuff like importing modules, to include in your build or defining an initializing variables. The second section is where you want continuous functionality to go. This would have any sort of repeat functions like monitoring for the push of a button or sending a status output or easiest concept of all, making a light blink. Most of your installs of Arduino software are going to have a section under the file, menu called examples and inside examples. You should see in Section 1 Basics a file called blink. If you open that up, you should see the following. It says theres 37 lines in this program, but if you see the grayed out text, those are all comments and, while its great to read a bit about what this project is doing, all you actually need to understand to process making the onboard LED blink is just 10 simple lines in the setup Loop: you just tell the board that we want to use the built in LED and for all of the arduinos main boards.
This command looks exactly like this youre telling the program we want to control the state of the light from our microcontroller. Then all you need to do in the recurring Loop is specify the speed at which you want the light to Blink. A digital write command is essentially setting a Boolean output to a value of either one or zero. In this case, an LED light. The function takes two arguments: the output youre writing to and the value you want to give it high means essentially on or powered and low means off or not powered, and the only other thing we need for this program is our delay commands which actually control. How long to leave the light on or off for the time scale is milliseconds, so the current default program can be read as turn the light on leave it on for one second turn: the light off leave it off for one second, and because the whole thing Exists in the loop section of our code – it it will do this Forever Until We power it off or load a different program onto it, to actually get this program to transfer to our Arduino. We have to upload it to the board. This is the arrow button on the top left of our IDE. Also in that area is a check mark that can be used to verify your project. Verifying is essentially checking for valid format and syntax completely on the development side of things, rather than getting the board involved.
Now, when you try to upload to your board, verification is going to be done automatically anyways. So if you know you want to move it over to the controller, you can just hit the arrow. If you have errors in your builds, you will get red error messages in the terminal output window at the bottom of your IDE. They are usually pretty helpful and descriptive in getting basic troubleshooting done to fix your program once its fixed and verified without errors and gets uploaded to the controller. Youll, typically just get a message regarding how much memory the program used and a pop up message that says done uploading. The Arduino board may have the TX and RX LED D lights flash, while a new build is being put on the controller, but once its done uploading, you should have your onboard LED turning off and alternating every second to have some fun with this very basic. But already rewarding program try changing the speeds at which it blinks, for example, if I make the delay After High transition or turning on 500 milliseconds and then make the delay after turning off 100 milliseconds well see a light that is on for a half. Second, then, off for a tenth of a second, we could also add some extra lines and a simple C plus for Loop to create a fun blinking pattern where we get 10 fast blinks of 100 milliseconds each then one full second blink, once youve built a program Into your Arduino, it is actually now running completely independently of your computer that you built the program on if you were to hook it up to an independent power source, rather than your laptop.
The program would continue executing Forever Until the programming was changed or it was powered off and well be getting into even more fun and advanced. We know programming in the future, but now its time to take a look at getting started with some of our basic physical electrical components And discussing how they interface with the Arduino for our very first build. All youll need is a 220 Ohm resistor in LED light. A little push button switch and some jumper wires were just going to be using the Arduino as a power source initially, but will eventually transition into the programs where we use our program to control outputs and take inputs back from our breadboard. The Arduino beginner projects manual. That comes with the full kit does provide two really nice views of the initial circuit that were building here and their simple explanation of what each component does is pretty useful for beginners. The basics of this circuit are just a 5 volt power feed from our Arduino fed through a 220 Ohm resistor then fed to an LED light to be able to control whether or not the light is on or not manually. We will add a push button switch after the resistor, but before the light then well connect connect the negative side of the led to the ground rail of our breadboard, and then we tie the ground wire back to our arduinos ground. Pin the breadboard has two independent power rails that run the full length of the board when you plug the positive and ground wires into any one of these terminals that full column of terminals gets the same either power or grounding because under the surface, theyre all connected To one continuous strip of metal, the horizontal rows in the main section are internally jumpered, rather than vertically like the power rails.
So a through E and F through J are internally joined on each row. Therefore, if I put one side of the resistor here and one side of the LED here next to it, they are actually touching, for all intents and purposes, but not if they were here here or here so once I get it all hooked up, double checking. Everything is correct: according to my schematics or plans, go ahead and plug it back into the computer to power up the circuit. Initially, nothing is going to happen because we have the push button in the switch in the off or disconnected position by being raised. But if we push it down, we close those contacts and the LED should light up for us. The basic circuit assembly actually covers some really important and useful electrical Concepts, and if you understand everything going on here, youre going to be set up really great for future projects, so that is going to be. As far as we build out these circuits today, we covered a ton of Concepts in this video, but hopefully nothing here left you feeling too confused or overwhelmed. If you have any questions about anything, you saw here today be sure to, let me know about them in the comments below this video and Ill get back to you as soon as I can. I am super excited to get to this new home automation and Robotics series with you all on the channel, the Master Tech we are at just over a year making videos together and the growth and support for from all my viewers in the community has been amazing And its really encouraged me to become a better engineer and to keep trying new things a massive thank you and shout out to my first patreon supporter Dale, making expansion into hardware and Robotics possible.
If you guys want to help me, do bigger and more complex projects in the future consider becoming a Super supporter of the channel at my patreon link in the description as well. Also, everyone who hits the like button subscribes to the channel and rings that little notification Bell well get instant Good Vibes delivered directly to their doorstep, for free thanks and until next time, as always.