Getting Started with Arduino – Michael Shiloh

Getting Started with Arduino - Michael Shiloh

Hi, this is Wayne again with a topic “Getting Started with Arduino – Michael Shiloh”.
Hi everybody um, so you’ve been hearing a lot about arduino. Today, probably i’m actually going to be taking a step backwards and giving you a sort of a an introduction to arduino. So i’m always curious about these things. How many of you um have heard about arduino? So pretty much everybody! How many of you heard about arduino today, here at the fair, a few of you all right, how many of you actually actively using arduino? So a few of you, so for those of you actually using this, this is going to be pretty basic.

This is really designed for um kind of absolute beginners people. Who’Ve, maybe heard about it just today and they’re wondering just how easy is it really to use? Can i actually do this and that’s what i’m going to be showing you um, so you’ve probably already seen this a few times today there is the arduino upside down right and um. Why arduino? Why do we care about arduino that the main purpose of arduino is kind of to be a glue, a glue from what well the world has a niche um various types of sensors such as um? Well, let’s use this one. The distance measuring sensor so here is a distance measuring sensor um. It’S able to leave that up there um it’s able to measure distance by sending out a laser, not a laser beam, but a very tight beam. It bounces off you and comes back into one of those other eyes on the sensor and it measures how far you are and they’re all kind of sensors like that for heat and temperature. In fact, simon just a moment earlier, was experimenting with a temperature sensor. Um light sensors, sound sensors pressure, sensors, um presence, sensors um, so that’s one side of things and you can think of these as sort of ways from taking something in the physical world um. You know a heat or temperature or a human and then translating them into some way into an electronic signal that you can mess with electronically.

Now the other side of that are what we call actuators. So actuators are devices that do the opposite. They take a electrical signal and they convert it into something physical, so that could be something as simple as a light.

Every time you turn on a light you’re using an actuator you’re, translating electricity into something physical. The light is coming on. The heat is coming on. Maybe something with a motor when you turn on a fan that fan that motor in the fan is an actuator. So you have these sensors, you have these actuators and you want to combine them in some way.

So i have here an led, simple, led – and i have this sensor and i want to make them do something, but it’s not just a matter of connecting it. I also want to be able to describe some behavior between them. I want to say make the led go on when the distance is less than whatever some number um. So i need a place to actually describe that behavior and that’s where arduino comes in.

So the basic principle of an arduino is that it has a number of connections on it. It’S upside down. Again, you can see these black strips on the top of the bottom and they have little holes in them. Those are places where you can connect things so, for instance, this distance measuring sensor here i can plug into i believe it goes into this side and now i’ve connected it and now i’m able to read it with this distant measuring sensor. So that is one way that you can use the arduino and similarly, you would plug the actuators, the leds, the motors. What have you into those same connectors, but the other thing i need to be able to do is program it right.

I need to put some of my description of what it is. I want to do into the arduino, so that is what i’ll show you next. So the first thing we do is we plug this in with a usb cable plug it into my arduino? So there’s my arduino and now i’m going to switch to the computer screen and hopefully show you the arduino program. So the arduino program is first of all, it’s free to download and it runs on any of the computers that you have so you can get it now and play with it, even if you haven’t bought an arduino. Yet the key one of the key things about the arduino program is: it comes with a whole bunch of examples built in, and the very very most simple example is this one here called blink and by the way, the way you would find those examples as going Up here to file and then pulling down the menu to examples – and there are – as i mentioned, dozens and dozens – maybe a couple hundred of examples. So this example here is the blink example, and so i don’t have to write any program i can just use the example.

That’S already built in now. I’M going to take this program from here from my screen and load it into my arduino and the way you do that is by pressing this button here that says upload. So i’m going to press that and you see down at the bottom, it says done uploading and then it’s going to say.

Getting Started with Arduino - Michael Shiloh

Oh, that is the last thing done uploading. So the program is now into the arduino and what it’s done, if i switch back to the camera, is it’s making that led blink? Do you see the led there? It’S a very, very faint, yellow, led it’s almost it’s almost impossible for me to see it. So probably is impossible for you also um. The point is: is i actually haven’t connected any actuators or sensors to the arduino? Yet that’s because arduino conveniently has one led already on the board. So i can do this quick test and see that it’s working, but that’s not really the fun part.

Getting Started with Arduino - Michael Shiloh

The fun part is when you start adding other things to it. So, let’s see how difficult it would be to connect a different led to this board. So i can actually see that i’ve done something and the way we do that is using this thing here called a subtlest breadboard. The purpose of the subtlest breadboard is just to make it easy to make the connections.

Getting Started with Arduino - Michael Shiloh

So i’m going to take my subtlest breadboard and a piece of wire and first i’m going to connect this wire, for which i need my glasses, connect this wire to number 13 over there, which i’ll explain to you in a minute. Why number 13 is important and then i’m going to connect my led over here and then i need to use a resistor leds. Do not have the ability to regulate how much electricity they use they’ll try to take as much as they can and they’ll burn themselves out in that process. So whenever you use a resistor, you have to use i’m sorry.

Whenever you use an led, you have to use a resistor in order to protect the led and by the way i should add, all of this stuff is described on the arduino website. So if you go to the arduino homepage, arduino dot cc. First of all, that’s where you would go to download the program, and the other thing that you would find is there’s a whole section on learning about arduino and they describe the circuits.

They describe the program and they describe how to make these connections that i’m making for you. Now i’m going to connect that up here and there we go. Hopefully now you can see that led is blinking. Is that visible, even in the back good all right? So the purpose of that was really just to show you the kind of thing that goes on now. Something else that’s interesting is notice that i did that, while this thing was running right now, very often you’re taught don’t play with electronics, while they’re turned on um.

Well, it turns out that arduino is actually pretty immune to to to damage um. I mean yes, there are things i could do to damage this, but for the most part stuff like this, you can do while it’s running so the point i want to emphasize there is, if you’re, uncertain, about electronics if you’re uncertain about damaging your computer – or you Know installing some virus, or something like that getting arduino up and running is actually pretty simple and you can turn to the people next to you who have done arduino and you can ask them about it. Um, let’s see, i only have 15 minutes for this talk. So i’m trying to do it very quickly. So let’s go back to my computer and let’s take a look at the program that is making that led blink and see if we can understand what it’s doing so, i’m going to jump down to this over here that line there says digital right led high digital Write is the way you send a command from the arduino out to one of its pins. So whenever you use digital write, you know you’re going to be talking to some kind of an actuator you’re, sending a message out. If you’re using a sensor, then you’ll be using something with a read in it: either an analog read or a digital read. So the right already tells me that i’m using an actuator, the digital tells me that i’m going to be using one of two values, either a low or high.

The alternative would be an analog write which has a range of values. So arduino can be used to turn leds on and off, like the blinking led can also be used to control the brightness of an led. So now we know what the digital right is doing. So there’s a digital, i’m sorry, there’s the digital right high. Here’S the digital right low, so the led is blinking. It’S going on and off that’s how we turn it on and off now in between.

We have a delay. Why do we need a delay because arduino does what it does really really quickly and if you let it run without a delay, it would blink the led, but your eyes wouldn’t be able to see it. So you have to slow it down enough that we can actually enjoy it, and it turns out the delay is in thousandths of a second milliseconds. So the thousand seconds the thousand in there means that it turns on for a second turns off for a second, and if you remember how quickly the led was blinking here, look like about that on for one second or for one second.

Now. The other thing is that this says over here to turn the led on and off only once, and yet it’s doing it continuously. So, what’s going on there well you’ll notice that all of this is inside of something called loop. So arduino gives you these two kind of structures.

One of them is called loop and, as the name suggests, it just runs continuously. It does everything you put in there and then, when it reaches the end, it just starts over again from the top. So it’s like a um. I don’t know like a washing machine that every time it finishes gets to the end of its cycle just starts over again.

That’S exactly what the arduino is doing here. The other thing that arduino does is it has a section for stuff that you want to have done only once and that’s the setup. That’S where you have things that you only need to have done once and in this case the only thing that we put in there is this pin mode command. Because remember, i told you that arduino has the ability to read things in from the outside world, when you’re using sensors or to write stuff to send messages out to the physical world.

Well, since you have all those connections on the arduino, you need to say which one you’re using do i want it to be an input. Do i want it to be an output? That’S what pin mode does so. Pin mode tells me that i’m using the led as an output, i’m going to be sending a message to it now. The other thing i want to point out is the word led here actually doesn’t mean anything to arduino. Arduino doesn’t know that there is an led connected to it.

What arduino understands there’s only numbers this number up here and what this line does. Is it associates the number 13 with the word led so that everywhere that i’ve used the word led. It’S actually understanding the number 13..

Now we can come back to this. Why is 13? So important 13 is important because there we go because arduino has many connections on it. It has 20 places that you can connect things and i happen to be connected into number 13. That’S where the 13 comes in, so you can have different things going on in your arduino and then inside of your program.

You would control which one is being turned on which one is being turned off, which one’s being made brighter or dimmer just by having the different numbers in the different places. Here, i’m just about out of time. But let me just end quickly by saying um: arduino has a whole booth um, almost behind you uh that you see these big banners that say the arduino pavilion and arduino is sort of on the back of that uh of those those two banners.

We have a whole table there, i’m there most of the time. If i’m not there, we have a whole slew of volunteers. Who can explain to you what arduino is and how you can use it.

We also have a lot of arduinos out with laptops attached so that you can try it yourself and just see if it’s something that you’d like to explore um. So thank you very much and i hope you enjoyed the rest of the show. .