Crazy about Arduino - Level 2 - Learn to use Keypad, LCD, Ultrasonic Sensor, LDR Sensor and a Buzzer | Idan Gabrieli | Skillshare

Crazy about Arduino - Level 2 - Learn to use Keypad, LCD, Ultrasonic Sensor, LDR Sensor and a Buzzer

Idan Gabrieli, Pre-sales Manager | Cloud and AI Expert

Crazy about Arduino - Level 2 - Learn to use Keypad, LCD, Ultrasonic Sensor, LDR Sensor and a Buzzer

Idan Gabrieli, Pre-sales Manager | Cloud and AI Expert

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
58 Lessons (2h 36m)
    • 1. Crazy Level 2 Promo

    • 2. Course Introduction

    • 3. Before WE Start

    • 4. What is Arduino?

    • 5. Endless Applications for Makers

    • 6. Our Checklist

    • 7. Step 1 - Matrix Keyboard

    • 8. The Matrix Keypad (4x4)

    • 9. Wiring the Keypad

    • 10. Long Time Ago…and Today!

    • 11. The "Keypad" Library

    • 12. Creating Keypad Instance

    • 13. Hardware Setup - Keypad 4x4

    • 14. Project Demo - Keypad

    • 15. Code Review - Keypad

    • 16. Step 2 - Liquid Crystal Display (LCD)

    • 17. The LCD Module

    • 18. I2C Interface

    • 19. The I2C LCD Controller

    • 20. Wiring the LCD

    • 21. The "LiquidCrystal_IC2" Library

    • 22. Hardware Preparation - LCD

    • 23. Hardware Setup - LCD

    • 24. Project Demo - LCD

    • 25. Code Review - LCD

    • 26. Step 3 - Ultrasonic Distance Sensor

    • 27. What is a Sound Wave ?

    • 28. Eco-location

    • 29. The Ultrasonic Sensor HC-SR04

    • 30. Wiring the Ultrasonic Sensor

    • 31. How it is Working?

    • 32. Hardware Setup - Ultrasonic Sensor and Threshold LED

    • 33. Project Demo - Ultrasonic

    • 34. Code Review - Ultrasonic

    • 35. Step 4 - LDR Sensor

    • 36. What is Light?

    • 37. The LDR Sensor

    • 38. Wiring the LDR Sensor

    • 39. Hardware Setup - LDR Sensor

    • 40. Project Demo - LDR

    • 41. Code Review - LDR

    • 42. Step 5 - Buzzer Alarm

    • 43. What is a Musical Tone?

    • 44. Buzzer Types

    • 45. Using the YL 44 Module

    • 46. Wiring the Passive Buzzer Module

    • 47. The tone function

    • 48. Hardware Setup Buzzer

    • 49. Project Demo - Buzzer

    • 50. Code Review - Buzzer

    • 51. Step 6 - Our Final Project

    • 52. Designing the Program Flow

    • 53. Security Lock Code

    • 54. Display Distance and Light Mode on LCD

    • 55. Automatic Thresholds Indicators

    • 56. Course Summary

    • 57. What Did We Covered?

    • 58. What Next? Level 3!

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class


The Crazy about Arduino Training Program - LEVEL 2

  • Do you like building “things” by yourself?
  • Are you looking for ways to easily combine software code and some hardware components?
  • Did you ever wonder how electronic devices are really working?
  • Do you have some creative ideas and you just looking for ways to easily prototype them?

If the answer is “YES” for some of the questions above then you just landed in the right place!. Arduino is an amazing development and prototyping platform with endless possibilities for Do-It-Yourself Makers looking for ways to express their creative mind and technical capabilities. 

Are you Ready to start being “Crazy” about Arduino....?  ;-)

Meet Your Teacher

Teacher Profile Image

Idan Gabrieli

Pre-sales Manager | Cloud and AI Expert


Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Crazy Level 2 Promo: wherever we go, that usual play, we can find a chronic product. They're embedded everywhere. And now, with the going wave off the Internet off things, we will see more and more devices connected to the Internet. Would you like to learn how to create such devices? Do it yourself. If the answer is yes, you just go to the right place. How do we know is an amazing, easy to use development platform for lending electronic software programming, building all kind of things. And it is really simple, not rocket science. As you may assume, the ability to think on some innovative ideas smartly combined phony component Web technology and quickly prototype it is. What they're doing was all about the crazy. About Arduino training program is divided to several levels where each level is a single training course. In each level, we will learn different subjects related to the do we know in the evolving eco system around it, building our knowledge and step by step. If you just started your way with do we know, then you may consider starting with level one pieces level number two for students that are elderly familiar with, you know and would like to start combining more complex company in this level. We will learn to connect the medics, keep out forgetting user input that is useful for many applications displaying text information on an LCD model. We will also use to send so one for measuring distance, form, object and they are the one for measuring light intensity, and the last component will be a buzzer model for making sound. We will do all of that while building a complete Arduino project designed the needed sick it photo type. The project, using bad boat, designed the overall bogan flow while mixing the old component in tow. One walking system. So how are we going to do it? Well, we're going to combine a little bit theory that each section and a lot off emphasize on the practical side with a step by step short learning cycle, really use different software tools. 12th as designed sick it and applaud our software toe the way. No, both it's section include the short quiz to test your knowledge and off course, the platform enable all off us to share. I will thought in question now, like every journey willing to start with something So it is really up to you. Are you ready to start being crazy about agree? No enjoying the makers revolution? 2. Course Introduction: hi and welcome to the crazy about all we know training program. My name is he done. Gabrielli and I will be a teacher. We are in level two, and I assume you, Elodie, cover the first course meaning level one. It's part off this training program, or at least you're already familiar with the basic things related to what we know so you can move forward in this level. They were planning to start using some very useful component or models that can be connected to the Arduino, including a school keyboard toe. Get user input. A. L, C D models and the controller related to that toe display text information. A trust inaccessible to measure distance for the resistor. Sensible to measure light density like change in creating an alarm sound using buzzer model . Now the final project we will build is based on using all of those component. However, I like to break complicated things toe little more manageable task, so in each section will focus on one component at a time. 3. Before WE Start: before we start, I have you simple a recommendation. First, I strongly suggest to lend this course in the suggest order as we are building our project and personal knowledge instead by step. We have done that in level one, and we're going to do that also in the next level. In addition, please download the court example and try to build the sick it in each step. A play with the software application that I'm going to provide. This is the way to really learn new things. I mean, trying by yourself something that is extremely important, is interaction. So feel free to drop me a question about something or start some discussion with other students. Okay, so now let me ask you a question right now. Are you ready to start? Start building stuff by yourself? If Yes. Then let's move on to the interesting stuff 4. What is Arduino?: So what? The old bus around. How do we know why so many people are using it? Can you define are doing? I'm sure that you can do that because already so that simple definition in level but one. But let's do that again, that I mean, this is important at the basic level. Arduino is an electronics prototyping platform looking like a piece off Elektronik boat. As you can see here in the picture below. Using Adriana, we can build all kind off Elektronik devices control by a software that we can write and in bed in such devices. Now the second important thing we can say about it is that the Sueno is used its central brain so we can, while all kind off things together. And by doing that, we can. 10 Dad, we know into some powerful interactive devices that is doing something. If we will visual that in a very simple picture, then the do we know can be used as the bridge between the physical and the digital world. We can create digital interactive devices that can interact with the physical world around us, Minnick sense and control the outside environment by using an almost unlimited range off In putting output devices, we can pour Graham the needed interaction flow required to create some functional device that is performing specific task. In addition, we can make our albarino device and connected sister that is connected to the Internet. Using all kind off means now if we will think about it for a second. This is what the Internet off things is all about. Building some smart connected devices that acting is connected entities that are xiang and acting based on real time information in the Internet cloud. Now, just for your information, the objective off the next course level tree in the crazy about Arduino program is to be able to create at the end, an Internet off thing device based on the are doing a platform in the most basic level are doing, you know, is a combination off a software development tools called Arduino I D. As we saw before in level one and one or more and we know boat that we are using in our specific project Now, as you can see from the table on the right side, there are actually many types off world we know bold that the other available out there with different features, capability and, of course, specific price tag while looking on a specific example off an Arduino board at the end, it is a some printed second board what called PCB that is specifically designed to use a microcontroller chip as well as other useful connectors and component that allow us to attach external input and output data to that boat. Now is this is a training course I'm trying to provide you. They needed background with a minimum cost. Form your side. So I will use the most popular and very affordable albarino. Oh, no board. It will be more than enough for our requirement. 5. Endless Applications for Makers: now to the basic question. What kind of things I can do without We know well, when we have the options toe easily connect Hardwell and software, then it's becoming really interesting and fun. What we can do with such interesting combination, the really endless application we can build without we know what we can do is really limited only by our own imagination. If you will, said Dayton, it about Arduino project, then we will be able to find a huge amount off great project ideas being created by creative peoples All around the board. The Arduino can be whatever we wanted to be. It can be used to build the control system. Some smiled. Rowboat A droid data low girl for collecting and storing information in a database connecting toe, a Web server, some game controller and moving more and more options. 6. Our Checklist: our checklist before we can start building something, let's review the needed software, tools and hardware items. So first on the software side, there are two main application that I needed. The first softer is of course, they're doing I d being used to create code in a PLO that toe the Hubbard platform. You can off course down or that from the official are doing no site. It is free. Second program is called free thing. It is used to easily design schematic sick it. Inside each section, you will be able to find the sketch file and circuit design file that I created for the project we're going to build. So please review that a squish change change and maybe also we use that in your future project. Okay, let's take a look on the needed a component. So starting with Arduino Starter kit really discussed. This is the most cost effective to get most of the component that are needed now, of course, it doesn't cover all the needed components. You need to check that based on the kids that you led boat or planning to buy off course, we need the Arduino Uno board light emitted dialled. 220 DeSisto 10-K on Resistol. Of course, when you buy that in a separated, you're getting a lot of places. But that's OK. I mean, this is it's fine to get some backup pieces that you can be also be used for future projects. A older son, Excess off one LCD model I to see a healthy the controller passive buzzer model A photo, resist a well, the our sense off metrics keep a array a maid toe, female wiles, Bill Tomei wiles it some straight make being header and this is optional. You can also buy some jumpers a cable to make your circuit much nicer. And the last one, of course, the blood board that is being used to connect all those pieces. Now, maybe you led both most of those things in the level one. So just understand that the delta that that is needed from your part you can also use the link that I provided over here and quickly see where you can purchase that in the eBay and of course, price changing all the time. So this is provided some just highlight vindication. Okay, let's stop 7. Step 1 - Matrix Keyboard: I'm sure you will agree with me that getting user input is really important capability in every interactive system. So the first step, while building our project, is to learn how to connect a simple Keeper model looking like a small cable. The ability to interact with users and get is input. Some numerical numbers in several basic characters will help us to start taking our child. We know project in tow, a new level off indirection metrics. Keepers are a low cost piece off how well we can add too many project. And in this section we will learn how to operate them while using a library that obstruct the complexity off the usage, letting us Toby focus on the actual application we would like to create. Looking on the project building blocks. We have, of course, the brain meaning that doing a boat I'm using that we know you know, Release, say three and the keypad connected is an input to double. You know, Toby ableto test this model. We will first just print into the serial monitor a put the key characters being pressed on the keeper in. Later, we will develop the software code to store in print a complete numerical number 8. The Matrix Keypad (4x4): if you will be both some of the recommended started kit that we discussed in Level one, then most probably you already got this nice thing. Phone for Keeper When we look around such small keyboard with different design, of course in size are being used everywhere to enter record when starting our car, entering access to some door building, operating some home appliance and more. Now this metrics keeper. Use a combination off four whoa and four columns to provide a total offs. 16 push button, typically used as input toe a microcontroller like we've in the Buena Bull. In addition, there are quite thin, so they can be easily mounted if we plan toe, build some case, some books to our project. 9. Wiring the Keypad: Okay, so how we should connect, it's too Daldry. No, Each key is the simple push button with one and connected toa one ho and the other than connected to another one column connecting the keeper toe. The dino is pretty straightforward e trow and each column is connected to a dedicated digital pin on the Arduino, meaning the number off pains that needed will be the sum of four in column, in other cases, the phone for keeper. So we will need eight wiles, a divided two rows and columns. Now let's understand the orientation off this small with the keeper facing up so that the keys are up in facing us like you see in the picture. I am from left to right. The 1st 4 wires are the low Peens, a one a two, a three or four and the last four wiles are the column spins meaning C one C two C Crean C four. Now we can connect the keeper toe Any digital pains we would like in the end, we know, but we need to make sure our Borg Graham includes the right mapping according to our physical connection. Something will see a later next, we will use the Keeper Library in our sketch to operate and find the pressed button is input. Before going into the software, let's review the second design. They will use it for our first step before jumping and trying to build a circuit inbred book and connect all kind of components using wild and so on. It is recommended to design in this circuit using a software and the software that we're using its called freezing. This is a free well that you can download from the Internet. And then they start to design a circuit or maybe used a template that other people created . For example, I'm going to provide the template marriage step. So please download that is a file from this chapter. Now just isn't you mind? Do you can easily drag and Opel kind of component. Okay, let me zoom in and and start to connect those component to a different location. Okay? In the seek it and this is a way to create the needed circuit. Okay, So back to the specific step would like to connect The'keeper's. So we have the bueno in the Keeper over here. This is a very straightforward connection. We have full connect Oh for four walls going to be connected to the relevant P number over here and four Coghlan's Toby connected to the next a p numbers. This is the pain number that I choose a connected out there, and we need to make sure it's being MEP correctly in the code. It's if now, if I will go below A I love the connected the bread bowl. We're going to place all kind of component over here. But if I'm looking on the key on the keyboard, this is the way to connected. And from that we can move forward to the actual physical connection and, of course, developing the relevant it could. 10. Long Time Ago…and Today!: a long time ago, meaning bubbling the stone Age, anything almost around 18 years. I created a nice project that you can see in this picture not walking anymore. But it looks as I was just building it yesterday. It is including all kind off models like microcontroller a keyboard similar to a full size regular keyboard, an LCD model, some memory card inside that we can't see a nine volt battery below in a Ciel connect to a computer and moving more. Now just to be able to read the key from the keys from the keyboard like aided some complex , skinny program that took me a lot of time to great and test so it will walk in a perfect weight. The same complexity was to operate the L City, another component I used. If you're looking on the big picture, then the old process was fun and interesting, but it took me a lot off efforts. Now why I'm telling you that in the context off our course, because today we have an amazing albarino eco system with a large and growing community with many developers that shell open. So Scott and we call it are doing no libraries. You can really get crazy and fun with electron ICS, creating things faster and better without spending valuable times. Most of the complex code for connecting many types off component is abstracted, and we can use all kind off off the shelf libraries that other nice and smart people around the wood and articulated and decided to share with, you know, community. 11. The "Keypad" Library: in our case right now, the keypad library will be used. It We just need to make sure it is installed in our are doing. No. I d software before we can use it in our sketch. Basically, this library allows their, you know, tow it a metric style keeper supporting a multiple types off key, but size. It can be three on four phone forward Ceta. And also customize key mapping configuration. Okay, we see it in there. They called Demonstration. Another important aspect is that the library coat is not blocking, meaning the user can press and hold some key, or they long ed are doing no will continue processing the rest off the program code. Okay. Something that is important. As I mentioned, the installation is from the manage library in the Reno I. D. Let's quickly see that. Looking on There are doing no i d. Software A. We will go into the sketch menu and introduction that is called include library and inside manage libraries. And what we'll do, we'll search que pod And the library that I would like you to in style is the key pad that specific cakey. But the library you see the detailed installed in my in my AM software. So the only thing that I need to do is to be able to use That is to include that library in my sketch, and we'll see that later. Under this libraries there are several frequently used functions that we were using our program and the 1st 1 is get keep. Basically, it will attend the key that was pressed, and now this function is not blocking meaning that I know will not wait for Wiki Toby pressed. It will continue the program until getting toe dysfunction again while earning in the main program. Look, function. The next one is get state and they are force difference type of states idyll pressed, released and hold the next to function used to set up a the behavior off keyboard A. The 1st 1 is said old time. It will accept as a perimeter time in millisecond in the day, and it will set the amount off many second. The user will have to hold a button until they old state is triggered. The next one is set the bounce time. It will said the amount off millisecond the keypad will wait until it except in you. Keep list. There's a new event. This is the time delayed the bounce method. If you remember, we discussed this issue off. Switch the bouncing in level one and it is taking care automatically. We just need to define what is our acceptable de bounds time. The last one in our list is wait for Ricky. This function will wait forever until someone press a key. So this is blocking its block all other court until a key is being pressed a lasting You're more than welcome to review the library documentation that is available in the Web. If you're looking for more function, that may be useful to your project, but for in our case, this is the function that we will use. 12. Creating Keypad Instance: in a regular C Programming like we're using are doing a poor Gramps all the time. We can break our code to several function to make it move edible and easily reused blocks off court. I mean, we already done that in level one, and we continue to do that in the future. However, most libraries in Arduino are written in C plus plus, meaning they're using something that is called object oriented programming for building the libraries. Now, don't get panic. I'm not going to start teaching how to create such libraries in C Plus. Plus, we would like to have a very minimal understanding in C plus plus toe. Be able to see use such libraries in a world code and you know not just copy paste form either project and hope for the best. It is important to understand how to use such library one off. The main thing in object oriented programming is the concept. Off Class A class is a template for a collection off a function and valuable okay. Also gold, poor penalties and metal that are all kept together in one place under the same roof because they share some common goal for example, we can create a class type that is gold cow and decide that several valuables or properties under this class will present the car status. For example, the few levels the temperature speed into one. In addition, we can create function that are only relevant toe our called class, for example, a function used to fuel the cup with additional Gaza Line or to start to stop the car engine. Now, remember that I said that a class is just a template, not the actual thing. To be able to use the class we need to create separate objects or also called instance for based on the template on the class template in the example off the car class. Let's say that we need to manage three different car. So in that case, we will need to create tree instance. Call one call two and culturally. Okay, so going back to our keypad class, Toby able to use it, we need to create keeper instance now because we have only one keeper in a while in our specific project, then only one instance is needed. If tomb or in your future project, you will use to keeper to separate keeper. Then you need to create two instance Now each class as a special function that is gold constructor which is used to create an instance off a specific class. The constructor as the same name is the class and they are useful for so sating initial value for self in valuable under the class Now looking on the following line Okay, this is an example of fusing the constructor toe Create a keeper Instance Keeper is the name off the class following by the instance name Okay called my keeper. And then a few parameters used to initialize the instance using the constructors and also all relevant parameters like the keys mapping a what are the rows and columns? P number in the We know what our them number off walls and columns and I will keep out model the next important things to know Is the usage off function as part off a class? We will always run a function in relation to specific instance we created Okay, You remember that classes onliest a template instance is like a footprint something something that is real form that specific class. So if you would like toa want to function you need to run it from that instance. And the way to do that is using the small operator dot okay, that you see between might keep but instance and the function that we're running get key. OK, this dot operate oh, is usedto access a function or maybe available inside an instance. Okay, in this example, the get key function is used within the Mikey, but instant, that's all. Let's see all of that. In the actual sketch we were using our in this specific step. 13. Hardware Setup - Keypad 4x4: Okay, so before a seeing how to connect the key part company to the door, you know, let's quickly review the doing a capability, just, you know, is a reminder. So we are looking on the Arduino board A This is how do we know? You know, the vision tree and you can see the name you know, over here. Okay. In some branding just below that is not albarino because it is a compatible board that is functioning the same as the original doing aboard. Now, if we're looking on the component that we have inside, so the 1st 1 is the microcontroller. This is the long chip over here. That's the main brain off the Arduino on the left side. We have am over here, the USB connector. Okay, that supply that is being used to supply power to the board am toe upload their our program to the Arduino. Any the tradition we were using that toe send and receive data between our Valdo you know, in in the computer for using the sail port. And that is very useful for the debugging process. In addition below, we have another soak it for external power. Okay? Meaning the socket allows it to power that we know form an external power supply instead of using the USB cable. Okay, at the end, although you know, should be in standalone device and and it's not going to be connected using the USB A connector. So for that reason, you have an external port. In addition, just over here we have a reset button that is used to rescind the program on the I don't know, stop it completely. Okay. For a period of time, and then doing will start again. Okay, Next, we have few. Several a lead small. A leads that are used to indicate all kind of things, starting with the own lead. Just over here. It will light up in green when the board its power okay, indicate that everything is ok and the board is receiving power over here on the left side , we have two led takes an Alex that indicates that right now there is some transmitting or receiving off information between the adore, you know and some a touch device using the serial a connection. I am, for example, when well, saying they save information using the USB to the computer will getting something from the computer. You will see the Dixon. Alex, will we light up and just a book? We have another. A lead called El. Okay, that we can use it in our software to and turn that they own enough It also, it touched to be number a teen, and it can be used for indicating something. We're without connecting an external. It led a device just below the microcontroller. We have to a hose off small. Soak it off. Terminal the first. Whoa over here. Okay. Provide a power connection. Meaning external component that we're going to connect to the you know, boat can get power. Form those beans. Okay. So we can use the power point to distribute power a fall kind off component to the needed. Seek it. Ah, in our in our project will connect, of course. The five world in in the ground, toe the bread board toe, distribute power and then we'll connect all our component to the bread board. Now, with the addition, there is something over here called V in which sent for voltage in and can be used to input voltage today. How do we know board instead off using a the connector this power connected connected over here an important connection is GMD Okay, ground. Okay, which is super important and essential Toe complete the circuit. Okay. And you have another Jean de right over way. Okay. And and off course old old ground are connected to each other sharing a common connection. In addition, there is to type off voltage five volt and 3.3 a vault to supply the needed voltage levels . Two different component that are using different power levels also in the same Whoa. Okay, we have a the ability to use an external isn't button. Okay, there. Is this just a A Soak it just for that. So instead, off utilizing there is it button that is coming led atop is part of the board. We can connect an external reset button the second row over. You provide a six analog inputs starting with a zero toe a five and they are used to measure electrical signal that change in voltage. Okay. And of course, the vaulted the analog voltage is taking form specific air range. So if we connect so in our case, the range What? It will be 0 to 5 a vault along the top off the board. OK, we have two more walls off. Soak it a number from 0 to 13. Okay, All of them are actually digital input and output. And I used to send and receive digital signal. And when we're saying digital meaning just to state own in off okay, it will be 05 vote. Nothing in between so they can be used is import to detect whether or not there is some electrical signal or is an output to generate signal using commanding our software ill. And the last thing to remind is the digital a Iot 011 actually used to send receive data. Two other device using cereal a communication. Now let's take a look on the keep at the metrics that would like to connect to their do we know. So at the end is a combination off four walls OK, and four columns. Is this white called foreign four? There are also other size, and I did that. We have 16 push a button a typically used as any put two devices like a micro controller, so we'll connect that into the Arduino board. In addition, they are quite thin. Okay, if you look on the size so you can easily mount that to some A case, a spot off the project that you're building to interface with the keypad. We need a eight pins. A the 1st 4 Okay. Ah, if we are looking on the keeper facing up to our ISS in this position. So the 1st 4 they rose and the last four over here on the right side of the columns. And now the only thing that we need to do is to connect that to eight digital I o in the albarino. So here is the final set up Okay, that we're trying to achieve in this step. So we have They're doing the keeper over here that we know there is a connection off eight wires going a to a specific P numbers starting form number two until a nine. Now, this is important because we need to map that in our sketching our software to be able to operate it to keep up. And of course, there do we know is also connected using the cables to the USB connector in my computer. So we'll be ableto upload the relevant sketch and also to operate a keeper 14. Project Demo - Keypad: okay before reviewing the actual coat. A that is being used to operate this key. But let's see the final result. So we have the keyboard and are doing no connected. You can see the power being that is it. And on. And now I just opened em sail port windows. And I'm pressing on different keys in the keyboard. You can see that result in the screen. Okay. In the sale in the sailboat. Okay, So this is the first simple program to just test that we can get a relevant key from the keyboard. The second board, Um a That will, Actually using our project is a function that providers an ability to read a number or some Parton. So in this case, I would like to read their number. So I will click on some number, Okay? And when I'm finishing, I'm pressing over here, and I'm getting that is a number okay. For would try to praise, for example, a combination. Okay, we take arctic to it, will ignore that, and I will get the 11 number. Okay. Pretty simple, but extremely useful for some off the thing that would like to do in a project. Now, let's see the actual scheduled the actual problem 15. Code Review - Keypad: we quickly reviewed the do you know, main capability, you know, as a reminder. And then we So how the hell do we know in the keep out being connected? Using eight wiles to the digital pains in the Reno and off course, I use some sketch that I upload into the doing a boat toe, be able to operate this new component. And we saw the result using the serial port monitoring screen. Now let's review the sketch that I used for operating this component. And as a reminder, you can download this specific sketch form the chapter that we are right now. So please go ahead and use that when you're testing the specific component that you can connect to the other, you know? Okay, starting with the sketch name. This is the name step, not one. Keep out. You can see the name of the level that we are right now. We're in level two a description. This is step one, and we use it to for connecting and testing the metrics key. But and the first thing we need to do is to include the library, and we saw that in the presentation. That's the name of the library and a few valuable that we need to use. And the 1st 1 is the number off walls. Okay, we're follows. And the next one is the number off columns. We have four Kolarov's. The next viable is actually it two dimensional. It is a that help us toe define and map the keys between the physical a keeper that we have that we connected and to our program so that the program will know when you're pressing on hole number one colon number two. The results will be too. Okay, very simple. And of course you can change it according toa a different keeper that you may connect in the future moving forward A. The next thing to do is to map the keep that connection toe the doing of terminal. At the end, we selected specific pains in the Arduino, so the program need to do the mapping. So it's, um it will be a ho pins away. Okay. And you can manually type then the numbers off the pains according to the mapping. And you remember, this is the way we actually connected our keeper. And it's starting with 9876 That will be the votes, and the columns will be 54 tree to okay. Very simple. And the last one related to our key pulled is to create an instance. Form the class. Okay, The class name will be keeper. Okay. And we're creating an instance that is called my keeper and how we are creating that using a constructor. The constructor is usually the name of the class. And then you provide specific pal emitters toe. Create the new instance. The first parliament er will be a the key mapping with the two dimensional Ajay is an input . Okay, before that's the key mitt. And the 2nd 1 will be the number. The the day off off being alignment for the hosts. And they're a off pains related to the columns and the number off walls and the number off columns. All those parameters are needed to create an instance toe be able to start, operate the keeper Moving next. We have the set up function. As you remember, that is only running once. And when you're running the arena for the first time and it being used to set up all kind off additional parameters, for example, right Now we're using the instance, Mikey, but that we created with the constructor. Okay, As you remember, when you would like to use a function related to a class, you need to use the instance name with dot and then the function. And, of course, that specific function said whole time it needs some perimeter in milliseconds. And this is the them some setting related to the amount of time that you need to hold a key until the program understand? Okay, someone just press that key. And the second function that would like also to use is to set the d bounds time also to some time interval. So when you press a the key, okay, it will not translated to several key being breast. We saw that also in level one, and the last thing will do. Doing the set up is, of course, setting the serial port. So will be able to use that for for debugging and testing in the look function. Okay, this is the main function in the in our sketch, that is, you know, running again and again. This whites called Luke and we have toe a function inside. The 1st 1 is being used to read a bottom from the Keeper, and the 2nd 1 is being used to read a number from The Keeper is Remember this what we demonstrated in the project itself. Now let's review the to function. So the first function a gatekeeper at button? I mean, that's the simplest one. We define some key as a character type, and then we're using a function that is called get key. Okay, this is a function that will read a key form the keeper. Now, if a key was not pressed, the result will be gnocchi. If it's different from gnocchi, meaning some key was pressed. And then I'm using his side of function toe present that key in the serial port monitoring script. Okay, so that's what it be. The first function that we used read. Keep a button. The next function is gold read Keeper number. As the name says, we will use it to weigh the full number. And the first thing that we use is prompt the user asking for that number and asked to press that specific Galatis. So the problem. We know that it's finished the user finish to type the number and inside. We have some do while loop. OK? Do I look it? And we keep reading. And a new a digit until the key will be that specific actor. Of course you can change that inside. We again reading the key today a key valuable. If a key was pressed, then we'll print it. And in parallel we will add this new digit into some a string OK and store. It isn't is an additional digit and at the end we will translate that string into into general, using some specific function that is called to in teacher. Okay, that's a very simple program. And this is our way to test a the Keeper. 16. Step 2 - Liquid Crystal Display (LCD): we saw before That simple l E D component are a great solution to display basic information . And we have done that a loading level one. In addition, until now, when we wanted to display something more complicated, like, you know, a number or text message, we actually use the serial monitor port toe. Present it in our computer screen. This is very useful for debugging, checking and testing our program coat, and we keep using that in the future. However it can't really be used for the final project is we would like our albarino Toby standalone device operating independently off a computer. A simple solution for that are liquid crystal display or when showed LCD component. We'll see the is used to really extend the output in our project. By ending in L City, we can easily display complex information like a sense of values, messages, timing, information, setting progress ball in moving more directly on our project device. So in this section we learned how to connect such LCD model and how to use the relevant library in our program sketch. Looking on the project building blocks, we will focus off course on the LCD model, forgetting for a while from the keypad. Will it be connected in step number one? There are two main method to connect inner city model. To that, you know, it can be based on direct parallel interface, all indirect serial interface also called I two c with some controller in the middle. As you can see, the diagram this I two CCL interface is a great way to save more terminal in that we know. So I would like us to learn how to use it. Finally, as usual will test the hard will set up and software code while using the sale monitor port . In this case, it will be opposite meaning will send text from the sale monitor toe the LCD. 17. The LCD Module: LCD models are used to display collector such text and numbers and so on. They can be purchased in virus size, which are measured by the number off walls and columns off character they can display. For example, above, we can see standard to those in 16 columns, LCD and below four hours and 20 column cell city model. Now, as I already explained, we have two method to interface with an LCD model. It can be parallel in cereal. I will demonstrate the sailing toe face not because I'm lazy, mainly because it is easier and smarter choice in most cases, and we need it in this specific project. So let's understand how to use this I to see serial interface. What is this I to seem to face? 18. I2C Interface: Until now, we learned how to connect many types off. Couple in user, the Arduino standard analog and digital input and output terminal. Okay, and that's great. But what about more complicated electronique component? It seems we can expand their dwindle capability and start interfacing with a variety off additional external component using the I two c sale interface. They I to see either face or more accurate Intel Integrated circuit enables a two way communication between devices while using only two wires toe facilitate communication. Let me repeat that again on Lee. Two wires are needed. Okay, that's extremely border. And it is not just that we can connect several devices or models toe the Arduino using this I to see interface when all those devices are sharing the same to wiles. Or, better to say they're sharing the same bus Okay in each component also possess a unique others. Let's understand why each component and was there such unique artist. If you will try to visual the eye to see interface for a second. Okay, so we have that we know that's the microcontroller. Several devices. Okay, that should be connected to the do you know? Then they'll Xiang. A common bust is the common I two c bus. Okay, you see that they are doing with the master in all other devices are actually slave. Okay, this is extremely useful because using dye to santo face Hey, all devices connected toe to the same master device while utilizing and using only two wires in the Arduino. Now the bus master meaning that we know is responsible for initiating all communication. And this is the reason why each slave or device component as to own is specific others that allows the outgoing auto address and communicate which each device is. Why this is important in our case, because in the program we will develop, we will need to type in the specific, unique others off our component. Okay, Some eye to see devices are coming with fixed address, and some have the couple options to manually select the specific address from some specific address range. So the first step before we can use a device using that I two c bus is to identify the address. This can be done simply by turning some scanner program where the address off each device will be displayed in the doing no, i d c and monitor. We touch that again later. Don't worry, It's very easy to perform such tusk. 19. The I2C LCD Controller: at the end when using a will agree? No, no. Or maybe other board. One of the main area off concern will be a the limited input and output terminal that we can use. Okay. For example, when connecting one LCD model using the Pailin interface, a dis model will consume six digital pins. And that's a lot. We can't even combine it with already connected. Keep outboard. Because we don't have such amount of free terminals toe overcome such limitation. It is better to connect some component using the I two CCL interface. We have, you know, Do you know now some component led support such I to sing to face while other don't don't have such capability, our LCD model does not support it. Okay, So to be able to connect our LCD toe that do you know, we need some additional model that will be used as the mediator between their city and their albarino. Okay, Something that will put in the middle. This model is called I two c LCD controller. Okay, Most probably you didn't get it. This part off your albarino starter kit that I recommended to purchase in level one. But don't worry that the cost of this component is around $1. You can purchase that easily on eBay. In addition, some LCD model when you order NLC model are coming with such additional controller model as a package. This is how our controller looks like wheat and I to see serial interface connected to the other. You know what we see on the upper side? Parallel interface connected toe del. See the model. Okay. Many terminals potential mated to adjust. They'll see the backlight con trust and big light jumper. If you would like to turn a only north del city backlight. Okay, Now let's see how toe wires all the component together. 20. Wiring the LCD: we have three building blocks that we need to while albarino and I two C l City controller and an LCD model. Now to connect the Arduino to the I to see controller. We have a serial a connection, and there are actually two dedicated pins in the Huguenot called SDA and is SCL. And, of course, like any component, we need five volts and ground form there. You know, next for connecting the eye to see controller and L City model, we use a simple parallel connection. But for that we need to perform some initial preparation and we'll see that it shortly. And, of course, for operating this say tow company it, we will use the liquid crystal under school I two c library if you know what sketch using the freaking tools and let's review the sick it. But we have until now. So we're already connected the key keyboard to the Reno, and now we would like to connect the LCD and they I to see a controller model. So and so the connection will be a parallel connection between the city model and they am I to see canola. Okay, just one on one connection We just need to make sure that this specific pain is connected to that basic specific pain. So please know that the actual I two c model is positioned that way. And thats so this is that will be the power connection. And now to connect there I to see controller toe the audio. You know, first, we need to connect ground toe the common ground viz isi for the forgetting five volt and then to sail Connection s C l and S D A. OK, going to the two connection over here. Okay. And you can see the the call off the wire to understand which while is going toe. What? Bean connection in the Edwina. Okay. Very simple. And this is the way to connect our L City comptroller. And of course, they'll see the model. 21. The "LiquidCrystal_IC2" Library: After connecting aware I two C model controller toe, they'll city using the bird board and the eye to see to the you know we are ready to start playing with the needed could. Now the library we use is called liquid crystal underscore Eye to see. It will do all the hard job for us. That's good news. We just need to learn how to use it now like we saw before. The first thing to do is to create an instance using the library constructor. We'll do that while passing the following three parameters. The 1st 1 is the guy to see address. This is the I two c model address will find it using some skinny program. The second part matter is the number off columns in their city, and the last problem maters is the number of falls in the oil city. The instance name is my L City, and we will use it to access the irrelevant function that would like Toa operate on the LCD model. There are many function in this library. Eso let's review some off them. Okay, some of the frequently used functions so the 1st 1 is beginning. It is used in the set up function to set their city display in the correct begin state. And it must be called before anything else can be done in our program. The next one is clear. Okay? Easily will remove all the characters currently showed in LCB home will provide us the ability to print starting from the first position on the LCD display. No display. Okay. It is used toe temporary, a disabled, the character, the density despair right now. Okay. It is not removing the character from the LCD memory. Okay, so we can tell it on enough. Okay, in the way to tell it own back again is using a function that is called this play. Another option is toe them on and off the blinking off the coarser. Okay, so you have no blink and blink. And again also, if I would like a course at all. So I have no cursor or or closer toe Kelly, Tonino and the same true for backlight. No back light or back like Okay. Very. Is it used? In addition to last function that are frequently used are said Corso, it is used to position they'll city coarser in the specification. We use that a lot in the sea taxes actually to provide the columns and the old number, and that would like to position. And the last week went we used function is point okay, used to print text or valuable to Dell City, we just need to make sure that the amount of information that you are trying to display is relevant to the size off the off the LCD that you're using. 22. Hardware Preparation - LCD: we are looking right now on the LCD model with two rows and 16 a a columns. And And you see the 60 connection toe that model that we need to use there is the I two c l city comptroller with the serial a connection right over here that is going into the we know we have an option to a move. Well, ed, the background off the L City and also some potential matter to control the brightness off the LCD. No, when it we will buy an LCD model. This is what you will get the model itself. Okay, It's gonna be different. Size, for example, this is four walls, but over all, the 16 port will be without any terminal. Okay? And we need to connect it to the I to see somehow. Does he control him? So we have two options. It's can be. They act connections, soldering they I to see control l it just put it over here and solder all the 16 60 Peens, all of them right over here. And then this is will be, you know, independence. More do, and that you don't need to use the bread boat to be able to connect it to the albarino. You will connect using those terminal right ovary. But the problem is that decide to see controller will be attached to this specific component. Okay? And it will be very hard to try to change that. The next option that I prefer to use is doing that indirectly. So we'll take out Dale's a i to see a controller, and we get We'll get some headers, strip, okay, and we count a 60 16 a pins and cut it and solder that to the LCD model And what you will do what you would put it in. And that way, okay. And so that over here Okay, on the other side. And the idea is that you will use the bread, Balto, be able to connect between their city model and I to see controller. And we have the flexibility to change LCB. For example, I can take this Elsie Needham amusing in the project that I already solder the 16 a pins using the head of strip. And now I can connect between them. Okay. Using a bread bowl 23. Hardware Setup - LCD: as we saw in level one A. The bread boat is being used to connect all kind off external component and bill circuit Toby connected to the do we know? Okay, Very. It's very useful. And now, just to prepare it before we put inside L City and I two c control up. So the first thing I will do is to connect a two wires the voltage, the five vault to the red and in the ground to the blue line. Okay, just over here. If you remember, this is a common bus. Okay. Now, to be able also to connect component over here, we are creating a connection between the ground over here and the girl. No, very. And also for the five voltage. So we'll be able to use the to a rose over here. And now we can a put inside the to a component looking on the hard was set up. So we have the keyboard already connected to that. We know and the bread board that is now being used to connect the component. So we have the LCD model placed a using all the 16 beans way over here and in parallel. We are putting their l C D M controller a model A on the same column, so they're actually connected. Each bean over there is connected to the A. The pain over here. Okay, this is the the years off the bread board. Okay? The columns are connected. Now, this is the parallel connection between the city and I two c controller. Next, we need to connect this to see controller toe the Arduino. So first off, all we need to connect a ground and vis Issy OK, this is going over you. Next will be a the to seal connection s c l. And as the a connected to the terminal. Right overview. Okay, that's all. This is what we need to do to connect the component to the other, you know? 24. Project Demo - LCD: let's say the system in action. Okay, so I've connected a ight over area, the going off course toe a used the connection. Now we have power to the boat and you can see the message a m that we have in the LCD. Okay, this is some string that I print in the LCB. Now, if I will go in, type something in the sale communication, Okay, Some message. Okay. And click. And now I will see that message in the L City. Okay. This is like a simple way to test and debug that everything is connected and you can use the LCD. Let's type also something else, okay? And we see the results in the L City. So everything is walking is expected now. In addition, you can cancel the backlight off the L City if you will take off this jumper. I don't recommend to do that. And but you can change the brightness off the background using this a put into matter. If you would like to change that a little bit 25. Code Review - LCD: So the last thing we would like to do in this section is to review the code that has been used to operate what we saw in their project demonstration for the step. So, first of all, it's called Step to LCD. Again, this is a file that you can download from this relevant chapter. Um, if I will scroll below, I'm using to a libraries. One is called while and I will explain why we're using that. And the 2nd 1 that we discussed in the presentation is the actual library being used to operate their city in to try to see controller. And that's the name off this library. Liquid crystal underscore. Eye to see. There is one A library that is being used by Dale City. Okay, this is the instance that we need to create. Okay, the name off the instances LCD. And that's the name off the class. As we saw. This is the way to create an instance. And we need to provide few parameters Toby ableto use and the model that we connected in our circuit. Eso So if I will look on that to parliament er, this is the number off columns and this is the number off walls. However, this is the art of this that we that we discuss about the guy to see address. And the first thing that we need to do is to be able to discover this address. Okay, Usually that will be the different address, but this is something that we need to check, and I will explain out toe check that. Okay. Now moving on to the set up a function. So there are few there. Several function under a LCD motile like initializing del city. Bring on the backlight, setting the course or to a specific location and creating some message. Okay, remember that we print welcome is a message. And of course, I'm I would like to also you the serial port. So I'm initializing that and providing some delay. No, there is a function and that you need to use only one that will help you to scan for the eye to see address. Okay. And this is the function below. Okay, this is the scan for I two c address, and if you will have that, you will get the address related to your specific model. Okay? You actually using utilizing a library that is called while. Okay, this is the library that we saw over here, Meaning just after finishing using this A AM scanning function. We don't need it anymore. Okay, We only use this elsewhere. The function. Okay. Now, after we discovered the address, we can put it over real, and then we can counsel in thesis function. We are not going to use that anymore and focus on the thing that we know we need toe like to display on their city. And of course, we have a function to display information coming from the serial port. Okay, this is the function that we I put under ba loop. And if you will go down and look on that function display sale a sailboat Anel city. Okay, so there is some process waiting if their information available on their LCD waiting is some delay and then clear the the LCD. So we'll be able to print the new a message. The next will be toe all available characters that that we type in their city. Let's say that we type four characters, so this look will run four times. And the way to check that is to use this cl dot Available a function, and each time it will bring toe the LCD a one collector coming from the Syria. Pretty easy. Pretty simple. And this is the way to take a message that you print in the serial monitor screen and prettied in the L City. Okay, again, this is useful testing and debugging. As soon as we finish that, then we can move forward to the rest of the project. 26. Step 3 - Ultrasonic Distance Sensor: our next cool model It We would like to wear it while project is called ultrasonic distance and so it is basically used to measure distance, toe object, a using high frequency sound wave. There are many interesting project that are using such very popular a model for different application. So the goal of this section is to help you understand how the sense walks and of course, how to easily use it. He now will project looking on the project building blocks again. We will ignore at this point of time, the keeper and LCD model really connected and only focus on new models. We keep heading toe a project, so we will connect the ultrasonic stencil toe. The bueno is new, additional input and displayed the sense of measurement in the serial moon itto that will be a will goal in this step. 27. What is a Sound Wave ?: before jumping into the practical side, meaning how to use the ultrasonic distance. And so I think it will be nice to understand some basic concepts related to sound. And the wait is being used to measure distance. So starting with the basic question what is the sound? Why the sensor we would like to use is called old trust Own extensive Well, sound can be described is a wave. It is a vibration that propagate using variation of pressure. True may doom such as L water. For example. When we speak okay, we actually create a vibration in the air. Okay, A particular pattern. This is this small black dots that you can see right now. No, this button will start toe propagate. Okay. Like wave in tow. Multiple direction at the speed off. Some now on the other side, the vibrating air. Then we cause a the listener ill to vibrate in the same pattern. And I will brain will translate that to specific sound. Parton sound waves are sometimes also being simplified it to a description. Off. Seen us wave. Okay, which are themselves characterized by some properties. A like frequency. Okay, this This is what we see right now, this is the speed off the vibration or canned. And if we're related toe to a sound, this determined the pitch off the sun. Okay, in general, frequency is measured. Is the number off wave cycle that the cool in one second and the unit is heads amplitude. Okay, On the other end is the size or magnitude off the vibration. And this determines how loud the sound is. Okay, If we put that all together, then we have the amplitude and the web lens. That is also the opposite of frequency. If we will divide the frequency range. Okay, Toe groups. Then we have first their acoustic range. Okay, this is in blue. Human can hear sound waves with frequencies between 20 heads and 20 k hurts. So this is the acoustic lynch. Meaning something that we can hear. The next one on the left side is the infra sound. Okay, in lead. Sometimes we fed toe with low frequency sound is a sound with frequency lower than a 20 hertz. Now, for example, some animals okay can hear such low frequency. Okay, Like elephants, so they can communicate in a large distance. The next one is ultrasound Okay? In green. This is the sound wave with frequency higher than the up L a audible limit of human hearing . Okay. Meaning ultrasound is defined by sound at frequency greater than 20 kilohertz. Meaning we can't here such some now This is used in many different field. Ultrasonic devices are used to detect, object and measure distance like Adar being used in in submarines. And, of course, many medical use cases. Even Mother Nature is using ultrasound is some animals use it for locating play and obstacles. Okay. And this is the next thing we would like to understand. Another property that is important for us is speed the speed off. Some is the distance traveling per unit time by sound wave as it propagates to some major now sound travel a very slowly in gases. He traveled faster in liquid and even faster in solid. Made you now, for example, in. But I l okay, this is in 20 degree. The speed off sound is around a 343 metres per second. Ok, this is important. We will use this information in our program and the last properties is direction. Okay. Until now, we saw a simple way from in a two dimensional to make it more easy to understand. But in real life in Halewood, sound wave are actually three dimensional. So sound waves travel in something that is looking like expending sphere. It formed the from the source off that sound. 28. Eco-location: the method for measuring distance with alter sound is gold echolocation. Now echolocation is basically the use off sand wave and echoes to determine where objects are in space. As you see in the picture, a common use off ultrasound is in underwater, and it is also called Sona, and the weight walk is that an ultrasonic pools is generated in particular direction. Now, if there is an object in the pet off, this pulls out a off that pulls will be reflected back a tow. The transmitter, as an echo en, can be detected toe the receivable. And but now, by measuring the difference in time between the pores being transmitted and the echo being received, it is possible to determine the distance. Okay, this is basic calculation. 29. The Ultrasonic Sensor HC-SR04: going back to the altar sonic model. Okay, that is also called hcs are 04 The sense so used Sona to determine distance to an object and its offer a great none contact. Range detection with high accuracy, the leading distance, our form too sentimental toe. Four metres. Okay. And the resolution is around 0.3 symptom enter. In addition, there is some limitation off the effective angle while trying to detect an object with that sensor. A. The model itself is quite small and include an ultrasonic transmitter, a receiver and some control circuit. 30. Wiring the Ultrasonic Sensor: the sensible has full terminal viz ISI connected toe, five volt power league. This is the trigger and the echo connected toe. Some selected digital pins, a and off course, the ground. We don't need any additional com print, and we can use it without any additional special library. Now the trig pain will be used to send the signal, and the echo pin will be used to listen for returning signal. We are going to use the sensor toe. Make a simple proximity indicator. Okay, now, when a pre defined pressure distance is crossed, some simple lead would be turned on in additional will display the distance in the serial port back to the freezing tool. This is the design off the circuit so far, so we have the keeper connected to the Arduino and the L City model connected, using the controller to the Arduino using to a wiles. Now we would like to connect the ultrasonic model. And so, first, if you're looking on the model the visit see connect oh, going into the five volt bus ground connected to the ground reference, and then we have to Port. One is called trigger and one is called echo, and we will map it to to a digital. A terminal in the Arduino. Okay, Number 12 and 11 over here. In addition, we would like to use also a traditional indicator led. So basically, this is the lead connected using Resistol to the ground. OK, and then the other side off the led is actually going into another bean in. They are doing okay, Pena better did. And that's all. That's the way to connect the ultrasonic sensor altogether, which, with some visual indicator 31. How it is Working?: If you were visual that for a minute, then we have the sense. So in meeting ultrasonic waves when this waves comic course in an object, some off them are get reflected back. Now this reflected wave get picked up by the sensor and it's calculate how much time it's took for the wave to return. We're looking on the model. We can see that the sense so actually has to opening on its front one opening Transmit ultrasonic waves. OK, like a tiny speaking and the other received the OK like a tiny microphone. Now, if you didn't skip some basic physics lecture than you may remember, the simple equation X equal toe V multiply by T in our case, ekes is the distance okay, would like to calculate and it will be equal toe the speed off sound multiple by the time the time between when an ultrasonic wave is dunce meted and when it is received we divide this number by two because the sun wave has to travel toe the object and go back OK, and we would like one direction. So this is the reason will divide that by two. The ultrasonic Cecil takes measurement only when requested to do so. So in order to generate the ultrasound in our Borg, and we need to set the trigger terminal on High ST for 10 microseconds now that will send out eight cycle sonic burst. Okay, Like pings, which will travel at the speed off sound, hit, sound, think and will be reflected back and received by the senses. Then the echo pain will be set automatically by the sensor model. Has high state toe indicate the duration in microsecond. The sound wave travel okay. And we will take this time and translated to distance. That's the logic descent so is using. 32. Hardware Setup - Ultrasonic Sensor and Threshold LED: Okay, let's review at the circuit. So we have the key bold connected to the You know, we have the LCD connected to the, you know, using the I two c controller. OK, this is a pilot connection to the sale connection. And now we would like to add an additional component. That is gold ultra. So Nick send. So this is essential being used to detect distance. Okay, Very nice. I am a sensor that you can use for all kind off application. In addition, we added is some lead to light just right here to be used as an indicator when a treasure is being crossed by some object causing the ultrasonic this nonsense. Oh, okay. So, looking on this on the circuit, if we look on their lead, this is Ah, a very simple circuit. It's starting from the ground, going into some small resist Oh, and then connected Important toe, the lead and the ladies connected. We're closing the circuit with this. A wire until pain number 8 13 On the other hand, we have the ultrasonic stencil a week full. It means that we need to connect on this side. This is the ground connected over real. And on the other side, this is there a visit see, connected to the Five World. Please know this is the opposite connection from the what you see in the circuit in Free Ting because I decided to put this ultrasonic opposite. Okay, So I will have most the space to measure object right overhead. So just make sure that you look on the right a connection. So basically, this is the ground. This is the visit sea and in the middle we have two connection. The 1st 1 in this position is the echo a coping and the 2nd 1 is the trigger pin. So I'm using the two Kahlo's yellow and orange to understand where I need to connect it. So looking over there, the according to the sketch that will use the trigger is connected to B number 12 and the A court to pain number 11. That's all. This is the connection that we need toe use the ultrasonic Senso and the led additional a special indicator. Now let's see the circuit in action 33. Project Demo - Ultrasonic: looking on the project demonstration. So now the circuit is connected with the power and the ultrasonic is measuring distance and display that in the serial port. And this what you see right now, If I will put some object in front off the sensor, then I will change the distance. And now you see the threshold a lead being light on. Okay, we give it a little bit close and put it back in more distance if or we cause the 10 70 meters at the led threshold A well telling off. Okay, so this is a nice indicator to provide us some immediate indication that some specific distance was crossed. And you see the result off the instance measurement right now in the same help. Oh, so this is a way to check again that our A sketches walking and everything is fine and we can move on into additional, more in additional component that we keep heading into a project 34. Code Review - Ultrasonic: Okay. The last thing for this section is, of course, to understand a sketch. The core that I used to weigh operate the ultrasonic A says so. So let's understand what we have in the in the program. So starting with needed viable there some valuable that we need the first to, of course, are the pins connected to the trigger pain. Okay, I'm using a B number 12 in degree. No, and they're coping is connected to B number 11 in the Arduino. Next day. We also use some pressure being connected to the P number. Torretta 10 and the last value is a some a valuable that indicate what will be the threshold that the system will check to 10. The led on and off, moving next to this set up a function. So of course, we need to set up the pin mode off the trigger, helping Toby an output and the Echo Pinto be as an input. Okay. Receiving the echo from the ah ultrasonic stencil. The pressure that led, of course, will be output would like to turn the tone enough and we'll set it too low. Okay, to attend off the led when we are setting up the system and, of course, initializing the serial port. So we'll be ableto display the distance in the sail port windows. Okay, now we have the look function. You see that every program that I create, we try to keep the loop. A function is simple. It's possible. I mean, I will build a function so we'll be able to use that is building block in our final project . So here again, I have a simple function that is called get sense or distance that will run again and again because there's a lope and with a one second delay between each time we try to win and I m value from the sensor. So how they get sense so distance function is actually walking. First off, all it will return. The distance is the result will see that at the end will return the result in sentimental. Now how, exactly we're doing that. First of all, there is some few court being used to tree get the trigger pin, and the way to do that is first awful to set it too low for too microsecond and then set it the trigger pinto high for 10 Michael second. Okay. And then set that back too low. No, this will be like a course that we are sending using the ultrasonic sensor and then waiting for the echo wave toe appear back to the ultrasonic stencil. And and actually, we're waiting that the Akopian will sense that and we and will be high. Okay, so we we wait for the coping toe, get high, and we're using some function to measure the duration, that we are waiting for their coping to get high. And this is the direction that we're getting. So we have. The situation is in time. We need to translate that toe the stand. So we're using simple math and just read a the comment the coping travel out and back. So to be able to find a distance object, we will take half off the distance being traveled. Okay, because we would like to measure on only one direction. We know the speed off sound in the l. Okay, some value. I am in a metaphor second, and we could translate that to a 29 29 microsecond percent tomatoes. So we're doing this simple, Matt, We saw that in the presentation divided, wishing by two and divided result A by the speed off the sound in a sentimental And we also can calculate that four inch If you would like to use different measurement and we are printing, the result is the centimeters. If you would like, you can change the program and print that in inch and the last thing we will do is to check if the threshold level was crossed. Now, you remember that we have a viable that indicate and expected threshold level. Okay, this is something that you can change. Okay, this is just right here. This is why we're using valuable, that you can easily manage and change. And the logic is pretty simple if they distance in centimeters is less than a threshold level, then set the threshold lead bean in height else said that too low and at the end, returned the distant in sentimental, that's all. And this is the result to be so 35. Step 4 - LDR Sensor: in some application. It is useful to sense when the light goes on and off all full below a certain level it to trigger something Their photo resist O sensor is a simple, low cost under looks, and Soto measure ambient light level. It is also called El Dia light dependent Resistol as the basic level, the resistance off the sense of wheat decrease as the amount of flight falling on its surfers increase back to our simple high level project building block. The L D R sensor is another analog input toe. The do you know, we will again be glow all other component we had so far and just focus on reading the new Senso a status and, of course, utilize the sale monitor port toe visual the measurement we're getting from Dell Dell Sensor. 36. What is Light?: like we did before. Let's first review some basic theory before moving to the practical side. So what is light light? Is electromagnetic radiation within a certain portion off the electromagnetic spectrum? I'm sure that you heard about microwave radiation usedto warm up things in our kitchen. Oh, infrared for transmitting data using, you know, smaller remote control in X ray. And more so when we say light, the meaning is that we focus on a small portion off that spectrum that is visible to the human eyes. Okay, this what we've seen the meat. There are some primary properties toe describe visible light like the 1st 1 is intensity that measure the power transferred pale unity area. So it will be a vat pair square meters. Actually, there are also other ways to measure light. Maybe you heard about looks, or Lumen and Kendall. Since a wound, a light intensity is something that decrease exponentially. Is the distance increased between the light source and some specific location? Light is like a wave so it can propagate in specific direction. In addition, we saw that the electromagnetic spectrum is divided to specific frequency range, so any light wave a specific wavelength or frequency. The last thing that is very interesting about light is related to the speed of flight. A maybe. Really? You learned that in physics lesson it is always constant Around 3 100 k meta per second. OK, in vacuum we can change. It is some fundamental a roll off nature. 37. The LDR Sensor: light dependent. Resist off. Okay, LDL photo sells a low cost. Okay, in low power component. And at the basic level, they are small, valuable Resistol where the existence change depending on the amount of flight heating its surface. So in dark environment, the existence will be high. A very bright light environment. The resistant will be low. You can see the structure off this component here on the upper right side and below is this schematic symbol for India. Now, don't tell anyone, but they are not so good for measuring exact level off flight intensity. So don't waste your time trying to translate the reading. Form that sensor to some meaningful unit. They should be used for detecting change it, like expose to events such as the transition from daytime to nighttime. Okay. And opposite meaning basic light change. And this is the way we'll use them in our program. 38. Wiring the LDR Sensor: Now, let's discuss on how to wire bell DEA. Okay? For that, we need to understand some simple seek it that is used all the time. And it's starting from the from the issue that they're doing. No, doesn't pull fight. Okay, A pain that allow us to plug, you know, with DeSisto and measure the resistance or measure the current. Okay, we can do it. It is providing a way to measure a voltage. Okay. Using the analog input pins. Okay, A A zero to a five. So we need to build a simple circuit that will allow that we know to read a change in a voltage. Okay. Proportional to the resistant. Changing the idea. More specifically, we need to build something that is gold resistive voltage divider in electron ICS. Voltage divider is a simple, passive linear circuit that producing output voltage. Okay, this is what you see in the middle of the out terminal. That is a fraction off its input. Voltage. Okay, this is the V in terminal. No, What we get is that wien voltage is distributed on our one an hour to that are connected in serious, and we out is actually the voltage drop. You can measure on how to? We will use the set up toe connect. They'll there? Senso starting with Wien. Okay, as the five volt. Okay, we're getting from there. Doing no ground is the reference again from that. Do we know Next Del Dia is like a valuable DeSisto. So we will place it as a one and a 10-K kilo home static Resistol is out to and then connect an analog input terminal it to measure we out now what? The L. D. R. Is exposed to light its resistance the case. So we will have more voltage drop on the static resistant when we'll get in higher voltage reading on the other side when the light is blocked. Okay, the resistance off the d r increase. And so the voltage reading on the out will be lower. Now, if you're planning to use the sensible in a very bright area, it is better to use lower resistance like one kilo home. They stop instead off the 10 kilo ohm. Is this so amusing? And the last thing to know is that the LDL is actually a non polarized component. So the direction while connecting this component is not important. Looking on the sick, it using the freezing tool am I just want to remind you first that you can download this file from the chapter. The wiring chapter. This is true for every step that we added so far. Now we have the key bad connected to the You know, we saw the LCD connected in directly using the controller. This is a pilot connection. This is a serial connection to the Arduino. And we also saw the ultra stoning Senso being connected with those two while to to dig ital pain in the Arduino. Now let's see how to connect the LDS. And so this is a very straightforward connection. Okay, so that's the photo resistance. And so and we are using it's some voltage divider. Seek it to connect it. So, first off, all we have wire from the ground connected to a exist. All this is a 10-K is this toe and then in serious we have the LDL and at the end we are connected into the visit. See to the five Volt. Okay. In the middle, we are connecting the Arduino to a terminal A zero. This is will be the input, a measurement based on the light amount. I am the Dale, the our sense. So basically, that's the way to connect the photos Esto el Dia sensor. 39. Hardware Setup - LDR Sensor: looking on the Hubble design. We have the key boat connected to the Reno. We have the LCD, and they like to see L. City controller connected to the Arduino. We're also connected a distance. And so that's the ultrasonic sensible and the nice led a indicator for when a threshold is being crossed. Now we would like to wait another sense. So that is called LDL, or photo cells that changed the resistance based on the light intensity following on itself . It's This is the central that we see right now. Now the silk it for connected through the sensor is pretty simple. We have a connection from the ground to some fixed Resistol a 10-K DeSisto and then it's connected in parallel to their the out. And there they are on the other and connected toe. The five work OK, closing a circuit and in the middle between the LD R and the fixtures. Istok were putting some while to measure the voltage drop on the fixed Resistol. Okay, this is why I was going into the analog input. A zero in the albarino. And the idea is that it when the light intensity change A in the place that they said The our sense of is located, the resistance will change. And because of that, the voltage drop being measured by this why we change and is a way to a understand If there is some light change and then you can trigger something, what we'll do, we'll use some AM treasured levels toe. Understand if they light right now is dark, bright, very bright demons. A one. Okay, this what we'll do in the sketch? 40. Project Demo - LDR: looking for the project demonstration. Okay, we added these LDS and so over here. And if we're looking on the sale windows, then we're getting some value. Okay, The string, this is an indication is a very bright light intensity. And if I will put my hand and cover a little bit there their sensor, then I will get a little bit less light. So it's getting toe bright. Okay, Now, in my womb, I have a very strong light. Eso that za testing. Also, close the light in the room and see the value that we're getting. Ok, extend into dark is expected. Let's stand it back on. Okay, so this is a simple mechanism to a sense like change that you can utilize in some application. Now, let's see the actual sketch I used to operate this simple LDL sensor 41. Code Review - LDR: the sketch. The sketch that is being used to operate LDL sensor is pretty simple. And starting with the valuable declaration we need to declare, of course, some valuable off the LD up in a location where we connected our circuit. As you remember, we connected that to this. The first analog game input a zero in the stepped up. We don't need to do anything related to LD are the only thing that we need to do. It is, of course, initializing the serial port and in the look function will call a function that is called get sense so light that will return a string and we will print it a tow the serial port. And we'll do that in in an interval off one second every time we hit reading a new value from there they are sensible moving next to the function used to get the sense so light a density will hit in that will get in string A. This think will be the dean light, bright or very bright. And what we will do off course first will lead the LDL Senso value. Okay, using the analog great function and it will be placed in an integer valuable called value. Remember that when you read in Alma log, value it. The albarino has internal a analog to digital converter that will convert this analog value into some digital in number. And the range will be between zero toe 1 1000 and 23. And the next thing is to take this value and to start measure all kind off range. So if the value is less than 200 then I'm deciding the light level is dark. If it below 400 then this is deem 600 light in 800 bright. Now, this is not, you know, precise rocket science, and you need to a little bit do some testing, play with this value to see if it's relevant to the environment and that you are testing and then decided really want a value that you would like to place at the end. The function will retain the light level, and then we are putting that in the loop function. Okay, this is a very simple function. Now, just there is a reminder. You can also print using those toe the analog reading. So when you're doing some additional testing to decide what will be the value range. You can point the analog reading while doing this testing, that's all pretty simple function. 42. Step 5 - Buzzer Alarm: in Level one will be Inter faced with Putin's you mater in Baton that take advantage off our sense off touch. Okay, touching something and we used led an LCD to interface with our sense off site. Now what about our ability to real sound? They're all kind off application that requires some basic sound capability, like a beep when usually pressing on something, and when a specific, sensible special disclosed and you would like to run some short allowing sound and moving more. So in this section, we we learned to make such basic sound with a simple model that is called a passive Barzel , and it another layoff output feedback a tow our project. We will use it to provide a nice feedback, for example, when a user expressing on the keypad and when an object is crossing some specific distance being measured by the ultrasonic Senso. Still, let's start with the basic stuff 43. What is a Musical Tone?: We're the land that the sound is is a wave that can travel in L when the other type of gas liquid and solid. Now, in addition, we saw that acoustic sound wave any frequency between 20 heads and 20 k heads. And this is the sound wave we can hear. Okay, is human, but what is the different between a sound wave off 100 health frequency or maybe 500 hertz frequency. And what about the volume? Level off a sound with For that, we have another definition that is good musical tone. Musical tone is actually a steady, periodic sound wave. Okay. Characterized by several properties. Okay, starting with specific frequency that influence the peach of the sound. A sound with higher frequency. We sound higher in a sound with lower frequency will sound lower. Okay, lower pitch. Now, in the context of frequency, a pure tone is a simple seen this wave at the single fink. Lucy. Okay, this is what we see to wave in green. On the other end. A complex tone is a combination off several sound wave. For example, what we see below here's the combination of the two wave above. Still in real life, Most off the sound wave we are hearing actually based on complex tone, because it's very difficult to produce a sound with a single pew tone. In addition, other relevant parameters are the amplitude off the sound wave okay and related to the loudness and the duration of the tone. Now we will see later that we have in options toe play with the frequency and duration off the tone, using a specific function we can utilizing the Arduino. 44. Buzzer Types: back to the buzzer component Basel, available in two main types. Okay, acting and posse starting for the 1st 1 An active buzzer is a component that output a single tone and we can turn it on and off using a digital input signal. Okay, D. C. And we'll get a single type off sound tone with a specific frequency and usually that it will be two kilohertz on the other. And a passive buzzer is more similar to a speaker. We need to feed in a scene, use analog signal and the signal will be converted to a some of the same method. Any electromagnetic speaker is walking, however. Okay, Now I'm speaking about the public. As you know I will. Arduino cannot directly produce an analog output Toby connected to such passive buzzer. But if you remember, for my were level one course, we have something else in Arduino that is called P W M. Pulls wide modulation in specific P number that used to simulate something similar toe on a log output signal. We will use it to operate that passive buzzer. So as you understand, by now, we will use the second options, meaning the passive bustle toe provide a small flexibility 45. Using the YL 44 Module: maybe you got such small Basel. Okay, it's part off. Some are doing no started kid. So it looks like a tiny speaker. We can connect such buzzer component directed to the do you know, but we will not be able to produce a loud sound alarm. Okay, what will I'm trying to get? Because the amount off current that we know microcontroller can provide toe such speaker is quite small. Now, if you learned the theory behind electron ICS course Oh, maybe you have some background in electronics. We learned that the the solution for such a situation is to separate between the current coming from the input signal. And the current usedto operate the output meaning our buzzer. So the solution is to actually utilize a combination off transistor Resistol in a buzzer. As you can see in this diagram, the transistor is used to provide some amplification off the sound, meaning a small valuation in being number two that is connected to the Resistol and coming from the do we know will goto the transistor gate and then more current will flow okay Between the visit, see? And the ground true, the buzzer. Now we can build the circuit. Okay, using bread board and combine all those component. But I like to make things easier. So there is a cheap model cord y el for four that led pack all the needed component in a very nice one model. And this is the model that I would like to use. 46. Wiring the Passive Buzzer Module: So this passive buzzer model is just a combination off a speaker transistor. Oh, and Resistol with the tree terminal is connected. Now visit, See, is going to the doing a five volt the I o terminal. We be any Arduino digital pain that support pulls wide modulation and, of course, the ground going toe. A common ground reference again from Dad. We know now in our Paul Graham will use a dedicated function called tone to drive this model. So let's learn how to use the stone function. Looking on the sick it we created so far using the free thing. And we connected the all needed component meaning, meaning the keeper. They'll see the model, the ultra sonic sense. So the LDS and so and now we would like to connect the passive Basel. Unfortunately, I didn't find a nice a model toe visual the buzzer. But this is a relatively small issue. What I create it is some a small books. Okay to visual the passive buzzer y el 44 and just a visual. The terminal related toe, the same model. So this is basically first awful. We have a ground connected to the ground bus and on the other. And we have the visit see, connected to the five volt bus and in the middle, we have a timeline of discord. I o. Okay. And we are going to connected to, um, another dig ital pain in the, you know, peen number 10. And this is the way to operate our basil and using the software code. Okay, this is the last step related to the A hardware stuff. Okay, From this point of time, most off our work will be related to a design and it just the software. 47. The tone function: they are doing. No idea includes built in function called tone for easily making some. Now this function will generate a square wave off a selected frequency on specific P number . And if we're if we're looking on the syntax off this function, it can accept two or three argument. The first argument is just the pin. We would like to generated the tone. The second argument will said the frequency off the tone so we can control the peach off the sound. Probably we need to use the frequency between two kilohertz and five killers. Toe. Be able to hear it, but you can play without and test that by yourself. And the third optional argument will set the duration. Okay, milliseconds off the tone. If will not provide it with the division as a Tello input, it will keep playing the tone forever. But we can stop it with another function that is called no tone. Okay, very simple. Now, there some limitation while using this function A. When using the tone function, we cannot use Pulis wide modulation, output on pains tree and 11. And of course I'm talking about the robbery. No, no, no. And it cannot be used at the same time on two separated paints. Okay, if we are learning the tone on one pain and we need to call the no tone function before trying to use it on another pain, Okay, that's all. Creating delay between tones is very useful. Okay, two great sound will use it a lot in a world software while utilizing the Basel. So let's understand how to create such delay. The important things to know is that when we run the tone function there don't know doesn't really stop until the situation off the tone is finished, it will jump to the next line off court in parallel while running the tone function. Now let's understand the meaning off that behavior. If you will put a line okay with the tone with the pain, frequency and duration number one, and just after that and delay function with division number two, that is greater than do Asian number one. The actual delay will be do Asian number two miners do Asian number one. Okay, so let's see that in a visual manner and with some example, let's assume that we have any it don't function with 800 merely second a situation and we put a delay function with one 1000 merely second. What we will get is and delay off a 200 milliseconds. Okay, this is a simple math. And if you understand that, then it's very easy to create delay between a tone and of course, imagine that you're using a some loop, OK? And you would like toa play with the delay between the tone, so this is extremely useful. 48. Hardware Setup Buzzer: looking on the project hard, well designed. So again we have the keyboard connected to the Arduino. We have their city. They like to see controller being used to connect their city toe the albarino. We connected the A ultrasonic sensor to measure distance with some lead indicator, we connected an LDL Senso to measure light intensity like change. And the last mortal in our project is to connect a buzzer model. Okay, this is the model that you see right now. Maybe I will change the viewpoint. Okay. So you can see that differently. Okay, there are three main connection for that model. The buzzer model. Actually, it's a combination off a off the buzzer, some transistor in in visits toe. So you'll get some. A strong is a buzzer. I am as part of this model. Now the silicate again is pretty simple. One side you need to connect to the ground own on the other side, you need to connect to a visit, see, five volt and in the middle is the connection to some digital painting they are doing. Or in our case, is digital a being number 10. Okay, so that will be the hard will set up. Let's see the buzzer in action 49. Project Demo - Buzzer: Let's connect at this ticket to the power using the USB port and let's see what we will hear form the buzzer model. Okay, some alarms going up and down all the time. And, of course, we'll utilize that in our project. Okay, let's see their coat that is being used to generate this sound. 50. Code Review - Buzzer: Step five. The Buzzer A sketch. So let's review how exactly are operating the buzzer? It's actually pretty pretty simple. A first of four. Like any external component, we need to interface with that model. In the case Off the buzzer, we're utilizing a digital A pill. Actually, that's the the only left digital painting in the end. We know, you know, that we're using. We used all the available digital pain, so it will be a digital p number 10 and then going down to the set up and we need to set this pain is an output. And looking down to the look a vacated some functional is called buzzer down sound. Oh, and with some delay and then buzz up sound. Okay, lets see those to function And as you remember from the presentation they were using if built in function in there, doing the idea that it's called tone and the same syntax for the tone function is, of course, first to provide the pain a frequency and duration. So I'm using some look ah, toe operate this function with, of course, the Buzzer Bean. And if some a calculation toe provide a changing frequency, okay, So it's starting from 4000 and being reduced every time the slope is running and I'm using a fixed and do a shin. And of course, some DeLay a two creates the actual delay between the tone and the delay function. So if you remember from the what we live in the presentation, the actual delay will be 70 miners dead. It would be 40 Eddie, and this is the way to create delay. And this is true for the dysfunction down sound. And if I will go down to the up sound eso the idea is the same. In that case, I'm starting with some a frequency baseline and I increase that baseline in this interval every time the loop is going up, this is the way to create this a up sound. And of course, you can play with those value and you will get a different different alarms every time you will play with the with the delay and of course, with the frequency level. But this is a nice way to operate a buzzer model and to use that to all kind off application. And of course, we use it in our project. And now This is the last model for in our project. Now it is time to start mixing all those component into some interesting system. This what we are planning to do next? 51. Step 6 - Our Final Project: so far in each section, we added a new model toe a project one by one by connecting each model to the, you know, a learning how to while that mortal developed the 11 court and then we tested that model is a separate component while using the sale monitor port. Now, when developing a complex system, I really think this approach is very useful. Quickly isolate all kind off hardware and software problem We will for sure encounter in many project. Now it is time to start mixing between the features that we got from all component and create a single system that actually doing something. The good news is that all the hard was set up is already ready, okay, up in designing and the only thing we need to do is to play and just our software. So in this section we will focus on developing our sketch that will combine the old building blocks into one system 52. Designing the Program Flow: The first thing I recommend to do is to design the main poor gone flow in very high level because it is sometimes useful toe forget. Okay. For a short while the long lines off court we created in our sketch and all the, you know, the old low details information about the component were using and just focus on the expected system behavior from user side. Okay, you can do it on a simple piece off paper on a white board, a using world and power point. Whatever, nothing special is needed. We'll do it on in one single slide. So in our project, we would like toa ever. The following expected Balkan flow system set up will be where we said all the needed parameters skating the needed valuable for which models setting the pins mode and so on. Next, we will prompt the user with the request to enter a security code for unlocking the system . If the code is okay, then continue. If not, keep asking that could and the gun short alarm, if usually tried to type the court three times in a row, a now start monitor the distance and the light change and display the sensible data in the LCD display. If an object is located in specific distance or less than that 10 own, some led, and also a sound alarm based on the object distance. Okay, this is our poor gone flow in very high level and now we need to start combining the models to make it happen. 53. Security Lock Code: the first thing we would like to do is tow. Combine between the key bod and the LCD. Visual off course, the keys being pressed. That's what application in this project is to read and verify a security code for looking the system. It's part of the system startup only user that knows the code sequence will be able to enter the system. So we will print a message on on their city asking for that court and print any key being pressed by the user. Okay. The next nice combination is to use the buzzer model toe, make a short sound each time Mickey is being pressed. This is a nice feedback. So our first combination is actually to take the buzzer more. Doolin start to use that, and the first thing is to use it with the keyboard. Okay. There is some expectation from users to provide some if audio feedback when they are pressing on something. Okay, Okay. So every button that that we press, I will get some feedback. Now, In addition, the system is asking me, is asking for a security code, so I will type some a security court, and I'm clicking on this for finishing. Okay, I'm getting Indication. Try again. And I can also hear that in a visual manner. That's nice. That's right again. Okay, this is the first combination would like to achieve. Now, let's see, the actual court may used to a performed attraction. The sketch. Okay, we are in step six. Final project. OK, this is a file holding all the combination that I'm going to present. But of course, we now focus on what we saw right now. Just as a reminder. Don't forget that you can take you can download this file, form this chapter, okay, and play with that code by yourself. So if I will school down a little bit and I'm looking for the new line of court, I headed for that. So am okay. Just after initializing the LCD and neutralizing the C l put anything in new function that is called read security code. Okay, that will verify system on looking security. God. Now there is a viable over here that will define I am the security code. Okay, Is a string security guard and I chose some a combination off numbers and characters. Okay. You can easily change that. And Let's go school down him to the relevant function. Okay, so it security called There is some flag. If the code is OK now there is a some do while that I'm asking for the unlock code and then I'm honey, another function that will verify if the security code is okay. If God is OK, then I'm sending a message running the system and pointing to the syrup. Oh, this is the right code and I'm running some buzzer ups up some. However, if the court is not okay, then I will say the message cry again. A total city. Then we'll run some up and down a buzzer. OK, now let's look on how exactly? I'm verifying a security cord. So there's another function over here and now there are few lines that are being used for printing into the sale Monitor parties for the bugging. You can remove them, but at the end, this is a do I look that I'm reading a key. We saw that before from the keyboard, and I'm pointing that king to them. I'll see the screen and I'm learning some short beep using the tone function okay to provide the feed bag all of your feedback when you're pressing a key. And if the key is not deed, you know the final key then it will be added, is another character for the court bottles. And at the end, I'm checking if they pressed. Code is equal to the security code as a global viable. Then I will return to. If not, I will eat and force. And this is the function that will provide a bullion feedback if the security code is okay . Okay. This is what we are getting over there. Okay, That's the first nice combination that we see how to use the buzzer model. Let's move on. 54. Display Distance and Light Mode on LCD: Now we're getting to the core part off the system. Okay, We have sent. So we learned to measure distance using the ultrasonic Senso. And, of course, the light intensity. Okay. Like change using the LDS. And so now would like Toa visual the data to display that information on their city mortal in an endless loop. Again, let's see that court first and then the actual project it to demonstrate that capability. Okay, so the next combination is off course, utilized the LCD more duel. And what we would like to do is to take the measurement form the I am the are and from the AutoZone accessible and display a time information. So looking, for example, on the distance. So we say that if I will put my hand OK, the distance will change according to the new measurement by the or the stone extent. So Okay, we saw that in the See Elmo Neto. Now we are using the density to provide a real time feedback. Okay? And the next one is the audio and for playing a little bit with the brightness in my womb right now. Well, play with the light intensity. Let's do that Okay, I'm getting into Bright. Okay. Closing the light Changing okay. Gets really dark right now in my room. Let's bring it back. Okay, so that's a way to present real time. Since so measurement on an LCD. Okay, that's a very useful a way to display information. Let's move into the court I've been using for operating del city looking on the A Step six final Project Court. Okay, this is the main sketch, our final sketch. And now we're looking for the line of court relevant to what we saw right now updating their city screen from the A sensor reading. So let's find it off a few. So in the set up function, just after leading the security code, we will prepare the LCD screen printing a string for distance and level on the second line . Okay, Does that would be the set up and in the loop? What we'll do is to read the last reading from the ultrasonic sensor. Using this it function, get sensible distance and fondled. Er it gets in so light, we'll put that in the relevant viable distance and light level, and we will update the LCD screen. Okay? Setting the right closer and then present the distance and the same go for the light level . Let's see the to function, get Senso distance and gets in so light. Let's call below. Okay, starting with a get sense. So, like, we saw that function before. Okay, this is a building book, but we're using right now and for the get sense of distance. I mean, this is the a function that we already so before in the older stone exception way Just used that in our main court. Okay, that's the to function. Okay, this is the reason, um, in each section, we're building some building blocks and then you can easily use that in the next step when you're building a complicated project. 55. Automatic Thresholds Indicators: they last. A combination I would like to add to the project is the ability to create some automatic special indicator based on pre defined event. In our case, when some object that is being measured by the altar stone accessible is causing some specific distance, the system will tell on the led and the tradition. Start beeping some sound using the buzzer model based on the distance from the object. Okay, very nice result. Let's see that in action. Okay, The last combination. Our project is something that I call automatic pressure indicator. In our case, we would like well measuring distance using the It doesn't make sense. So and would like to provide some feedback to the user if some. If the threshold was crossed off the specialties 20 centimeters and I would put my hands What you see, I here I can see the led as an indicator. And in addition, I can hear the buzzer model, and if I will change the distance, you will hear different sounds. Okay, that's a nice, nice feet. Big care that we are playing with their with the sound of the Basel. Okay, that's all. This is our project and when, while combining all their component that we connected going back to the sketch. Okay, we're in Step six, final project and let's quickly review the line off Court off What we saw Right now, the automatic threshold indicator is a pretty simple line. Of course, if I will scroll down to the look function, then this is the 11 code. So we're checking. We got the distance and from the gets. And so this in function and how we can check if it's less a week. Well, from the pressure of the level valuable. And if that's true, we will turn on the threshold. They lead the pin and play with with the buzzer. Using the tone function is a little bit sophisticated. Pala matters. The first thing is to provide some a frequency that is based on the distance. Okay. And the second is to provide the duration also based on on the distance. This why you you hear some man I am told that is changing according to the distance from the object. And basically, that's all. This is what is needed to play with what we saw right now. 56. Course Summary: we almost at the finish line. Thanks for washing. So far, this goes. It was designed to provide you more advanced knowledge, elected to all kind off, useful component that can be connected to the, you know and how toe bigs them into one system. Now, let's see in high level the flow of topics that we covered and also what I would like to recommend as the next step moving forward on your personal learning. 57. What Did We Covered?: Okay, So what did we covered in this course? Well, we started with the metrics keeper, a additional type off input that is useful for many application. We saw that in the project a connecting an LCD model to display the keys being pressed on the metrics keeper and, of course, display real time information like messages and sense of measurement. We also used to censor the ultrasonic sensor for measuring distance from object and the El Dia sensor for measuring a light intensity like change. And the last component was a nice buzzer model for making sound. Now, doing this course, we practice how toe build a complete complicated system ineffective way, starting with breaking the project into steps, manageable steps In each step, we focused on one component at the time meaning what are the features and capability we can get a form that model and how toe connected to the Arduino ineffective way we used Free ching is a software tool visual the circuit and building that on a simple a bread board using the are doing no I d platform, while utilising different libraries in our program sketch toe easily operate some models and then designed the complete poor gone flow while mixing all component into some system that is doing some specific function 58. What Next? Level 3!: So what next? As I mentioned, the crazy about Arduino is a collection of few courses divided two levels, a enabling student toe, understand? And they just the possibility with albarino in a step by step approach. This is level toe, meaning the second course in the program, and I will release new levels. Going forward level Tree will focus on making the Marino and Internet off things device, having Internet connectivity, building a Web server and removed that a base very interesting course in any way. I will also let you know as soon as the new course will be released, I will be happy to hear this course helped you. And if you enjoy that, so fifth pick would be more than welcome. Thanks again for watching and good luck in your learning journey.