Aidan introduces the Arduino ecosystem from boards to software in this video. We also write a simple sketch and upload it to the Arduino Uno R3 board.
Hey guys, it’s Aidan here from Core Electronics and today we’re going to take a look at the Arduino Uno R3 - the entry level board from Arduino. Now if you’re just getting into electronics and you want to learn how to interface with the world around you the Uno is a great place to start. The entire environment is extremely easy to understand and learn. The environment goes well beyond the board as well. The board was designed on an open source license and the community contributes tons of free tutorials, examples and libraries regularly. A big part of getting started with the Arduino is learning to code and you learn the best way possible by trying things out and seeing what works. The IDE which is free to download makes all the coding and debugging as simple as possible for beginners.
I’m going to give you guys a quick overview of the board and then we’ll get started on learning something simple. The hello world of Arduino, the LED Blink.
So we’ve got the Arduino Uno board here and it might look a little confusing at first but lets just take a look. So the Uno is a microcontroller board and it runs on the atmega 283 chip which is this chip you can see here. The chip is removable just in case you happen to destroy it and you can pick up a replacement online for a couple of dollars. Along each long edge of the board we can see the 2.54 mm pin headers that make it super simple to connect jumper wires up and prototype your circuits - that’s these ones here. The pin headers might also make stacking shields easy because you can literally just plug them straight in on top. Along the front side of the board we’ve got a reset switch which you can use to start your program from the top, we’ve got a female mini B connector just for connecting up your Uno to your PC and we’ve also got a DC barrel jack adaptor which is this thing here. Now the barrel jack can be used to power your board with a 9 to 12 V power supply and it’s really helpful when you need to power your board away from a PC.
Now let’s take a closer look at these headers so we can see what they’re all used for. We’ve got the SDA and SCL which are used for I2C communication, the AREF can be really helpful when measuring finer analogue voltages. We’ve got a ground pin and then 13 digital iO pins. Some of them have a little squiggly line beside them which means they’ve enabled to pulse width modulate or PWM but we’ll get into that in a later video. Now these digital iO pins are what we’re going to be using to control our LED.
We’re going to move on to the other side of the board now and we can see that we have 2 separate headers. We’ve got the power header here and the analogue header. So the power header can be used to power your board or to power your circuit that is connected to your board. We’d use the voltage in pin here to power our board or we could use the 3.3 V or the 5V to power our circuit. Now the analogue header has 6 pins and can be used to red analogue signals and that will typically read a signal between 0 and 1023 - it can be great if we’re reading a signal that just isn’t on or off but we’re not going to do that today.
We tend to see the Arduino Uno paired up with some accessory components and that makes the experience that you have with it super fun and educational. If you wanted to see some of these kits take a look at our range and check out all the lessons and content they come with.
Alright, let’s get started on the LED Blink which means we’re going to need to install the Arduino IDE and it provides you with all the tools you need to program your Uno. So head over to Arduino’s website in the links below you’ll find that and download the installation files for your operating system and get it set up. Once you have it set up go ahead and open up a new sketch, so we’re going to open up ours now. The sketch is the name we give an Arduino program and you can see we have the typical options along the top of the work space and that’s new and open and save. We also have these other two options - verify and upload. So verify will check your code for errors and upload will send it to your board. Typically we’ll write our sketch out, verify it, fix any problems and then upload it to our board and see if its working. The first thing that we’ll need to do before we start writing our sketch is just initialise the board and we follow these couple of steps to do that. Go ahead and click on the tools bar at the top and head down to boards. When you are in boards make sure you have the Arduino Uno set up which is this one here and make sure you have the port selected. So I can see that mine is plugged in to COMM11 there. Right so now we know that our computer knows where to send our code let’s start writing some.
So to start off with our sketch we’ll figure out what we’re going to be doing, I said we’re going to Blink an LED and the idea is to just do that - just blink an LED on and off. We’ve got the onboard LED here just for that purpose. We need to tell our Arduino which pin we will be connecting it to and we’ll tell it how to treat that connection then we’ll tell it to turn it off and on.The set up function which we can see here will run once at the start of our set up and today all we need to do is tell it there’s a pin connected to an LED which is pin 13 and we need to tell the IDE that that pin will be used as an output. We’re going to use the pin mode to do that - so pinmode(13 and we’ll set it up as an output finish the brackets and put a semi colon at the end. Now we’ve got that set up the Arduino is going to know that there is something connected to pin 13 and we’re going to use the digital write function to do the on and off. We’ll head down to our loop section and like I said we’re going to use a digital write so we’re going to digitally write it high or low - high for on and low for off. So digitalWrite(13, HIGH; always terminate your lines with a semi colon. Next we’re going to delay that for a second, so we’re going to hold that pin high for a certain amount of time - we’ll use 1 second for our timing delay today. So delay(1000); we’re going to do the same thing so that’ll turn it on for a second now we’re going to turn it off for a second, so digitalWrite(13, LOW); and we’ll also delay that for a second delay(1000); so essentially what our code will do is it will go - there’s something connected to pin13, it’s an output, it’ll then move into the loop, it’ll turn it on, it’ll delay it for a second, it’ll turn it off, it’ll delay it for a second, it’ll finish that loop and go back to the start. Everything is looking pretty good so I’m going to verify that one and just save that there and wait for it to compile, writing it into machine code and once that is complete. So that is complete, it’s done compiling and we’ve got a bunch of white text in the bottom here and we’re going to upload that to the board so click upload. So we’re uploading to our board so let’s go and have a look at our board and see what’s going on. Alright so you can see that our board just started blinking that LED and it was really as easy as that. We’ve just learnt how to program our first program with the Arduino and it was a lot of fun. I hope you guys liked the video, if you have any ideas for future videos on Arduino please let us know. If you liked the video let us know and if you want any more educational content on Arduino or Raspberry Pi or anything maker friendly jump onto our website core electronics and have a look around. Thanks for watching today guys and I hope you have a great day :-)