Beginners Masterclass into Internet of Things with Raspberry Pi and Microsoft Azure | Amit Rana | Skillshare

Beginners Masterclass into Internet of Things with Raspberry Pi and Microsoft Azure

Amit Rana, Engineer, Programmer and Trainer

Beginners Masterclass into Internet of Things with Raspberry Pi and Microsoft Azure

Amit Rana, Engineer, Programmer and Trainer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
62 Lessons (8h 55m)
    • 1. Introduction to the Course

    • 2. Introduction To Internet Of Things

    • 3. Choosing Cloud Services For IoT

    • 4. What is Raspberry Pi Part 1

    • 5. What is Raspberry Pi Part 2

    • 6. Downloading OS for Raspberry Pi Noobs-Raspbian

    • 7. Install OS using NOOBS

    • 8. Remote Control of Raspberry Pi Using VNC Viewer

    • 9. Install OS using Raspbian Image part 1

    • 10. Install OS using Raspbian Image part 2

    • 11. Getting Around Raspbian Operating System part 1

    • 12. Getting Around Raspbian Operating System part 1

    • 13. Getting Around Raspbian Operating System part 2

    • 14. How To Run Python program On Raspberry Pi

    • 15. Raspberry PI GPIO Concepts

    • 16. Raspberry Pi GPIO Interfacing Single LED

    • 17. Raspberry Pi GPIO Interfacing Multiple LED's

    • 18. Rapberry Pi GPIO Interfacing Buzzer

    • 19. Raspberry Pi and Transistorized Switching

    • 20. Raspberry Pi and Relay part 1

    • 21. Raspberry Pi and Relay part 2

    • 22. Accepting Digital Input On Raspberry Pi Part 1

    • 23. Accepting Digital Inputs On Raspberry Pi Part 2

    • 24. Sensor Interfacing With Raspberry Pi LDR1

    • 25. Sensor Interfacing With Raspberry Pi LDR 2

    • 26. Sensor Interfacing With Raspberry Pi LDR 3

    • 27. Sensor Interfacing With Rapberry Pi DHTT11 part 1

    • 28. Sensor Interfacing With Rapberry Pi DHTT11 part 2

    • 29. Sensor Interfacing with Raspberry pi Using SenseHAT

    • 30. Ultrasonic Sensor Interfacing with Raspberry Pi

    • 31. BMP180 with Raspberry Pi

    • 32. Enabling I2C On Raspberry Pi

    • 33. BMP180 Python Code

    • 34. Getting Started With IoT

    • 35. Getting Started with Microsoft Azure IoT Hub Part 1

    • 36. Getting Started with Microsoft Azure IoT Hub Part 2

    • 37. Getting Started with Microsoft Azure IoT Hub Part 3

    • 38. Create Device inside Azure IoT Hub

    • 39. Enable Azure Cloud Shell and enable IoT Extension

    • 40. Send Data to Azure IoT Hub Using Python Program

    • 41. Send Temperature and Humidity Values to Azure

    • 42. Storing The Data on Microsoft Azure Using Custom Gateway

    • 43. Save data to blob storage using Stream Analytics Job

    • 44. Data Visualization With Power BI Part 1

    • 45. Data Visualization With Power BI Part 2

    • 46. Creating Custom web app with azure for data visualization Part 1

    • 47. Creating Custom web app with azure for data visualization Part 2

    • 48. Creating Custom web app with azure for data visualization Part 3

    • 49. Dealing with password error while pushing your webapp to azure

    • 50. Cleaning up Azure Resources

    • 51. Remote Monitoring using Azure Logic App Part 1

    • 52. Remote Monitoring using Azure Logic App Part 2

    • 53. Introduction To Thingspeak

    • 54. Create an account and send data to Thingspeak

    • 55. Getting started with SaaS IoT Platform

    • 56. What is MQTT

    • 57. Sending Data To Adafruit Io Using MQTT Part 1

    • 58. Sending Data To Adafruit io Using MQTT part 2

    • 59. Home automation project with adafruit IO Part 1

    • 60. Home Automation Project With Adafruit IO Part 2

    • 61. IoT Security

    • 62. Conclusion

  • --
  • 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

Are you trying to study Internet of Things?

Are you getting confused with all the hardware and software stuffs?

Learning IoT can be very confusing especially if you’re new to electronics. Even experienced people struggle in understanding everything at one place, definitely you’re not alone

Stop Struggling to Learn IoT

I’ve created this course which will enable you to learn and experiment with IoT in a very easy way

I firmly believe that anyone regardless of their education and skills can not only learn but excel in experimenting with IoT including all the hardware and software skills.

This course is specially created for beginners in electronics hardware and cloud technologies!!!

Hi, My name is Amit Rana, I’m an engineer, programmer and trainer

I have created “Beginners Masterclass into internet of things” to help you learn IoT with Raspberry Pi and cloud technologies.

If you’ve always wanted to

  • Start or shift your career to Internet of things

  • Get better in your existing work

  • Kick start your next dream IoT startup

  • Start your own blog and Youtube channel, probably online course on this ever growing industry

… then this course is specially for you.

This course is specially created for beginners in electronics hardware and cloud technologies!!!

IoT is interconnecting various things and devices to send and receive data from internet enabling variety of applications

In this program, there are number of different aspects of IoT that we’re going to study

First, we’ll understand the basics of IoT and what are the different hardware and software platforms needed for it

We’ll then use raspberry pi as our controller for this course and see how we can make it up and running. We’ll see how to write python programs for various interfaces like relays and sensors.

Once we get confident about raspberry pi, we’ll then explore IoT with Microsoft azure and few more platforms

With something like Microsoft azure, you can create any kind of system you want, we’ll see how to push data there, how to see data visualization using PowerBI,

How to save data and how to create our own custom app over there.

After Microsoft azure, we’ll see some other popular platforms like thingspeak and adafruit IO and try to create a complete home automation project using raspberry pi.

In This Course, you'll learn


  • What is IoT and why learning it is important

  • How to implement IoT, what are the required Software's and hardware for IoT

  • What is Raspberry pi and how to setup raspberry pi for first time use

  • Introduction to Python programming with raspberry pi

  • Interfacing of various sensors and output devices with raspberry pi

  • Python programming to control home appliances and read sensors

Microsoft Azure IoT and Cloud Platforms

  • Communication protocols in IoT

  • What are different Cloud platforms used for IoT, what is PaaS and SaaS products

  • Creating account on Microsoft Azure and learning

  • What is IoT Hub creation and its various pricing

  • Pushing data to IoT hub from raspberry pi

  • Data Storage using Blobs

Data Visualization and Logic

  • What is PowerBI?

  • Creating account on PowerBI

  • Using PowerBI with Raspberry pi and Azure IoT Hub for creating reports

  • Create real time web app for data visualization

  • Create Custom Logic app to trigger and email from Azure


  • Creating account on thingspeak

  • send data from raspberry pi to thingspeak

  • Use HTTP to send data

Adafruit IO

  • Deeper understanding of what is MQTT protocol

  • Using adafruit IO for creating IoT project using MQTT protocol

  • Complete Home automation project using Raspberry pi and Adafruit IO

What this course will do for you?

  • Give you a clear understanding of what is IoT?

  • Take you from a complete fresher to an experienced Raspberry PI user and programmer

  • Understand IoT protocols

  • Design your IoT systems

Who Should Enroll?

  • Complete Beginners into IoT and Raspberry Pi

  • People who understand little in IoT and want to learn Microsoft Azure IoT Hub

  • Freshers as well as experienced one's

This course is specially created for beginners in electronics hardware and cloud technologies!!!

I have been training and developing from past 10 years. With more than 50000 students trained across 150 countries, you can be assured that you’re in a good company. What’s more, there is always a 30 day money back guarantee so you’re safe about investing your money into this course.

Who this course is for:

  • Working professionals desiring to have a career shift in IoT
  • Students and Freshers exploring Career in IoT
  • Hobbyists creating IoT projects for Home
  • Anyone willing to dive into IoT and Raspberry Pi

Meet Your Teacher

Teacher Profile Image

Amit Rana

Engineer, Programmer and Trainer


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. Introduction to the Course: Are you trying to study Internet of Things? Are you getting confused with all the hardware and software stops. Learning IOT can be really confusing, especially if you're new to electronics. Even experienced people struggle in understanding, averting at one plus definitely you're not alone. Stop struggling to learn IoT. I created a course which will enable you to learn and experiment with IUD in a very easy pace. I firmly believed that anyone, regardless of the education and skills can not only learn but Excel. I'm studying IoT, including all the hardware and software skills. My name is Ahmed. I'm an engineer, programmer, entertainer. I have created a bigness masterclass into Internet of things to help people like you learn IoT, we trust, verify and cloud technologies. If we're always wanted to start or shift your career into Internet of things, get better in your existing law. Our kids start your next dream IOP startup. Then this course is for you. In this moment, there are a number of bitter aspects of IoT and that we are going to study. First, we'll understand the basics of IoT and what are the different hardware and software platforms needed? Four, it will then use Raspberry Pi as our controller for this course and see how we can make it a fan running. And then see how can I doubt different Python programs for various interfaces like relays and sensors. Once you get confident UML class many pi, we'll then explore IOT with Microsoft and soon and few more platforms with something like Microsoft. And soon you can click any kind of system you want. We'll see how to push data over there, seeing how to perform data visualization using Power BI. And we'll also see how to save data and how to create our own custom apps over there. After Microsoft Azure, let's see some other popular web fonts. Let things speak and end up IO and tried to create a complete home automation project is industrially man. I haven't training and developing standards. And more than 50 thousand students tend to run 50 countries. You can be assured that you are immigrant company. Start experimenting with hello there. Let's get started with the study of Internet of Things with Raspberry Pi. In this session, let's see what are the different aspects of this course that we are going to study and we're going to learn. So this is the overall agenda of the entire course. The very first chapter might be, every chapter might be consisting of 12345 videos depending upon the requirement and depending upon the expected duration and the things that I want to cover. The very first chapter is about introduction to internet of things. Where we will try to understand what all the theories about Internet of Things and what is that we are going to study. The second chapter would be about understanding the different boards and devices which are used for I2. So this is for the hardware part. We will be understanding about the different hardware that are used for IoT here. Third, fourth chapter is about Raspberry Pi. So we're going to use Raspberry Pi as our main controller board for all the experiments with respect to IoT in this course. And third, fourth chapter is all about setting up the Raspberry Pi and studying about the input, output port pins and every technical detail about Raspberry Pi. The next session is about sensor interfacing. So in third, fourth session also, we will be doing some experiments as well in Python programming with respect to GPIO. And fifth chapter, we will see about how to interface a sensor with Raspberry Pi. And in the sixth chapter will try to create our first mini-project, that is mini weather station using Raspberry Pi and sensor. In this chapter, we will understand in detail about all the different communication protocols which are used in IoT. And what are the cloud computing technologies which are used in IoT? So 78 chapter is about understanding protocols and cloud computing. In one chapter, we will see how we can create an account on Microsoft Azure and what are the different IoT services provided by Microsoft? Assume it's ten chapter. We will also see the USSR IOT implementation with respect to Raspberry Pi. And in 11th chapter we'll see the actual project with Raspberry Pi. And as rural. Chapter number 12 is about understanding the IoT edge analytics. And chapter number 131415 is about a number of different hands-on projects. So in this particular course, we are going to study about Microsoft Azure as well as some other, most popular cloud service providers. Basically not cloud service for order, but IUD service providers. So that's about the entire course structure that we're going to cover. Don't worry, it will be a very fun ride for you to experiment because it will be consisting of hands-on experiments. I believe in having more hands-on experiments than theory. But I'm just including the theory for the sake of understanding a where it is absolutely necessary. Believe me, if the theory is not needed, I would not have mentioned it. So whenever there is a theory, it is for understanding. And apart from theory, of course, there have been lots of hands-on experiments to cover in this course. So let's get started with Internet of Things with Raspberry Pi. Thank you. 2. Introduction To Internet Of Things: Hi there. Let's get started with the first chapter, and that is introduction to Internet of Things. So let's start spending about OUT. Now. First of all, what exactly is a UTI? That's, that's the first thing we have to clarify in our mind. And if you ask from a simpler perspect too, if you ask this implicit question, is IoT a new thing? Definitely, the answer is no. There is nothing new in IoT. And we have been doing all for a very long time. There are a number of different command and control scenarios where similar things like IoT is been used for a lot of years now. But because of the feeling hardware costs, the failing costs of cloud computing services, and number of different technological aspects. Itut has become easier now. So it's not new, but it is easier to implement now. And therefore, the full application potentiality can be explored. So in this simplest format, what is IoT? Iot is just this. It's about things. Things means any kind of particular thing. Like it may be my air conditioner, It may be my car, it may be my home room or a computer or my heartbeat monitor thing, mins thing. That's about it. So there is no definition to it. It's purposefully called as thing because a thing can be almost anything. So any such thing appearing in physical world, it's connected with a sensor to measure the parameters. Then the same sensor parameter which has been measured, it's sent to internet to perform some analysis and to find out some valuable insights out of it. And based upon whatever analysis that we have done, we have to predict some kind of action or we have to take some kind of decision. If you talk, what is IoT in the simplest format, it is just this much. Having things connected with sensors send their data onto Internet, perform the analysis and insights, or performing the processing onto the internet, and then finding out some actions or deciding or taking some actions and some decisions based upon all this things. So it was also called as M2M before. In fact, when I first created my IoT product, the at that time, it wasn't even called as OUT and used to call it as M2M communication. So there are a number of different names like M2M, internet of everything, where it says web, the concept is same. Names are different, but the concepts are same. Fortunately for us, nowadays the concept is summarized as IoT only. So we just call it as IoT, the term IoT, Internet of Things was first used by a British visionary called Kevin Ashton in his presentation when he was working for touchscreen gamble back in 1999. So upset before the concept of M2M is quite old. But the DOM IUD only the term IoT is new. And what are exactly the things in the discussion out here. So that's an interesting thing to understand, like what exactly it's a thing. So basically, this is the broadest structure or broadest block diagram of a thing in IoT opinion, IoT consists primarily of a controller which has a software embedded into it. This controller can then, with the help of software, read the input sensors and control some output devices. It can make some output devices go on and off as far as it can do some kind of spirit control as well. This controller with the help network interface is connected to Internet. And then there is some piece of software on to the Internet as well. Who is receiving all this data sent by the controller for looks in put sensors and then processes them. After this point here, there can be a user-interface on a laptop or a mobile application who can interact with this Internet-based software and can read the reports generated by these things. Let me give you a very simple, classic example of a manufacturing industry, which is manufacturing chairs. For example, I have a company whose manufacturing a number of different plastic chairs. And I want all the information about which machine is manufacturing, how many number of chairs and what is the efficiency? What is the overall throughput of my production floor? In that case, an IMT and Ebert system will have a small unit like this connected to every single production machine, which can gather the details coming from the machines automatically without any human intervention and send it to I fire onto cloud server. I then will have access to all this data through a web browser or through a mobile application. I can see how many machines are working, how many machines are in downtime or into maintenance mode? How many machines are performing very well? What is the efficiency of machine? How many jobs are, how many chairs are being manufactured by a single machine? And so on. The amount of data that we can generate and the amount of intelligence that we can generate out of IUD. It's practically infinite depending upon the case scenario, are depending upon where we are using the system. There can be any number of different applications for IoT in particular scenario. Now, having got a clear idea or a fundamental idea of IoT, Let's see, a very zipped applicable. So we, it is always said that IoT will revolutionize the industry in terms of technology, process, as well as people. So there are a lot of things over here, but let's learn to understand it in sector wise. So I have shown some of the sectors over here, automobile construction, health care, consumer electronics. Can you tell me which of the sectors is more applicable or which of the sector can be more benefited by Internet of Things, gathering the data, processing it on Internet, and then doing some valuable. Insight generation. And if you think closely, you will find that every single industry can be benefited from IoT. And not only benefited, but it can't be benefited from IoT on a very large extent. That is why our UT, it's set to be the next big thing. Because IoT is present in every other area or every other sector, every other particular zone, wherever they read some book happening. So it may be automobile for connected cars for construction in health care, consumer electronics, education, defense, IT, Lots of them. So if we are already using some consumer electronics applicant appliances or applications of IoT, like the ECNs, which are connected to the internet, the lights which are connected to internet. In education, we have been using IoT and number of different places from, from the smart boards that we have to the tracking systems that we have installed in the buses. And there are a number of different IoT applications with respect to delivery of the education as well. Similarly, there are applications in health care, defense IT manufacturing, and not only these eight fields, but every sector of that you can find IoT's applicable over there, or IoT can greatly increase the productivity over there. So this is how, this is a very blurred diagram, but this is how IoT is set to be appearing in all the industry. So building, energy, consumer, healthcare, industrial transportation, retail, public security, as well as ITN networks. Broadly categorized as consumer application, industrial application, commercial application and infrastructure spaces, and consumer applications at said, there are home automation devices, there are wearable devices, as well as there are connected cars. In industrial application, there are number of different fields. Basically, the industrial IoT, it's so big that it is completely called as IIOT, a completely new concept called as industrial IoT, or it is also called as industry 4.0. The Fourth Industrial Revolution, where every single process in an industry can be connected to IoT to generate complete manufacturing data that is possible primarily to monitor the manufacturing, perform remote maintenance, energy monitoring and metering. And most important application is predict to maintenance in industrial space. In infrastructural covers everything else that we have not shown in the previous slides. That is, the best management energy management, smart energy, smart held public safety is smart parking, air pollution management. It can cover almost anything and everything that is not covered before infrastructural OUT. So these are the widespread applications of IoT. But apart from that, there are applications in completely different sectors also which we don't consider, but they are like IoT in banking, IoT in telecommunication, IoT in transportation. As well as IoT in fashion industry. So they said something weird to hear. But yes, there have been a number of different jackets which are used to track fitness. There have been number of different endeavors which are there to assist you in performing some particular exercises, all enabled by IoT. So there isn't a single industry which is not touched by IoT completely. And with respect to childcare also, uh, recently I have had a chance to work with a client who was preparing an API, which is IoT enabled. So whenever a child pose or P's, then the parent gets a notification on their phone. Now, as weird as it may sound, this is a very useful application and almost everyone who has children can associate with it. The 90% of the decisions that we have in the children, or mostly in infants, are due to the weight bodies or with cloths. So these are the wide spread applications of IoT, not only in industrial or commercial spaces, but in our homes as well. So that's a broader introduction about what is IoT. Now talking about the applications, there are literally a number of different application. For example, there are some interesting projects also like this, IBMs. If you have seen it's something like Google Assistant or Amazon Alexa, The only changes, it's completely open source and you don't need to purchase it, so you can simply assemble it on your own. Similarly, there is an Assistant like Microsoft, Google Home and Amazon equip. You all know it, but I don't know how many of you have known about Microsoft AI. If you have not, then it's worth exploring a project. It's a totally secure and private virtual assistant. Looking at the numbers of the active device collections worldwide, we can see the number of total connected devices to IoT is going to increase drastically over the years. So there is no doubt that IoT is increasing at a very rapid rate. As of now. This is the sector wise value addition of IoT. This is the prediction by 2020. So this is just a sector wins pie chart. Which sector is utilizing How much of IOT? That's it. So these are a number of different scenarios you can see for Cisco surveys, you can see for Gartner surveys. And you can see for any number of servers that you want to get more detail about, our UT does have some interesting facts about IoT and the global IoT market. In 2014. It's 2.499 trillion, which is expected to rise above it trillion in 2020. The number of IoT devices worldwide, it's supposed to raise by about 76 billion by 2025. So is the business investment, the market size and the percentage of enterprises adopting to IoT is also increasing drastically. So that's about the introduction to IoT. I hope you have got a fair idea. And most of you, I'm assuming, was having some idea before also. Now in the next session, let's see what are the different hardware devices which are used for IoT. Thank you for watching this video. 3. Choosing Cloud Services For IoT: Either. Now after understanding the different hardware boards that are available, it is also important for us to understand what are the different cloud service available to create an IoT based application. And this particular point here is a little bit confusing. And for any newcomer or for any pressure, it may confuse a lot. Wild will confuse because there are primarily two ways in which you can use a cloud-based server to create your application. First is creating a completely custom cloud platform using any of the major cloud providers that are available. This is called as platform as a service. Second approach is using existing service providers which are optimized for IoT. So this is a completely ready to use software. And we just have to use it. And it's called a software as a service. Here, we pay for the readily available software that they are providing. Here. We pay for the readily available platform that is provided to us. On the platform, the software needs to be built by our own, or we have to build the software completely by our own. You are using our own resources. But in the second case, the software is readily available and we just have to pay for it. Of course, the first case gives us flexibility to design anything and everything possible. At the same time, increasing our work or increasing our development, ours. The second approach provides almost everything for us, a readily available but indefinitely limits on how much we can do or how much we can achieve on our IoT product. Now to give you a glimpse of it, these are these SaaS model or software as a service models thing works. Everything. Sensor, Cloud, DNS Cloud things spake numerics. Again, I'm telling you this is a completely different startup area where number of different companies have come up with the IoT based cloud infrastructure and they're providing it as a complete software as a service. So this is, this is just a list of some of the popular ones in the industry, but it is not limited to it. For example, there is one very interesting new platform which I have tried and not new, but I have just recently tried. It's called Finger dot IO. Ok. There is some issue with my Internet connection. So there is thinner dot IO, then there is Adafruit dot, Ohio. There are a number of different new cloud platforms available. We'll see about those platforms in detail. The only thing I would like to tell you about it here is this platforms are ready to use just like a Google account or an email account. We just have to create an account on it and start using it. They also providers some piece of software which can installed on Raspberry Pi or the program which can be used with Arduino. And the data can be sent directly to it. With case of platform as a service, or what we call as PAs model. All the major cloud providers like AWS, Microsoft Azure, Google Cloud, and IBM Cloud provides their own suit of IoT services. Now, this is different. There is nothing readily available for you to use over here, and you have to create your own application using this infrastructure. Choice is very simple. If you are creating a product from scratch, if you have a nice development team, then definitely go for AWS or Microsoft Azure or these kind of solutions. If you are a start-up, if you are just getting started, if you just want to demonstrate your product, then definitely you should use something like this. Moreover, the most important decision it's coming out of, whether you are creating a product. You are creating a project. For example, if you are a service integrator who want to provide services or IoT based projects services to industries or your clients, then this is a better choice using any multiple of such services depending upon your client requirement, this is a good approach. But if you're creating a product of your own, then definitely this won't serve you that much and you will have to create your own product using your own cloud infrastructure. So that's about the introduction to IoT guys. I hope you have enjoyed the session. Feel free to have, or feel free to ask any questions if you have over mail. Thanks for watching this video. 4. What is Raspberry Pi Part 1: Hi there. In this video, we'll start to understand what exactly is the Raspberry Pi and how we can use it not only for IoT, but also as a simple general-purpose computer. So let's get started with this video. So the contents of this particular session are about understanding the Raspberry Pi and powering it on for the first time if you have not used it. So let's see what exactly is raspberry pi. Now, there are a number of different boards which we can use for Internet of Things and for development of such applications. But Raspberry Pi is one of the most important and one of the most suitable board to start learning about IoT. At the same time, we also learn about what exactly is Raspberry Pi, so that you can not only develop IoT applications, but you can develop any kind of embedded applications with Raspberry Pi as valid. So what exactly is Raspberry Pi? Does vary pi is a small credit card size computer which was developed in UK. It wants first developed by just couple of a group of engineers. And the sole purpose of the development of this small credit card sites, Computer modes to allow the schools across the world to be able to afford a computer. I repeat the main purpose of development of Raspberry Pi modes to allow these schools to afford a computer for themselves as well as for their children. Basically, Raspberry Pi was then invented to spread the computer education across the schools. It has some very simple and most important interfaces like he was be, HDMI, stereo audio, general purpose input, output pins, LAN, a serial camera, and serial that screen. So these are some of the interfaces which Raspberry Pi heads. Now, there are plenty many misconceptions about Raspberry Pi as well. So it is important for us to understand what exactly is Raspberry Pi. As I said, it's a credit card sets computer. It's a complete computer in itself. So it's not a microcontroller. It's not some kind of a particular development board like Arduino. It's a complete computer. That's one thing. Second thing to understand this Raspberry Pi can't run a number of different operating systems which are based on Linux, as well as very recently, a Windows ten IoT core means of Windows ten compatible OS is also released for Raspberry Pi. So about as well, it is important for us to understand what Raspberry Pi is not. So most importantly, it's not the name of any micro controller or microprocessor. It's the name of a complete computer. Again, to understand, Raspberry Pi is not name of any IC or integrated circuit. It is not name of any software. It is not the name of any programming language. Raspberry Pi's simply put, it's a computer itself. It's a complete computer. In a very, very small sites. Now let's see how exactly it looks like. So we have a photograph here like this. So this is thus very pi, a complete computer. Now you can see we don't seem to have a hard disk over here. And that's true, does repair doesn't use hard disk for running the operating system and storing the data. Instead, it simply uses memory card. Now will see what Raspberry Pi in detail very shortly. So let's see why we are using Raspberry Pi for IoT. First of all, the embedded systems are the systems, electronic systems with which we are going to send the data are becoming very demanding these days. And then for a high processing power is often required. A gentle microcontroller is good enough for quick experimentation as well as deploy and number of different projects. But there are many limitations to a microcontroller legged cannot send an email, or it's simply cannot just easily capture an image and send it as an attachment through email and generate audio and number of different insoluble. So why we have chosen does vary pi for starting IoT. The reason is very simple. It is most cost effective platform for learning and application development for IoT. So Linux-based operating system, Linux based computers are very, very costly. And the answer is one of the cheapest one, not one of D, but I would probably say it's the cheapest Linux-based computer which we can use. Now, let's see what was the primary objective of creating Raspberry Pi? As stated before, the main purpose of building Raspberry Pi was to enable kids across the globe to start London computing. Second purpose was to make it as cheap as possible with the price point or the price tag of $35, Raspberry Pi is arguably the cheapest computer in the world. What's more when it was first released in 2013 or 12? I don't remember the exact date, but we can see the Wikipedia for it. Point is very translate at least at first, several years ago, it was placed thirty-five dollars at that time. And that was some small processor with 700 megahertz frequency and about 128 MB of RAM. Now, we have a 64-bit core core processor with 1GB of RAM, and the price point remains still the same. So the Raspberry Pi is evolving. I didn't number of different features into it. But still today, the President wants the same thirty-five dollars, making it the most affordable computer in the world. And therefore, the primary objective could have been easily sold to teach programming languages to kids. But apart from that, what happened? Eyes, Raspberry Pi has enabled tackles our hardware developers across the world to develop a number of interesting systems. Because there is one thing Raspberry Pi is having, which other competitors don't have. And it is this, the GPIO, general purpose input output port pin. Because of the general purpose input, output port pin, what happened is you're able to connect real world devices, real world sensors to the Rasberry Pi, which you cannot connect to any other computer, even to your laptop or anything. You said we have seen most of the features of Raspberry Pi and we'll see in detail in the next video about it. So let's see the specification of Raspberry Pi. So currently diversion that we have in hand is Raspberry Pi three, which I'm going to use for this course. At the same time, I will be also using Raspberry Pi four. I will explain about this feature in short. But let's see the Raspberry PI three features. First, it does what, a quad core 64-bit ARM processor at cern, which is clocked at 1.2 gigahertz. It has got a separate graphical processor with 400 megahertz capacity. It has got 1GB of RAM. For USB ports on board my fan, it's Jeremiah and analog video output gluten for 0.1 wireless LAN or Wi-Fi, as well as the Ethernet connectivity. So because of all this connectivity options, it becomes very easy for us to use Raspberry PI, even as a multimedia computer, which kinda connect to internet, play videos and do a number of different things with it. These are some of the versions of Raspberry Pi that had been released till now. What each function consisted of, you can definitely go and look into this specifications. For now, I'll just explore what we are going to use. So we're going to use PI three and we're going to use by four. So pi four is the latest version of Raspberry Pi as of now, it's January 2020, but I'm pretty sure by the time you will be watching this video, there must have been some new version of Raspberry Pi released because they're releasing it almost every year. So the chances are that that would be a new version. But remember what ever that we are going to study throughout this course, we will remain same for any coming Raspberry Pi Model. How am so confident? Because it's the same we have been, I have a Raspberry Pi Model B, which was quite older, and the operating system installation running each, every program onto it. It remains the same till pi 4t, and therefore, it will remain the same for any further editions as well. That's it for this video. Let's say in the next video what exactly a Raspberry Pi it looks like and how we can start using it. Thank you. 5. What is Raspberry Pi Part 2: Hi there. So let's get started to understand how we can use Raspberry Pi. Now, for using Raspberry Pi, these are some important things I would like you to have. So there are some essential, essential stuffs, which includes raspberry pie board itself, of course. Then you need a memory card, a USB keyboard, display with HDMI, DVI, or composite input. It means you can use any kind of TV that you have at your home. Or if you have a computer screen of VGS screen, then you can connect it to Raspberry Pi using an HDMI cable. And what you need as an essentialist power supply. Power supply usually is the mobile charge that we use up two by three and from pi four and onwards there is a time sci fi inverts connector. Before that it was the regular Micro USB charging point or the PowerPoint from Raspberry Pi for its D USB Type C connector. So definitely, you are a power supply requirement should be fulfilled with immobile charges that you have. I recommend some highly suggested extras, like USB mouse for using the Raspberry Pi and very well Internet connectivity, of course, we need in order to do anything with us very pile like installing some new softwares or are preparing or doing some experimentation with IoT. They are powered USB hub because Raspberry Pi has only 40 Wednesday ports and you might be needing to connect some more peripheral stood. In that case, you have to connect a powered USB hub, which it's powered on separately. And lastly, a Raspberry Pi keys. So these are the most important or most required tastes that you might need when you start experimenting with Raspberry Pi. So this is how a Raspberry Pi three model will look like. I will also have another video in which we'll see how it does vary by four looks like, and what are the differences. So this is the power burning connector of raspberry pie. It's similar to that one on mobile phones. It's the micro USB connector to connect five volts over here. This is the connector for connecting HDMI, for connecting a monitor. This one over here is a land cable connector. These are the four USB ports, and this right over here is a general purpose input, output port. Now let us see how it actually looks like and what is the form factor of raspberry pi? Now as you can see, this is how the Raspberry PI looks like. So to give you an idea of the overall signs, this is our mouse would look along with Raspberry Pi. So it's quite small. It's literally the credit card size computer. This is the power connector we just talked about over here. This is the HDMI connector. This is an integrated audio and video Jack that we have. This one right over here and insulin connector deserved for USB ports. And this is the GPIO offer us 35. We have a total 40 pin GPIO on Raspberry Pi using. And there are two additional direct motherboard connector, or these characters are directly connecting a peripheral to the processor. So this one of them is a camera connector and one of them is a serial. That screen connector. If it done around your Raspberry Pi. And you can see there is a memory card slot over here into which we have to insert a memory card which will act as a storage device for other US VD by now this is Raspberry Pi three. Now what I have over here is that as the repair for model, as you can see, now, there are some significant changes. For example, as you can spot, the charging connector has been changed. It's a type C connector known as compared to the micro USB connector over here. Then you can see there are two display ports, and they are not the regular sized HDMI connectors, but they're Micro HDMI connector. So this is a change that you can see the additional heat sink over the processor ended em, and resting remains the same. So there is a terminal node on the right hand side. So this is a change. Previously, the Internet is on the left-hand side and the USB on the right-hand side. Now, the US spins are here, they terminated here. Then we have this GPIO, exactly like the older version of us. Very bad. And this is the memory card slot. So there is no change with respect to the position of card slot. So you can use any one that you have with you for the experimentation. Remember, if you have this one over here that you need a micro HDMI to HDMI cable. Whereas for the Raspberry Pi three model, the same is not needed. And you can connect any standard HDMI cable directly into it. So that's about the Raspberry Pi. In the next video, what we'll see is how we can install an operating system onto the Raspberry Pi computer. There are a number of different operating systems which are available for us very pi, and we can use any one of them as we want. But it is officially supported to use at last been for us the repair. So we will be using the same one for the installation of raspberry pi, as well as for all the other experiments that were going to do throughout this course. Thank you for watching this video. 6. Downloading OS for Raspberry Pi Noobs-Raspbian: Let's get started with understanding about how we can install the operating system interests very bad. So what I have here in my hand is a 16 GB class ten memory card. Although you can also use a GB memory card, but it is preferable to use at least 16 GB of memory card for all the project work that you might have to do. So I have a memory card with me and I have a USB card reader. Now you can use a USB card reader, are the laptops inbuilt card reader. It's completely up to you. And as soon as you connect this to your computer, then the same is detected and it's displayed. The very first thing we have to do is we have to format this memory card and to format it. What we do is we make use of a software called SD formatter. So just search for SD formatter. And you'll go to the link where you can download the SDK formatter. So this is the website. And into the download section, I can see SD card formatter for Windows download. Right now. I don't need to do it because I already have it installed. So just download the software and install it. Here as regard for matter is present. So just open it. It will detect the drive letter automatically and then simply click on format. It will take some time and the card is formatted completely. Now once the card is formatted, you have two options to install the operating system onto it. So let's just confirm the card formatting done. So let's open the computer and let's open the drive so it's totally empty. Now, the two approaches that are there to install operating system onto the Raspberry Pi are available on the Raspberry Pi website itself. So let's go to the US very pi dot ORG. This is the current version, the Asbury PI four. And I'm pretty sure by the time you are watching this video or by the time you are taking this course, there might be some new version of raspberry pie, which is up in the market as well. Don't worry. The beauty about Raspberry Pi is that regardless of which version of board we are using, the installation process remains exactly same. So even if I use a raspberry pie board computer, which is three years old one, the same installation procedure is applicable to that also. So let's go to Download section. And here you will see there are two primary options. I'm going to demonstrate to you both of them one by one. The very first approach is downloading this loops nope, stands for new out of the box software. The advantage with notes is that the installation process, it's fairly simple. All you have to do is you have to download this particular loops. There are multiple versions, so I wouldn't recommend for beginners to go for loops, light better. You go for the entire loops. And then simply click on Download ZIP. So it will start downloading. And as you can see. It's a bit bigger file. So it's, it will take about some time. It's a 2.3 GB download. Once the move is downloaded completely. Let me show what is next or what we have to do next. So I haven't noticed already available with me. Let me see if I have it. Okay. So I don't have a loops installed. So let's wait for the loops to get downloaded completely. What happens with loops is you get a simple zip file as a download. After extracting the zip file, you get some files and folders which we simply have to copy and paste into the memory card drive. And then you can remove the memory card and then connect it to Raspberry Pi. After connecting it to Raspberry Pi, what will happen is it will start the installer automatically. All we have to do is we have to select the operating system that is Raspbian, which we have to install and then click on Next. And the Raspberry Pi will be completely installed. That is what we do with the approach of loops. So let's see. After the download has finished. Now, as you can see, the downloading of noobs has finished. And what we get is a zip file like this. If you want, you can just open this file and look for all the contents of the zip file. But what we want to do is we simply want to extract it. So I use a software called when radar. You might be using any other software. It doesn't matter even if you don't have any. When zip extract of software, it can also be directly extracted using the built-in Windows system. So simply do what? Extract the files, the loci, the contents of the zip file to location. Now it's been extracted. And after the extraction is completed, do not forget to remember. You don't have to copy the entire folder here, but you have to do is you have to copy the contents of this folder. So whatever you see here are the contents of noobs folder, which we have to copy onto the SD card. Now what I'll do is I'll simply selected all the contents of noobs folder, copy that. And then going into the memory card folder, which I have here, I will have to paste it. Now once you paste the contents of the folder into the memory card, the next step is to insert the memory card into your Raspberry Pi, connected to a display, connect a USB keyboard and mouse, and power it on. Remember, when you are going with the NOOBS approach for installing the Raspbian operating system. For us very pi, it is mandatory to have a display, because onto the displayed self, you will see the instructions for installing the operating system. If you don't have the display with you right now, then you may have to go with this second approach. We will be looking into the subsequent videos. But for the first and the simplest approach, it is recommended to have a display. And for any beginner, I would recommend you to use a display because it not only simpler for installation, but it also clarifies all the concepts with respect to Raspberry Pi. And it doesn't matter if you don't have a VGA monitor or a separate monitor at your home, you can fairly used the television set that we are already having. Any entity B or LCD TV has an HDMI port. All we have to do is connect the HDMI cable into the Raspberry Pi. So once the copies done, what I'll do is I'll remove the memory card from computer and then we'll see the next instruction. So don't forget to follow these steps as discussed, we'll say in the next video how we can connect it to a display and how we can power it on. Thank you for watching this video. 7. Install OS using NOOBS: Hi there. Now, this is the USB memory card reader which I was using and I have copied the moves inside it. So what I'll do is I'll just remove this from the memory card holder and no, I don't need the cardholder or Carter anymore. As you can see, it's a 16 GB memory card. And what we have with me here to Raspberry Pi boards. So this is a by three model B plus, as you can see. And I have this one here, which is phi three modal B. Both of them are wifi enabled, and I also have a pi four, which I'll be using and I'll be demonstrating as well. But in the subsequent sessions, the installation process remains the same for all the boards. Why I am showing you pi three versions is because the HDMI port is very simple over here. And that's where we can easily use it. So if you have to install the operating some stream into the Raspberry Pi, you have to understand the pin structure as well at the same time. So or whatever the areas onto the raspberry pie board that needs to be understood well. So as you can see, this is the power connector for Raspberry Pi. This one here is an HDMI connector, a regular sized HDMI connector. This over here is an integrated audio and video Jack. So you can get a cable to put into here with which you can connect left audio, right audio, as well as you can connect the analog video of this one over here is the land connector. And these are the four USB ports that we have for usage. This is the GPIO off Raspberry Pi, where we can connect external devices, LED's, switches, sensors, or anything that we want. And we have to further characters as you can see. So this one here is a display connector where you can connect a display directly with processor. So this is the V0, the connector walks. And this one here is a camera connector. So to this, what you can do is you can connect a serial camera. So whenever we are experimenting with that, I'll be demonstrating that as well. For the installation to work. Now what we need is we need the memory card in which we have installed loops. And then there are some essentials, as I've discussed. As far the essentials, what we need is this one, you can see this is a HDMI VGA connector. So why I need HDMI to VGA connector? Because I have a VGA monitor over here and it doesn't support HDMI directly. So I have to use this as GMR to VGA connector. Then what I need is I need a keyboard and mouse, the both Voc on USB. So I just need to connect this USB receiver to that SVD pie. So let us begin. So this is the Raspberry Pi board I'm using, and this is the keyboards connector that I have. Now what I'll do is I will use this memory card and I will turn over the Raspberry Pi and just inserted into it gently. So it just goes at this much inside it. Not more than that. You can see. Then connect the HDMI connector. So this HDMI connector, what I do is I will connect the monitor VGA cable. As you can see, if you have a TV, then you can directly connected TV cable to it. Was this much is done. But right now I don't need anything else. Memory card is GMR and keyboard. Now, I have a very simple mobile phone charging over here, which I will be using with Raspberry Pi. And now we can power it on. So I'll just turn the camera a bit now so that could feces my monitor. And now what I'll do is I will simply Babylon did SVD pile. So here we have power it on. And the splash screen and the display should start coming over here. And I'll see if everything is okay, then within moments, the installation should start like this. So let me just refocus it once cs. And as you can see, it shows two options. So this one over here is Raspbian full, which is recommended. And this one here is another operating system which is liberal aliasing. It's completely different entertainment center. So what you have to do is here, first of all, it changed the language from English UK to English US based upon your keyboard layout, whichever you have, then simply click on this button over here, which should start the operating system installed chips select the operating system, and then we simply have to click on the install button right over here. So this is the install button. This is where you will select the Raspbian and this is where the keyboard layout was. This matches then simply click on install and the installation process when start. So the message that we have got, let's zoom in these. This will install this electrode Operating System. All existing data on the drive will be overwritten, including any audiences that are already installed. We're completely fine with that. Just click on yes, at this point. And the installation had started. Now you can see, please make my software is installed on your SD card. This will take a few minutes. Now how much money it actually takes depends upon the size of operating system you're like Now having. For example, if you can notice, it's saying 5437 MB needs to be written. And it also depends upon the type of card you have. So right now I have a class ten memory card, which should give me a very decent writing speed. So you can see 3.6 Mbps. It's something that is weighing on close to four Mbps. And according to that, it should be completed within five to ten minutes. Once it is completed, then ask any pi will be reinstalled automatically, and then we can start using it. So let's reach here and let the installation get finished completely. Now you can see the installation is close to get finished. It's 99% now, as you can see. And it's not a 100%. So let's see, this is a 100% known once the installation is completed. Now you can see what happens. So let me just skip camera and cities and to focus on the stock. So once the installation is done, the Raspberry Pi, it's supposed to reboot automatically. We don't have to do anything. At this point. I still have the mouse control, but it's just extracting the file system. And the installation procedure is at a 100% level. While the installations going on, you will also be demonstrated with lot of features of raspberry pie over here. And now the Raspberry Pi, we'll reboot, see the message OSs installed successfully. You just have to click OK here. And then the Raspberry Pi reboots. And we'll just move my camera WIC. And now you can see it reboots. The Raspberry Pi symbol shows the core, core processor previously that there was only single processor, a single raspberry, same molecules to come over here. Now expounding on this default time boot of raspberry pie, the name of a written system, it's a vast Bian. Now as you can see, we directly get a desktop environment over here. And it's giving me welcome screen. And it's a wizard to get Saturn for setting it up. So let's click Next. Now it's asking me the country that we are living. So let me select the country being NGO. Some from India that the language I want to have to my computer is English times on it's called Qatar export. My time zone is you have to use whatever region you are right now into and then click Next. Exciting the location was the location itself. It will ask us to change the password. Now that being formed IB for us verify the username and the password is rusty. And almost every time whenever you power on the raspberry 400 or installing new version, you are supposed to change your password as a tumble through what I do in all my computers. If I choose the password to be fine, that is P II. It's up to you what you choose. For me, what I have chosen this pi, as you can see. And then just click Next, then the setup screen is there. You just have to click next. Then it will search for Wi-Fi networks. And you can connect to the Wi-Fi network, like the one which we have shown here. So let's connect it that I have it here. I'll enter the Wi-Fi MAC sludge. And then it will connect to a finite well, after connecting to the Wi-Fi network, there are a few very important instructions I would like to do. So upgrade the software right now, we don't need it so you can just skip it and setup is complete. And now it's asking us to restart, did us, Phillipa. So before starting, I will click letter here. And I want you to do some things before proceeding ahead. And that is open the terminal. Now I'll just the camera a bit closer so that you can have a nice sort of view of the terminals that I'm going to type, the commands that I'm going to type. So what I want to do here at this point is I want to enable some interfaces which are important for me to connect to the Raspberry Pi to laptop. Now, extract seem very properly. So let's me just hold it like this. And the command I want to use it pseudo ASP pi dash, config. The significance of this commands will be explained later. Just go through it. So it will open a Configuration window like this. Or to do is go to interfacing options on here. Using keyboard will do SSH over here. And then would you like this? Is it server to enable clicky us to it? Not clicked but to use the keyboard option. Then again go to interfacing options and then go to VNC and then simply enable the VNC server as well? Yes. Okay. And then finish. Now, your Raspberry Pi, a setup, it's completed. What you can do is you can simply give a command, sudo reboot also dropout off, power of meat on your system off and reboot will simply reboot your machine. So that's about it for this session guys. In the next video, we'll see how we can connect it to remotely using a laptop. So I'll just sudo reboot and stop decision here. Thank you. 8. Remote Control of Raspberry Pi Using VNC Viewer: Now here I have a rebooted my Raspberry Pi, and as you can see, I can access it. There are several options over here. On the top side. Just like a Windows computer or any other Linux computer, we have the options over here to diming education and all of them. We end events have to go to all the options in detail. But for now what I want is I don't want to stick to the monitor all the time. And for that sake, what I've done is I have installed the SSH and VNC onto my Raspberry Pi, using which I can access it using my laptop screen. For that said what I wanted to do is I want to software on my laptop called VLC viewable. So just go to this page. Google such VNC, you just go to this page. Here, you can see the different operating system versions of VNC viola. Do not forget to download VNC viewer. Okay, don't download VNC server. We needed VNC V1. So just select Windows or Mac or whichever operating system you are having and download of NCBI viewer. Once you have downloaded the VNC viewer, What do you want to do is you want to connect to your Raspberry Pi directly using the laptop. And for that set, you need to know your IP address. There are multiple ways to know the IP addresses of raspberry pie. The simplest one is to just hover over this Wi-Fi connection. And you can see W LAN configured 192 dot 168 dot one, dot 101. That's the IP address. You can see when I hover it, it shows me one dot 101. Second option is you just open a terminal and type a command. If config, IF, IF Config CON F, I, G. So let me just hold it close. So it becomes visible properly, okay. And then enter. So after Enter you can see W LAN 0192 dot one, dot one dot 101. That's my IP address. So I know this and I have the VNC you learned about earlier. No. So all I have to do is just open VNC viewer on my screen, laptop screen. Nor forget that your laptop and you had asked me pi should be connected to same by finite 12. You have an Apple del b and c Solver, which we have done in the previous step. So this is my PNC viewer, and I'll put the IP address. So what here? 192 dot 168 dot one, dot 101, that is the IP address of metals 3D pie. Now, just continue over here. And give the user name and password of your Raspberry Pi. If you remember, we have changed our parser to pyre and the default user limits by itself and just click OK. And that's about it. Now you can see this is the entire desktop of Raspberry Pi made available to you on your laptop screen. Very easy access. And you can also see as I'm moving the mouse on my laptop screen. The same is also moving here on my Raspberry Pi computer connected. So no numbers, whatever I do, whatever done, I'm going to demonstrate all then we'd be demonstrating it on my laptop scheme. It is only happening on the Raspberry Pi computers. About the point O. And here, if you haven't missed anything, just a deeply the video again and you would understand what I have done here. So what I am doing, I will also demonstrate to you, once again is what I am doing is I have taken a remote control of that ASD by display onto my laptop. So whatever I do on my laptop, as you can see, incident pitted unmet phosphine. So if I open something like programming and Jenny for example. So it's opening on my laptop screen you can see and the same. So before the refocusing and the same is that on meta SVD by computer. So it's a completely more control which again use now. And for all the following exercises that we're going to do. Thank you for watching this video. Now here I have an image, might unsteady pi, and as you can see, I can access it. There are several options over here. On the top side. Just like a Windows computer or any other Linux computer, we have the options over here for timing education and all of them. We end events have to go through all the options in detail. But for now what I want is I don't want to strict to the monitor all the time. And for that sick, what I have done is I have installed the SSH and VNC onto my Raspberry Pi, using which I can access it using my laptop screen. For that same what I want to do is I want to softer on my laptop called VLC viewable. So just go to this page. Will such VNC viewer. And just go to this page. Here, you can see the different operating system versions of the VNC dealer. Do not forget to download the NCBI viewer. Okay, don't download VNC server. We needed VNC, v1. So just select Windows or Mac or whichever operating system you are having and download a VNC viewer. Once you have downloaded the VNC viewer, what you want to do is you want to connect to your Raspberry Pi directly using the laptop. And for that set, you need to know your IP address. There are multiple ways to know the IP addresses of a Raspberry Pi. The simplest one is to just hover over this Wi-Fi connection. And you can see W LAN configured 192 dot 168 dot one, dot 101. That's the IP address. You can see when I hover it, it shows me one dot 101. Second option is you just open a terminal and type a command. If config, IF, IF Config CON F, I, G. So let me just hold it includes so it becomes visible properly, okay. And then enter. So after Enter you can see W LAN 0192 dot one, dot one dot 101. That's my IP address. So I know the IP address and I have the VNC you learned about earlier. No. So all I have to do is just open VNC viewable on my screen, laptop screen. Nor forget that your laptop and you had asked me pi should be connected to same by finite 12. You have an AMOLED del b and c Solver, which we have done in the previous step. So this is like the NCBI viewer. And I'll put the IP address over here, 192 dot 168 dot one, dot 101. That is the IP address of metals to define. Now, just continue over here and give the user name and password of your acidify. If you remember, we have changed our password to pyre and the default username, it's by itself and just click OK. And that's about it. Now you can see this is the intent that stop of Raspberry Pi made available to you on your laptop screen. Very easy access. And you can also see as I'm moving the mouse on my laptop screen. The same is also moving here on my Raspberry Pi computer connected. So no numbers, whatever that I drew, whatever that I'm going to demonstrate, all of them will be demonstrating it on my laptop screen. It is actually happening on the Raspberry Pi computers. You got the point over here. If you missed anything, just play the video again and you will understand what I have done here. So what I am doing, I will also demonstrate to you, once again is what I am doing is I have taken a remote control of that ASD by display onto my laptop. So whatever I do on my laptop, as you can see, it's repeated unmet phosphine. So if I open something like programming and Jenny, for example, starts opening on my laptop screen, you can see. And the same, sorry for the refocusing. And the same is there on mastery Pi computer. So it's a completely mode control which you can use now. And for all the following exercises that we're going to do. Thank you for watching this video. 9. Install OS using Raspbian Image part 1: Hi there. Now that we have seen the installation of Raspian on Raspberry Pi using the nubs approach in this session. Now what we're going to see is how we can install the operating system using the other option which was available to us over here. So let's go to Downloads section and the other approaches Raspbian, understand one thing what we have done with Snopes is we have installed the operating system Raspbian itself onto the computer. But it was easy installer for us to understand. Raspbian. Over here is a direct image of the operating system which you can download. And you can directly write down that image onto the memory card. And whenever we insert in America den in your Raspberry Pi, it will automatically start. There is no installation process needed. All you have to do then simply click on Raspbian over here. Then it will show several options. As I have told you Again, I'm saying you choose the one with the desktop and all the recommended software. So I'll use this Raspbian Buster with desktop and recommended softer. And then simply click on Download ZIP. So it will start the zip file. Now loading, I will not do it because it's quite huge, 2.5 GB. And I will open the one which I have already downloaded. So it allowed a big file of 2.5 GB over here, just like the loops. But this time it's a completely different thing. It's an image. Now what I have to do with this image, again, I will have to extract it to a folder. But the difference is after being extracted, the size of the image would be quite huge. Lets see what is the image size and what we have to do with it. What you get out of it is a complete image file, which you can directly bonded onto the memory card using a software like many people prefer each other. Let's hear. What I personally like is win32diskimager. It's a very simple and very lightweight utility to use win32diskimager, and that's what I use. So just download the win32diskimager. Or if you're comfortable with each other, then you can nominate each other as well, but it's heavy. And that's why I prefer win32diskimager. And what you have to do then is you have to take your memory card. Now, use the same memory card down and connect it to a computer. Once the memory card, it's connected to the computer using a card reader, what do you have to do is you have to format it. So I'll connect a memory card to computer now. Gets connected. And then using the same ESRI format and I'll format it. Now you can see I'm in started as very pion it before. And once the Raspberry Pi's installed, it creates two partitions of it. One partitioner in something which you can't access. And the other particle partition is boot, which you can access, but it's smaller than one. So this is done in the notes installation automatically. Now what I'll do now is I will formatted SD card for matter. It will become one. This two drives will become one. So let's format. And it's done. And now you can see I have a single 16 GB drive ready for me. Now, my extraction of this image file is also done. So let's go into this and you can see an image file is generated. If you see the size of the 6.34 GB. And what do you have to do is open win32diskimager. And here all you have to do is drive later is to be selected, which in most cases will come automatically. This is the letter of your memory card drive. Let's confirm it one small f. And then here you have to browse for your image file. So let's click this button, small button over here. Then in the downloads, in the compressed folder, I have Raspian Buster full. This is the folder and this is my image file. So I'll just select this. And I'm going to click on it right. Now this is a 6.5 GB image which will be completely burnt on written onto the Raspberry Pi, onto the memory card. And the process is a bit different than what we simply copy and paste. So it will take some time. Again, depending upon the memory card that you have. As I have a class stem memory card, it will give me a decent spear. But still it will take some time, which adds shown is approximately 20 minutes, is what is needed. Once the downloading is completed, once the writing it's completed, a message box will be shown to you, which shoots or which will read it like the image lighting and successful. And then what we have to do is we have to remove this memory card unconnected to us, very Pi computer again. So let's went from this to complete. N will proceed further ones, they'll cover writing, it's turning. Now as you can see, the image has been written. Simply cancelled his messages, close them and dose, as you can see, light successful at this one, just click OK to close them into two daughter skimming. And then simply remove your memory card. Now we'll see how we can boot image using a big computer in next video. 10. Install OS using Raspbian Image part 2: However, now I have written the image or the demand Ricard using into Asia. And I have this inset of Olivia, which I have used thought loops. So what do you need is an HDMI, Tunisia and Morocco, and a keyboard mouse use Wiki mobiles. So this is a wireless keyboard moles. And then what I'll do is I'll simply, and this man regard and lastly Deepa. And then I will simply parallel on. So heals much as shopkeeper. As remember it it was like a USB because it's soap I3 version. So let's reload. And let's put it over here. And so there's a dynamics problem to reach. Now you can see the Raspberry Pi directly books. It won't show Independent installation, scream, Look, switch. And we can see. And let me start with the operating system itself. But let's start with instructions and then remember saying, help us get up whole Confederate, hopefully nonetheless, HPLC, how to connect it to Wi-Fi. And how much is the password? The same process and repeat the same americans can and will deplete as you can see. Now, this is, so now you have an idea of a bullet didn't move standard Austrian away off installing, operate insisting. You plenty of which ever it's preferable to you. But I recommend you as a signal to have a monitor with you all the time. People follow the installation. But you can also perform the institution. We don't want to go with ostium Washington. So let's examine some video bags and I hope you have understood it. Well. If not, just repeat, the videos are once again solving for all the loops, downloading and then see for cleaning the dogs. If you still have some dose, then do not hesitate to shoot me a question. Thank you. 11. Getting Around Raspbian Operating System part 1: Hi there. In this video, we'll see how to get started with the raspberry pi. What is the operating system and how we can use various commands onto the terminal of Rasberry Pi. So let's get started with this video now. First of all, let's open VNC viewer. We have seen in previous videos how to connect to the Raspberry Pi using VNC viewer. So I have this IP address of my Raspberry Pi's saved over here. So lets just double-click this and it will log me in to the Raspberry Pi. So I have changed my password to be pi. And let's check mark this box. Remember password, and click OK. Now you can see the Raspberry Pi desktop appears as it is completely onto my laptop screen. From this point onwards, we can use the Raspberry Pi as a completely different but a full Linux computer. So let's see what it has got. First of all, you can see there is this button, like the Windows button we have in Windows Start button we have. So this one is a start button in the US, very pi. And it opens up a drop-down menu. As you can see, you can have multiple options over here. So in programming, you can see there are a number of different softwares installed. Education, Office, Internet, Sound and Video. Lots of softwares are there, which you will see when you start the computer. Just besides It is the option to open a browser, then a File Manager, and then a terminal. Now, let's see, by opening the terminal or the file manager first. Now if you're acquainted with the Windows operating style in which we have this PC as a default thing where we start to use the computer. So it lists all the drives as well as the documents. In the same context on Raspberry Pi, we have something called as this over here. So this is called as a root location of a Linux computer. Now, every computer which is made onto this architecture, the Debian architecture will hold the same file system with no change, almost no change at all. Several folders would appear or not depending upon the OS version that you have. But for Debian, Ubuntu, Raspbian, more or less the root structure, it same as you can see, these are the folders. Now been boat Dave, all these formats remains the same and the same at different set of folders. We can spot a folder called home. And inside home we have spotted a folder called by. This is the folder where the user space of the user pies available. So whatever files we create, whatever data we want to save, it will be saved into this particular location. So this is how you can navigate to different folders. So the file manager, this is home and this is in the same way, whatever you do from the phi Manager, you can do so through the terminal. Now let's see what is terminal and what is the importance of terminal in Linux. So this is the terminal. It opens up by clicking this terminal icon. Or you can simply go for keyboard shortcut Control t. That will also open up the terminal control alt t. It's not opening now because we are on the VLC viewer, but it will open directly when you're using it on the Raspberry Pi with the connected keyboard. So that is the terminal over here. Let's try to understand some commands of a terminal. The very first command we'll see it's called debts ls, just type ls and hit enter. As you can see, after anything, unless there is a list of some files and folders. Now, if I open the file manager, I'll close this instance. And if I open the file manager, these are the same folders which are seen in the File Manager as well because the File Manager by default, open sin, home slash pie. So audio taste bluesy. These are my experiment folders all over here. So you can see the same indeterminacy. So audio taste bluesy, 1.The two. These are the files. You can navigate to any folder or you can create any new folder over here using a command called MKDIR. Let me create a folder, ABC. And you can see there is a small change observing here, and abc is created. I'll go to ABC from phi manage over here. And I'll go to ABC from terminal with this command called cb, cb, space ABC. Now I'm into the same folder as my file manager aids. Now will again create another folder with MKDIR. And this time I'll just give it a name, XYZ. You can see the XYZ folder is created. Let's go inside it here as well as here. So I have to give now CB XYZ. Again, let's create a folder, MKDIR AB, C, D AB, MKDIR, bb. And then CD Baby. This is how you can navigate inside a folder through terminal. Whenever you have to come back from that particular location, you have multiple options. The first option is coming back directly to home location by giving a command CD. So just type cd and hit enter, and you are now at a home location. Now how to know if I'm at home location, just simply do LS. And you can see the list of files and folders. Now again, let us go back to the same location CD. Now you can go back directly to that location by giving ABC. Slash XYZ slash slash BB. And now we come back to that location. Now, you can also come back one location at a time from the folder structure. Let's see how to do that. So cd space double-dot. I came back to a, B, C, you displace double-dot. I come back to XYZ, cd space double-dot. I come back to now ABC only and see the space double-dot. Now I came back to home. So that's my home location. As you can see. Now. There is one very interesting thing to do, and you can also experiment that. So if I create a new folder for tried to create a new folder here with GUI, let's call it the ZZZ Zombie. I created a file. I wanted to create a folder. Since if the file exists, so Folder can't be created. So greater folders CCC. And you can see this is it's created nine find client to do the same thing. Indeed root location. Then see if I can do it. It says Edit recreating permission denied. Let's try to do it to terminal. So to go to the root, what do you have to do it cd space, forward slash that sit. So forward slash. Forward slash is the root location in a Linux computer. So just give you the space forward slash. And now you are introduced location. There won't be any change over here in the address that it shown. But to know it, you can see here there is a symbol and here we have a simple root symbol. Let's do ls. And you can see that Luke location folders. Now let's try to create a folder here. Mkdir ZZZ cannot create directory permission denied. It simply states that even the user itself is not having any access or any privilege to directly create a folder in the root location. And in order to do that, what do you need to do? It's unit to give the user some extra privileges. In Windows, we call it as administrator privilege. Here we call it as giving us super user permission. So how you give superuser permission to any command that you execute by simply appending pseudo in front of it. So just type sudo and then give ZZZ and hit Enter. Sorry, pseudo MKDIR because I'm going to add is the command and then triple C. And the folder is created. Now, the same won't be immediately reflected over here in the root directory. But you will see that once you rebooted. So now you have created ZZZ. You can also cd into that, and you can also create a new folder. Again, MKDIR is df give me issued. So I have to do sudo, MKDIR, SDF. And I can cd into a SDF and swell. Using the same structure. You can use pseudo with any command to give it some extra privileges or superuser privileges. It simply means that you know what you're doing and if there is any harm happening to your computer, you're completely responsible for it. So that's about the file structure that we have here. In the next video, we'll see some more important commands of Rasberry Pi. Thank you for watching this video. 12. Getting Around Raspbian Operating System part 1: Hi there. In this video, we'll see some of the most important or some of the most widely used commands of raspberry pi. And of course this we will some of the commands, okay, so there are plenty Winnie commands over there. But just to continue with the learning will see some basic commands which will help us in the further learning. So let's get started with this video. As always, just type or just open the terminal by clicking on the terminal. So what we have seen is real sin ls. Then we have seen CD, then we have seen MKDIR, For example. Now apart from these commands, if I have to create a file, what can I do? So let's see abc. So let's be inserted the ABs, okay? And let's try to create a file. So to create a file, we use a command called Touch. So just like touch ABC or touch my dot TXT, you have to give the file extension as well. And now you can see my dot TXT has opened. Now to edit the Maya dot TXT or to put some text into it, we have several options. First of all, on the terminal itself, we have an editor which is most popular and we call it as nano. So you can open the created mydata x2 using nano. So nano mydata T x T. And it will open a particular editor. Now this is not a GUI editor, so your regular mouse commands will do nothing here. Let me just type some text. Hello there. This is my first file created on sweetie pie and loving it. Okay. Now, whenever you do something on nano, whenever you have edited some text on nano, The only way to save it or to exit it is using some keyboard shortcuts. You can see these keyboard shortcuts are to be used. So we'll get to know them one by one as we move forward. For now, let's try to exit the nano by giving control plus x. So these are all control plus commands. Okay? So here I have to exit nano, so I'll just give control X. Now it's asking me, do you want to save the modified buffer? You can give Y or N over here. Answering Nobel discard and answering yes, we'll save it. So I'll just type vile. Now I have typed while, so it is asking me which file to write. So I have to write the same file, mydata DFS tree. So I wouldn't change the name and I will simply hit Enter. You'll have to try it a couple of times to get hold of it. So you can simply see nanometre x three. Now you can see some text over here. I'll add some more. Some more texts with nano Control X. Y. Enter. Now isn't the only way. No, definitely not. And there are some nice GUI editor as valid depending upon your Raspberry Pi distribution. Go to the accessories and C for the text editor. So this is a simple text editor that we have. It is called as mousepad. So you can also put your file width, mousepad, my dot TXT. And you can see a GUI editor is open for you. Similarly, there is a very popular editor called V VI space, my dot TXT. So V i is also a command line editor, just like nano. Got it. Now, to exit V, they did some different mechanism and you have to type control c. So this is the command not Control-C. So colon you. So there are various parameters of VI. I don't use VI much, and I prefer using nano whenever it comes to command line editor. Otherwise, there is a GUI editor called mousepad in your Raspberry Pi. So you can see we have cluttered our terminal quite a bit. Let's clear the terminal with the command. Clear. And now my terminal is cleared. Let's try to see how we can delete the files and folders. So let's come out and delete this entire ABC folder. First of all, let me create an empty folder, MKDIR, GZ, for example. Inside a, B, C, I created a folder called GZ image. Now I use the command RM. Zincit. Now cannot remove because it's a directory. Now why this particular command is used? This particular command is used to delete a file and not a folder. So to remove folder, you need to use remove. But let's first tried on a file. So touch to delete 2.txt. And we have to delete dot TXT here. And let's try to delete 2.txt. You can see to delete dot TXT has been diluted. So to delete a particular folder, we have to give up m dash. Dash r means you are asking the folder and all its contents to be removed completely. So let's try it on ABC itself so that it has folder and files as well. Let's see how it works. So cd space double-dot. Let's clear it once. Now. Rm abc will not do anything because it's a directory and it contains some files. But if I had to, RM dash R, ABC, ABC is here with all its files and folders, but dot dash r does wat dash R is a flagging Linux which says recursive. So it will apply not only on ABC, but everything that is there inside the ABC. So let's try to run it. Abc has been deleted completely, as you can see. So let's try one more thing. That is C, D, D, ten times. So just type date. You will see the just type time. You will see the time. So this is not the actual time, so time is available here only. So Monday, January 27, it in 3224 and it decides to 20-20. So this date gives us the required information. Time. It's interesting, let's see, time-space stripped. So what it basically does is it tells us the time required for executing a particular command. So time MKDIR, Tbc. So that's the time it requires to create. So date will give you the date, the current date, clear, really completely clear out your screen. You know what MKDIR does and how you can navigate through different folders. So that's about it for this video, guys, hope it will give you some foundation of getting started with Raspberry Pi, and you will find it easier to execute the commands. Henceforth. Thank you for watching this video. 13. Getting Around Raspbian Operating System part 2: Hi there. In this video, we'll try to see how we can update and upgrade the software packages which are installed on to Raspbian operating system. Now, you have to just open the terminal and you have to type a command which I am asking you to type. And to do that, let's start with installing a software onto Raspberry Pi. Now there is a software that is a command line-based software called SP, which is a text-to-speech library or a text-to-speech software for the Linux computer. And let's see how we can install it. So the command for installing a software, known software on Raspbian, it's pseudo. We'd have to give pseudo permission to install this software. App. Hyphen gate install is speak. Now this will install this particular software onto my, thus very packed. So let's enter and see what happens. Is because already the latest version, it means what the SBIC is all readily available onto my computer. But you can attempt to install the software with the same command, sudo API to get installed. Genie. Genie also is there. So it's not been installed. So with APT get, what exactly we are doing is we are searching the internet for any existing resource. And the same command, we'll download that resource as well as install it completely on our system. For example, let's say in the programming, what we don't have, and we'll try to install something over here. So let's Google search for installing something. So whenever you try to install something, you can simply search for it. So they're modes, a browser in Raspberry Pi previous version. So medullary install on Raspian. I'll just search for it. And let me see what I come up with. So there are some series of strips that you come up with. Usually whenever you try to search something online. And then you see some commands like this. Soda IPT, get install, medullary. So let's try this. It's just a browser, so no worries using it. Soda equity get installed, medullary, sudo apt, get install, MID URL. And it's installed. On the installation starts. So here if I give y, it will download the medullary and install it to the computer. So it takes some time, depending on your internet speed, and install some software. Now if you look for the official documentation of Raspberry Pi. So Raspberry Pi, APT Git. So you will see all the detailed instruction, what equity is, and how you can install something with this command, and how you can remove something with this command. So APT remove, can install it. And a pity get. So APT removed, we'll remove this after and it will install the software for you. Let's see if the inventory is installed. It's going on. Now MY door is installed. If I type simply Missouri should open a browser for me. That's the modality browser. Similarly, pseudo APT git remove medullary, will remove a Dory from my computer and to update the resources now have to give y here to update the, the sources where the Raspberry Pi's looking for this software, we have to use a command before doing anything on the US very pi. And those commands, those two commands are the soda EBI to get update and sudo apt-get upgrade and update will update the repository list or the list of softwares in the Raspberry Pi. And upgrade will actually upgrade all the packages that are previously installed. So upgrade is not often required. What you need to do is you need to do update. And that's for sure you have to do whenever you have a fresh installation of raspberry pi. So let's go to the US. Very pie meter is removed. Now let's do sudo APT get update. Remember whenever you have a fresh installation or whenever you are using Raspberry Pi after long time, then it is a must thing to update your Raspberry Pi first and then only download new packages, because there are new packages added almost everyday. And based upon that, you might have read a blog or you have really some information. If your repository, if you're a software list is not updated well, then you may not be able to install dot software, so it's better every time you use the Raspberry Pi after some period, then update your Raspberry Pi. So the API to get update has done for me. Now why it's done in so small time is because it must have been recently done a couple of days before if I set up the Raspberry Pi. So that's about it for this video, guys, do not forget to make sure download or update the Raspberry Pi isn't a pity get command and just try out with this particular link over here. So it is the official documentation about what is APT, that is advanced packaging tool for Debian and try to install some softwares at stated. Thank you for watching this video. 14. How To Run Python program On Raspberry Pi: Hi there. In this video, we'll start studying programming with Raspberry Pi and see what are the different programming languages which began use on the Raspberry Pi computer. So let's get started. As always, what I want is the VNC viewer to view the Raspberry Pi or desktop on my computer. So I have this address saved over there, that's the IP address of my Raspberry Pi. So let's double-click it. And the Raspberry Pi, we'll start in front of you. Now, as you can see in the start menu, there are a number of different options in programming section. So ordinates something I have installed. But by default there is blue Java, Jeannie, green food Java loaded, then Python three, and number of different editors available. Depending upon which operating system you have installed, you will find the options are a bit here and they're different, but more or less they would Missing. Now what we want to do with Raspberry Pi is want to study Python. And to study Python, what we do is we use an IDE called funny. So just like Tania on command prompt and hit enter. And you will start the IDE for Python. It looks very simple. Just like this. And whatever you want to start writing, you can simply take a new file and start writing a program. Now, remember throughout this exercise and all the other exercises that we're going to do throughout this course. We're going to use Python 3.7 as our programming language, basically Python three, we are not using Python two. And for studying in detail about Python three, you grow, of course, definitely look at the other videos that I have, which will clear or which will clarify all your basic concepts about Python programming. So let us see some simple commands over here. So what I want to do is simply print hello world, so I just write it down like this. Lets save this program on my desktop for example. And let me call it as hello. And submit click on this Run button. So this is the Tony ID. So just like print hello world, and then button. This is your output. Similarly, like if you want, you can accept a number is equal to inch and enter a number and print the number. You have entered. Aids comma e. So these are some basic Python programming structures. Don't worry, all the programs that we're going to do will have a very simple syntax. So even if you don't know math and programming before, it simply doesn't matter. You can of course, go and watch some videos, but it is not mandatory to know about Python software then this logjam, the prompt shows me like this. Enter a number, I have to enter some number here. So let me enter 234. And the next line gave me the answer. The number you have entered is 234. Now, if I want, I can have another number and put like this and tells second number. And then I can simply perform addition like this. As you can understand, there are no declarations required in Python for declaring variables for using. So I have not declared a to be an integer or c to be an integer or anything. And just accepting the impotence integer and the a will automatically be treated as an integer variable. C, It's consisted of addition of two integers, and therefore, C will automatically be assumed as an integer itself. Because the whole Python programming is an interpreter driven programming. So we don't have to explicitly declare the variables. So the addition is here. I can just print the addition is C. So let's run this code, 4554. That is ten. It's time to name and showing some very simple things which we are going to use in the Python programming for IoT. So it will also include comparisons. If a is greater than B, then there is a colon. After the colon, a Python program comes one intent ahead. And whatever you want to execute here, you can write it down like this. So a is greater than b. And it's again colon. B is either greater than or equal to. That's how you can use conditions in Python programming. Let me run this script again. Let me give us number 34 second number 15 for so the addition is 88 and b is greater than or equal to e. Just like that. You can also add conditions with each other like this. If a is greater than 1000 and a is greater than a 100 and then only it will execute. So let me just try this one over here. If it is not greater than a 100. And if it is greater than b, then also this program, and this program also wouldn't be executing. So this is all Python programming syntaxes. So enter a number, let's say I'm adding 23, me is just five. So the addition is 28. But since the second condition is not true, my problem is leaving MID wrong output because I have just put an else condition over here. Now depending on what the exams you're doing, you'll have to do a little bit of practice on Python programming in order to understand it better. For your information, I am giving you a link to the available free videos I have for Python programming introduction, which you can go through and get to understand about the Python for any further exercises that we're going to do. For now, I'll just stop this program with this button and I'll close this editor. Now similar to autonomy, we also use to use an IDE called idle previously for Python. But from the latest version of Raspbian operating system, the officially supported of anneals Tony ID. And therefore, throughout this course, we will be using funny IDE only. So that's how you can start understanding about programming with Python. Of course, there are a number of different things over here, and it is recommended that you go through them. For example, the elisa, Blue Jay Java IDE. Now I'm not much into the Java programming. Otherwise, I would have given you some lesson or some interaction about Java. But frankly speaking, I know nothing about Java. So I went to brag about it. I'm just showing it to you by opening that, something such as available. So lets see. So this is an ID, particularly for Java. And talking about the programming languages. Any programming language which can run on Linux based operating system and a computer having ARM architecture will turn on us vary by. Now. It can be Java, it can be Python, it can be NodeJS, You can be anything. So this is how you can start with the project on Java. With Bluejay. Based upon venue installed the operating system, you will see more options over here. So there is also a greenfield job ID and a lot of things are there. There is also complete Microsoft. No, sorry, not Microsoft but a liberty office suit installed, which you can start using for the Office applications. You can start writing and editing the Office documents with it. There are all the software is installed. Libreoffice by default into it. So writer, Mat, Empress, drop, Kelsey base. All of them are available, which are most commonly used. So that's it for this video. Practice a bit on Python before getting started on, before proceeding ahead. If you know something about Python, it's okay. If you don't know anything, I'm giving you the video links to understand about Python first, and then you can understand the further Programs. If you're confident enough that we'll figure it out, then also you are welcome to proceed with the further programs. And if you face any problem understanding the syntax or logic, I'll be explaining to you. Thank you for watching this video. 15. Raspberry PI GPIO Concepts: Hi there. Now that we have seen how to boot up the Raspberry Pi and how to start using it using your laptop and the VNC viewer as a remote control. Let's move forward to actually understanding the general purpose input output pins on the Raspberry Pi. Because these are the pins which enable us to connect any real-world device to the Raspberry Pi. Let it be LEDs, let it be switches, or a number of different sensors. We can connect this peripherals to Raspberry Pi using this GPIO or general purpose input, output port of raspberry Pi. Let's see about the GPIO Raspberry Pi in detail. If you look at the Raspberry Pi, you will notice that there is this kind of a complete 40 pin general bypass and put out puts connector available on every Raspberry Pi that you have. Out of this 40 pins, some are power pins, as you can see, 3.3 volt, five volt, five volt, ground. There are multiple 3.35 volt and ground pins everywhere in this 40 pin connector. So let us first see out of the 40 pins, how many are actually the power pins? As you can see, this is the first one in number one, that is 3.3 volts. As you can see, this one is over here. Then we have ground. This is second, third, then we have this one here, fourth, then fifth. After this phi pins, you can come around over here and you can see this one is there, 6789101112. So we can see out of the 40 pins, we have a total of 12 pins as powerline, what will remain now, it's 20. Now out of this 28 pins also, if you can see this is a number 27, that is id. And this is pin number 28, ID SC. Both of these pins are not used as GPIO. So we further reduce to out of it and what will remain with EFS 26 pins. So we have this 26 pins on the Raspberry Pi, which can be used as general purpose input output pins. Those are labeled like GPIO2, GPIO3, GPL for 1722 and so on, lot of Windsor there. So we have a total of 26 pins which are available for using as general bubbles, inputs and outputs. You can also see GPIO2 34. They have some more function written in the bracket or the soul will see about this additional function letter on right now we're just concerned with the GPIOs that we have, which are available for us. So you have a total of 26 pins available to which you can connect any type or any real-world device sensor LED on for that matter, anything that you want to connect. Now we have to understand how we can use these pins through Python programming and how we can write some signals onto it. So let's see forward. But before moving forward we have to understand how actually this 40 pin GPIO, it's to be viewed when we have our Raspberry Pi in our hand. So let's see here. If you have a Raspberry Pi in your hand like this, then if you look at the right-hand side, the very first pin from left in span number one, the pin exactly deciding it spin number 23456 up to 3940. So this is the 40 pin GPIO. If you have a previous one, which is very less chances are there that you have a previous Raspberry Pi, but in that case it has a 26-bit GPIO. So this is what we are interested in to the 40 pin GPI and this is how you have to see it. So if I ask you to spot GPIO t2, which is this spin over here. If I have to spawn GPIO2 on to the Raspberry Pi, then it has to be this spin. If you can understand what I'm saying. Ok. So this is how you can spot any pin as you want. For example, this over here. And similarly, whenever they say we have to connect something to GPR 21 for example, it means you will look at bin number 40 right over here. So this is how you will understand which pin is, which GPIO. There is also one more confusion, but we'll avoid that. And that is, you can access a pin either using GPR 21 or using pin number 40. It means you can access a pin bytes name or by its PIN number onto the board. We generally prefer. And across the globe, all the developers prefer using the GPIO name, that is GPR 21. And for this course, for this video, we will be following the pin number only 020211612, like that. So this is how we have to understand about the GPIO of Rasberry Pi. Now let's see how we can use a particular GPIO pin adds a pushpin. Now, this is how we are our GPIO, it's located and this is how we have to understand the pins. Let me tell you one very important thing about Raspberry Pi. That Raspberry Pi, it's operating on different logic levels than Arduino. So for Raspberry Pi, the logic one equals to 3.3 volts. And logic 0, like always, it's 0 voltage. Why I'm telling you this is because if you are aware about Arduino, then an Arduino, you might remember the logic one is five volt and logical 0, it same 0 volt, but Raspberry Pi generates 3.3 volt as logic 10 volt as logic 0. Similarly, whenever you are giving inputs to Raspberry Pi at that time also you have to accept, you have to give only 3.3 volt or maximum 3.3 volt as input. On any of the GPIO lines, your input should not exceed 3.3 volt. And whenever you give anything as 3.3 volts input, then it is treated as logic one. If the input given it's 0, it is treated as logic 0. Logic one is also called as logic high and logic 0 is also called as logic Lu. Now let's see how we can connect a real-world hardware to Raspberry Pi GPIO and see how we can make it on or make it off. So basically what we are going to see now is how to use a general purpose input output pin working as output when. Thank you for watching this video. 16. Raspberry Pi GPIO Interfacing Single LED: Hi there. Now let's see how we can use the GPI of Raspberry Pi to generate logic output and to generate the logic output. Let me show you something which is very fundamental and very basic. Whenever we are generating any logic output from any micro controller or microprocessor device. And what we have to understand here is that how we generate a logic output to turn on or turn off an LED. Basically just like there is a Hello World program in any programming language and embedded computing, the HelloWorld program, it's set to be LED blinking program, a program in which we simply turn on and off and LED by using software. So this is how our LED is. This particular pin of LED is denoted as anode and this one is denoted as capital. Once we have analytical models, let's take a resistor with it. A resistor is a passive component, and hence it doesn't have a polarity, whereas LED has a polarity. So the anode of LET must go to the positive voltage and the cathode of LED must go to the negative or ground terminal of your voltage. So let's connect an LED and resistor in series. Let us take a small value resistor like 330 on. The connections should be like this. So this point of resistor should go to ground off Raspberry Pi. And this point of LED should be going to any GPIO off Raspberry Pi. So this is how our socket connection should be. If you have to make a Raspberry Pi pin turn on and turn off an LED. Now if you have made the connections like this, then writing logic higher or writing logic one onto this GPIO pin will generate 3.3 volts. And because you generate 3.3 volt here, so logic one equals to 3.3 volts. So when you give a logic one or logic higher, the 3.3 volts generator onto the spin will turn on this LED. And similarly, let me copy it. Whenever you generate logical 0 onto the spin, it will generate 0 volt. Thereby, it will simply turn off the LED. Many of you might be aware about this structure, but for those who do not know about it, and particularly showing it in this video. So that's how our connections should be, that's how our program should be. Now let's see how to write down a program for it. Now before that are before writing any program, it is important to install these libraries onto Raspberry Pi. As I told you in the previous video, the update is very important and you must do it. Upgrade, however, is optional. And then these are the commands to install Python development and moment Python installations of tr and the GPIO library of the US very panel. Usually what happens is nowadays every Raspberry Pi distribution has this software's already installed into them. So we're not required to run this commands, but still, I'll just try running a command and see what are put it gives. So let's open as always, the VNC viewer and login to our Raspberry Pi. So it will start, it will connect me to the Raspberry Pi. Okay? My Raspberry Pi is not powered on. Just give me a minute over here. So I hunt the Raspberry Pi powered on, but it is appearing on 192 dot one, dot one dot 104. So let's use it. Give the password and username and spine. Remember password. And the Raspberry Pi desktop comes over here. Now let's open the terminal and let's try to run this command sudo. What's next over there? So pseudo APT get install Python dash Rpi.GPIO. So pseudo APT get installed by ten dash R pi dot GPIO. And I've shown you before Python dash Rpi.GPIO is already installed. N is the latest version. So most often you won't need to run these commands. Now let us proceed further. Now, if you have the connections made just like what I have shown over here, then this is the only program we need to write down. Let's see what this program is basically doing. So very first line of the program is ADD R1 is equal to 21. It means we're declaring where my LED is connected on to the Raspberry Pi. I'll show you how to connect it to 21. Second line of the program is importing the libraries. So this is importing the Rpi.GPIO as GPIO. Basically, you can write down anything instead of GPIO. And this is just creating an instance of the library. So I can very well write DM import Rpi.GPIO adds XYZ, but in that case, throughout the program, I have to use XYZ instead of this GPIO. Third line of the program is import time. And this is something very important. The fourth line is GPIO.setup mode, GPIO.output, BCM. Alternatively, we can write down GPIO.setup mode, GPIO.output board. Now what is the difference between GPR dot BCM and GPIO.output board. Let's see. I told you that any pin of raspberry pi can be accessed either using the pin name that is prepared to 3491011561319 like that. Or you can also access it using the exact pin name or pin number of raspberry pi. So if I had to access this spin by calling it pin number three, I had to access this spin by calling it 40. If I have to access GPR 12 by calling it 32, in that case, I will use GPIO.output board. If I want to use the GPIO number or the processor pin number, then I use GPR dot BCM. That's why I said across the world, we use GPIO.output itself, uh, sorry, g VSEPR dot BCM itself. And we never use GPIO.output bolder. By setting the more GPR dot BCM, we are mentioning that we're accessing this spins by pin name. So if I have returned LED V1 is equal to 21. It means the LED should be connected to GPIO 21. The connection should be done with this spin and how the connections should be. Let me show you. The connection should be this pin over here. You have to take a wire from this spin collector resistor, then connect an LED and then connect the cathode of the LED to ground. Now, where is the ground? Let's see, where is the ground? So the ground is available over here. Third pin from the top. So I can just simply make the wiring like that. So a wire should be connected here. And then it will come over here. And so that's how your connection should be made from ground to the cathode of LED. Now, if the hardware connection is made like that, the program we need to write down is this. Now you have seven GPIO.output ECM. Then what we are doing is we are setting up the LED v1 to work as GPIO.output out. Now what this line means is we are actually making the GPIO pin, which is denoted by LED means 21, to work as output pin. So it can generate signals. So it is working as output when now there is a while true loop. Now why would I done while true loop is very simple. Whatever code is executing after this program should run in an infinite loop. That's why we have given file to what is the line of other GPIO.output 11 comma true. So true basically means logic higher. You can as well write down GPIO.output 11 comma GPIO.output. The choice is up to you. You can use any one of these declarations. Then I've given a time delay of 0.3 seconds. So time dot sleep will generate 0.3 seconds of delay. 0.3 seconds means nothing but 300 milliseconds. You can give any value as you want over here. After 300 millisecond what you are doing, GPIO, output, LED one comma false. Gpio.output 11 comma GPIO.output. I personally find this false and true to be simple for me. That's why I followed through on false. You can, I don't GPIO.output or GPR dot lu as well. And then what we do is we give the same 300 milliseconds of delay. What this program will do is it will, as soon as it starts executing, what it should do is it will turn on the LED with this line. Here. It will bit for some time. Then here it will again turn off the ADD. And again, wait for some time. After writing. The program will again go back to the first plan because it is indeed infinite loop. And the same routine will go on and on and on unless you manually stop the program. I think I'm pretty clear up to this point. So let me just do one thing. Let me simply copy this program. Go to the Raspberry Pi and open Tawny Taney's the Python editor. But remember, we are doing GPI operation means we are handling or we are disturbing the processor of Raspberry Pi. So you need to run the command with pseudo, pseudo Tawny. It will open the thorny software where we can write down the Python programs. Now that's opened, the first thing I'll do is I'll close any existing program and then I'll take a new file. Then I will first would like to save it. So let me do one thing. Let me create a folder in my Desktop location. Let us call this folder ads our pi IoT, or simply by experiments. And then I'll save this file adds LED. Now my program, it saved. Now let me paste the program. So pasting may or may not work for you. If you only use the right-click of mouse, then only copy paste should work, otherwise it won't. So that's my program over here. So these are n GPIO high. I don't want it. So let me give hash. In Python editor Tony, or in any Python editor, the hash stands for commenting the program line. So when you hash, it means that particular line is not there in the program. Are also delete this. And then I'll also delete this all over here. Now my program is done. I can simply start running the program. So R1 current scripts, you can see if there are any errors. They will be shown over here. So as you can see, value error or different mode has already been stripped. So I haven't even both GPIO.output, ECM and GPA are not bold. That's why this error game. So we don't want that. So let's comment GBR dot board because we're only using GPR BCM. Now let's run it again. Now the program is running. Here. We won't see anything. Now we have to see the output on to the Raspberry Pi itself. So let's turn over to Raspberry Pi and see what this program is doing. Now as you can see, I have a breadboards over here to which I have connected an LED. So as you can see, the LED is connected in this fashion. This is the cathode. This is the anode of LED. This is a resistor connected with LED. This is a threonine 2-ohm resistor. And so this is the anode point of LED that is available to me. Now what I should do is I should connect the cathode to ground. So I'll need a male-to-female connecting wire. A male-to-female connecting my hair is like this. So one end is a male connector, which can be inserted into breadboard. And on the other end, we have a female connector, which can be inserted into the Raspberry Pi. So let me insert it with here. So this one over here is ground, and this one over here is unknown. Now this is my Raspberry Pi, which is working. And now I have to connect this LED here. So let's turn the breadboard around a bit. So this is, this over here is my pin number 21, or GPR 21. So this is GPR 21. Third pin from the top is ground. So here goes my ground pin. And here goes my GPR 21 pin. Now connected it. And as you can see, the LED is blinking with a delay of 300 milliseconds. Now what I'll do is I'll simply go again to my screen and change the delay and see what happens. Now the first thing I'll do is I'll simply stop the program. So it doesn't matter when I stopped the program. If the entity was on, then it will remain on. And if it was off, then it will remain off. Now I have stopped the program and the illegitimate on because it was previously on itself. Now let's increase this time dot sleep from 0.3 seconds to 1 second. So this is 1 second. And now let me run it again. Now as you can see, the LED is now blinking with 1 second delay. Isn't it simple? And I'm pretty sure to understand this program. There is no need to have any kind of electronics knowledge or any kind of background knowledge. I can very well reduced the program to be 0.1. now let me make it 0.1 and let me rerun the program. Now the LED is supposed to run very fast, as you can notice. So that's how we can connect a single LED with Raspberry Pi when it comes to connecting multiple LED. How to do that? We'll see in the next video. I hope you have understood the concept very well. If not, just repeat the video once again so that you'll get a clear idea of what and how we're doing things here. Thank you for watching this video. 17. Raspberry Pi GPIO Interfacing Multiple LED's: Hi there. Now in this video, we'll see how we can connect four different LEDs at a time with Raspberry Pi and write a Python program to turn them on or off at the same time. So let's begin with this video. Now this time might connections would be like this. So what I've done over here is I have made the anodes common. As you can see. I have made all the anodes common. And I have connected all the cathodes with a resistor and they're going to ground. Now, the configuration can be like this or just to make sure that you don't get confused. The configuration can very well be something like this. It doesn't matter whether you have connected the resistors to the GPIO and LED towards ground, or whether you have connected it the other way. It based its simply doesn't matter how you connect it. The point is there should be a combination of resistor and LED in-between. So let me just make the changes over here because the connections that I have done are like that. So the register points are going to the GPIO France very pipe. Then after the resistor, I have connected the elites and then the cathode of LEDs are going to ground. So this is how my actual connections are onto the breadboard. So let me just make the changes and then I'll show you my breadboard as well. So this is how the connections are. So all the cathodes made a Common going to ground the resistors connected to elites. And the other point of resistors going to GPIO pins. For the sake of convenience over here. I'm choosing the GPIO lines 12162021. That is why the same are shown in this schematic. So I'll connect these LEDs. Length is 12162021. And now let's see what is the respect to change that we have to do in our software. Now here is my software or the program Python program that is running for only connecting one LED. Now let me just delete the unwanted lines. Now as I have d one is equal to 21. What I will do changes in my program IS LED to LED three AND LED foo. Now my program will show like this. Now this is how my program changes would be. So LET one now going to 12, at Sage. 11 should be going to 12, NAD to 16. Then LET 320 and LED 4-2, 21. Now everything remains as it is. But now since I have four LEDs to use, it means for input, output lines to use. Then I have to write the GPIO.setup line four times. This is to make sure all the pins are made to walk as appointments. Nad one LED T2. 34. Now you may wonder why I'm using LET one name here, doesn't matter. I can very well write donuts 12. But what happens is when you have multiple interfaces connected in your program, then it becomes difficult to remember which pin was connected to buzzer, which is connected to NAD and so on. That's why it's a common practice to use the understandable names instead of the pin number directly. So that's how I have made all four pins to work as output prints. Now while making them on the same pattern goods. So where I write down, LET one comma true at the same place immediately after that, without a delay or without asleep, I'll route dumb for LED T2, CD3, and solids LED foo. Here. Again, the same pattern should follow. So anyone come up false entity to comma falls LED three comma falls, and so on. Now this completes my program. Now let's see the hardware connections, and then we'll run the program. Now let's see the hardware connections. Now this is my hardware setup, as you can see. And using this common line on red boats to make all the LED cathodes two gets common or to get shorted with each other. And then common wire is taken out from this connection and given to ground over here. I'll just use this or I'll just keep it like this so that it becomes easy for me to make the connections. Now I have to do what? I have to make sure I connect all these lines to the GPIO lens over here, I have to know that there are three pins from the bottom which are consecutive than I have to leave when pin and then one pin above it. Now let's run the program. And now we can see all the four blinking on, off, on, off, on, off at a much higher rate. Now, if I want, I can also, just like before, increase the delay. So let's make it 2.1 seconds like that. And let's run the code again. Now the LDR on for 2.1 seconds of 4.122. And it goes on and on, looking at dividing connections that I have made over here. So this is 12, then 16, then 20, and then the last pin that is 21. Much better if you look at it from this angle. So that's how you can perform, or we can write down any kind of program with any number of output pins. You can also do an alternate on-off programmer. Now if I have to do an alternate on-off program, then the changes would be very much. I'll just show you a small one. So LET one comma true, then time dot sleep, let say 0.5. And then immediately after that, let's make the LED one false. So I'll just show you a small part of it and then you have to do the rest of the part. So I'll delete everything else. So let u one comma true and then 11 comma false. Now if you repeat it for all four of them, it will create an effect of LEDs being turned alternate on and off, on and off. That too, one after another. Now let's finish the code. For. Now let's run the program. Now as you can see, this is the alternate LET on-off program. If you increase the delay, it would look much better. So let's make it point to and sort of 0.5 seconds. Now I've made the changes in the program, so let's run it again. Let's look at 0.1. And let's run it again. Nice, isn't it? So that's about the LED programs to be done with Raspberry Pi. I'm also giving you some sample assignments after this so that you can try out those assignments or tried to do those kind of programs, experiment as much as you can. And then only you will clarify with your doubts if at anytime you face any issues, do not forget to drop me a message about it. Thank you for watching this video. 18. Rapberry Pi GPIO Interfacing Buzzer: Hi there. In this video, we'll see how we can interface does vary pi with the Zuber sir. This is a simple piezo buzzer, which has an internal driving socket. So usually for making this bizarre work, we don't need any kind of special signal. What we need to do is we need to give some specific DC voltage to this buzzer. This one right over here works well from three volts up to 15 volts DC voltage. So what we can do is let's simply add this or let's collect it into a breadboard. Dell is connected inside a breadboard. And you can see there is a positive symbol over here onto the buzzer. So that indicates the positive and negative in the negative pin should be going to ground on Raspberry Pi. So this is a wire I have connected to ground. And the positive, Should we go into any GPIO that we have. So let's connect this to a GPIO. And the connection is done. The program is very simple. It's just blinking an LED, as you can see. So number 21 is connecting the buzzer, making it as an output pin right over here. And these are the two pins. So let us Alina of two seconds between each on and off. If we had a new suit to let say 0.5. So by changing the dealers slightly, you can see a beat frequency of the audio coming to inches. If I make it 0.3, make it off for only 0.1, then it should generate some different sound completely. And so on. You can also go on using a particular buzzer library to generate different sounds of different frequency if you want to. The output creation, our tradition of outputted simple, just make the particular pin walk as output pin and then write true or false onto that pin. Thank you. 19. Raspberry Pi and Transistorized Switching: Hi there. In this video, we'll see how we can switch the devices which require higher current and hence cannot be directly connected to the Raspberry Pi GPIO 2-bit DEM turned on and off. Let's begin. As we have seen, the elites can be directly connected to the Raspberry Pi GPIO. And we can write a Python program to simply make the particular GPIO pin go high or low. That will indeed turn the LED on or off. But the same is not possible with the high-current device, like a dc load or a bigger buzzer. What if we need to turn on the lights in the home on off using the Raspberry Pi. For such condition, we need to you, switching circuits with Raspberry Pi, with switching circuits can accept this small voltage which is generated onto the GPL, Raspberry Pi, and in turn, make a device go on or off. Based on the type of node that we have. We can have two types of switching circuits. First, for DC Laura, we have these two type of circuits which will see transistor and willing to its 03 and for AC load will be using reads. Now let's try to understand both of them. How exactly the Voc. Now, first of all, for DC circuits that we did transistor it such him sockets. So what is a transistor? Transistor is basically a small electronic semiconductor device, which is commonly used to either amplify or switch electronic signals passing through them. Extra device with three terminals. One terminal can be used to control the flow of current through the other two terminals. These three terminals are called deaths, emitter, base, and collector. Now let's see how a transistor looks like. Basically, there are two types of transistor, but we will be using only the NPN transistor for switching purpose. In this particular course, you can explore further more depending upon your interests. But for now, this much of understanding is enough. An NPN transistors electronic symbol is like this, which indicates three terminals of transistor. So this one is collector, and this one is emitter, and this base, this is an NPN transistor. Npn myths, you will see the arrow going out in the circuit symbol for an npn transistor. Now let us see how we can use transistor as a switch. When bales of an NPN transistor, it's connected with the logic high voltage. It means positive voltage and some current is passing through it. Then it allows a high current to pass the collector and emitter. So when you pass a positive voltage, small current through base, it allows a high current to pass from collector to emitter. When the base of NPN transistor is connected to logic low voltage or ground supply. It means the 0 that we just read from the Raspberry Pi output. Then it simply open sockets, the emitter and collector. And thereby there can be no current flowing through it. See, when we give positive supply and pass some current, then it allows current to flow from collector to emitter, then become 02 bits. It will stop the current flow from collector to emitter. Now let's see some sample, so cuts off a transistor. So for that sake, we are using bc five for seven of bipolar transistor. It looks like this, and this is all the pins are to be identified. Remember, you don't remember the pins of transistor. And whenever needed, you can simply go to the datasheet of the particular transistor and then look from it. So if you hold a transistor on your hand like this, then dissolve the pins. The first one is collector, the second one is base, and the third one is emitter. Now let's see a simple transistor circuit. Now if I have to interface a bigger LAD with Raspberry Pi, then this can be the socket for it. So the base of transistor will be connected with a register to GPI pin, not Raspberry Pi to the collector, we have to connect a DC load leg thes. So this is the way in which you will connect a DC load. So this combined Lee mix alone and the dc load can go to any supply voltage as needed. So this is currently going to find the combination of R2 and D1 forms of load. Now here we are using an NPN transistor, which is vc 50 seven. And the base with a suitable register goes to us very punchy Pian. Whenever you make logic one or whenever you generate true onto the GPIO pin, that device or the load will turn on. And whenever you make 0 or false or low onto the spin, that will make the load go off. It's as simple as that. Now the register value that you're using here should be sufficient enough to pass the maximum of ten milliampere of current. Now if you don't understand all these technical details, then simply choose the resistor like 330 ohm. You can also use for 70 ohm if you don't get 330, but don't use more than that. The transistor used here is the C57, et cetera, and R2, D2 here that presents a high current loop. Now let us see another circuit of the same kind where we are using a bigger buzzer as a load over here. So this is a, but now this buzzer, it's connected now to 12 volts. Now we know that we cannot separate 12-volt from Raspberry Pi pin. And if you have a 12-volt whatsoever, then you can interface it with Raspberry Pi with this kind of circuit. Again, the base of the transistor goes to the GPR of Raspberry Pi through a register. Remember this resistance is very important because we need to limit the current passing through the base. You cannot directly connect the base to Raspberry Pi GPR. Again, the value of register should be something like 3300. And the component used here, it's simply a buzzer. And the trials and studies will say N1, which is B, C 547. Now this is where you connect a buzzer. If you have a further higher current load, like a motor, notices a DC motor, then you can use it in this same way. No change at all, 1 of the motor will go to supply voltage. Now here it is straight forward. Again. Second goes to collector emitter voltage to ground. So in all the circuits, remember, this is the ground and ground of the 12 volt and the raspberry pi should be made common. That's a very necessary condition. So it might be a separate sir supply that you have 12 volt and grown. So it will have its own five or positive and it will have its own negative. The negative of this power supply has to be connected or has to be common with the ground off Raspberry Pi. It is completely safe and don't worry, even YouTube's. But make sure that the negative of 12 volt should go to the ground of the Raspberry Pi and the same ground should be given to here. This is called as the concept of common ground. Unless you do the common ground, the sockets won't be able to understand the voltage levels and hence it will malfunction. So if you have a DC motor like this, then this is the kind of circuit that you have to connect. So this much is enough for switching any DC load on or off. Remember, depending upon the load you have, you can choose the transistor. As you go further and deeper into the earth, you will understand that there are different transistors which are available. For example, we see five or seven that we have. Here is only able to switch up to 65 volt. And the current it give at max is 200 million years. So if we have a load which requires say, pi a 100 milliampere or one MP or of current, then you will simply do what you read. Change this transistor and you will replace it with a high current one. Even if you do so, you saw grips remain exactly the same. There is no change in the sockets, and the program also remains the same. So this particular line of your program will make the load go on. And this will make the load go. Oh, so that's about it for this video, guys tried to create a socket like this on a breadboard if you're interested, and then you can see the output of the same. Thank you for watching this video. 20. Raspberry Pi and Relay part 1: Now let's see how we can switch on or off an AC device using, thus getting back. We have seen for dc devices, you can use transistors, but what to use when you have to use AC? We cannot use the transistor, for instance, supplier or AC load like bulb or a fan or a tube light on CFL, or for that matter, any kind of ac load. Because transistors, because transistors are an active devices and activists can only pass current in one specified direction. Whereas the AC supply requires a device which can flow the current in both the directions. Now let's see what we can use to turn on or off or device using really. So, really, it's a very simple electromagnetic device. It's a device, I would say it's not a semiconductor component, it's a device. The construction of relates very interesting indeed, you can see this is a very simple block diagram of the reconstruction. It consists of a very big winding which acts as a magnet. So this particular winding over here acts as a magnet, visits basically electromagnet. Now, what happens is the particular electromagnet is having its own two terminals. Since this is just an electromagnet, there is no positive, negative mention to it, but definitely there is a specified voltage value. Now, whenever you apply this voltage to this particular two terminals, the electromagnet gets energies and we'll remove this voltage. The electromagnet gets D. And if you look at the construction, it looks like this. That really is having the coil terminals. And then there are three terminals. One of them is called x common. And then there are two more terminals which are usually called ads. This one over here, it's called deaths. And c. And this one over here, it's called an enum. What happens is the common terminal with a sprint tension. It's continuously connected to MC. That's why it is called as nc. That stands for normally closed. Whenever you energize this relay coil, it gets Magna debts. And because of the magnetized, we were magnetism that is induced into this coil. This particular common terminal is attracted towards this RAM. It thereby, it gives a moment and this point connects to NO. Now the connection between the common terminal and NC terminal is broken and the common is now connected to N0. As long as the energy or the voltage is given to the relay coil terminals, the common will stay connected to NO. Due to the large magnetism produced by this point. Wherever you remove this voltage, the spring tension will act and the terminal, the terminal will again go back to, thereby it will break the circuit connection over here. So it can also be shown like a very simple circuit diagram. Let me show you one. So this can be treated as really upset. It has two terminals and inside it, the reason those two terminals, let's call it L1 and L2 for now. And then there are three internal terminals, which let us call it as an O and C And column. And this is continuously connected NC. And whenever the coin is energized, it comes to NO, and thereby creating a socket or making a circuit over here. So whenever there is a closed circuit or close contact between common AND NO, whenever the coil is energy. So your socket should be something like this. A while here, and we should connect AC supply at this point. The second of AC supply should go to any kind of load that we have. The second of load, Welcome to Common. And the second part of supplier should go to n o right over here. It's a very simple but very crude representation of how you can use really to switch on or off an AC lu. So that's exactly how we do it. But the problem here is the coil of raspberry pie doesn't operate on 3.3 volts. It had some rated voltages which are bit higher, like five volts or 12 volts. Or preferably These two are the most popular coil voltage values that we have. And hence, we can also not turn on or we cannot turn on the really directly by collecting the pins to us windpipe. So we again need a switching circuit between raspberry pie and really to make it on and off. Now, what happens is append a value connected a load like this. You're switching is taken care of whenever the coil is energized, the common goods going to N0, the socket completes and the load turns on. For that matter, if we have bulb, then it will simply turn on. When the coil is de-energized, the common gets connected to MC, the load turns up. But to turn on and off the coil itself through the output of raspberry pi, we again need to use a switching circuit, like the transistor switching circuit we have seen in the previous lecture. Now let's see how we can do that. So this is how a relay contact can be shown in the simplest possible manner. And we can switch on the tunnel study using US, sorry, we can switch on the relay using a transistor or a Darlington pair isolate, you will intuit 03. Now I'll tell you what is the doublet of barrels in short. First of all, let's see how we can drive a transistor, drive a really using transistor. So this should be the socket. As you can see, there is no change. This was the switching circuits or transistor. The same remains here for really hear that acts as a loader for our transistorized circuits. But you can see there is an additional component and it's this diode over here. We needed this out as a protection to make sure that you let turns off immediately. Whenever you gave logic one over here from Raspberry Pi, it will turn on the railing, and therefore, it will turn on your device. And definitely when you give a 0 over here, it will simply turn off the device. Now this is when you are using the transistor for switching on and off really. And it's perfectly fine when you are using a single ruler. But what if you have 45678 relates to be switched on and off in that gets created a circuit with 78 different transistors, that many resistors and that many number of diodes can become cumbersome on a printed circuit board. In that case, what we do is we make use of something different. And it is called as a Darlington pair i. It is basically a set of realists which returns a stress which is itself inside it, but gives us in a very decent package so that it becomes easier for us to make the connections as well as to make the circuit out of it. Let us see how we can use un intuits to switch on a really. So this is how the socket should be UL into its 03. If I went on to see the data sheet. So let's open a browser and let us try to see the UL into its three, detach it over here. Now, let's search for you and an 803. And what we are interested in an image for it, or better than image, let's download a PDF format. So it will be a complete datasheet of unit width. So again, use the TI distributor should almost all of them would be same. So let's open one. So this is how the IC should look like. It's an ATM PIN xy. This is the logic diagram. Let us see the pinout. That's up enough. So pin number nine goes to grow. The number ten goes to the common voltage. Whatever is the voltage. If it is a 12-volt unit and it should we dwell. If it is a 24 volt relay, then it should be 24. Then the number ten should be going to that particular voltage and pin number nine should be doing to grow. It's not shown in this circuit symbol. And can number one, if you have connected to that SVD parent GPR, then your load should be connected to pin number 18 in exactly this fashion. So if you have multiple relives in your particular connection, in your particular socket, then you should use those Respect to input pins. For example. Let me show you if I have another relay, then that really should be connected over here like this. And it will be going to pin number 70. This again goes to the same 12 volt supply. In that case. To switch on that really, I need to collect this bin to Raspberry Pi GPL. If I have a really which is creating connected to the number, say thrill than respectively, the number seven should be given to the GPIO, thus the pie, and it will connect to the GPL. That's pretty well. The same thing goes on. If you have made the particular pin higher or logic one or 3.3, the really should turn on. And if you have made it 0, then the relay should turn off. So that's how the socket of a really should be. Let's see how we can actually create a socket like this on a breadboard. Or let's try to use some models which are ability. When it comes to interfacing relieves with Raspberry Pi, what you can do is you can simply opt for some readily available modules. You can just search for really modal. And you will find plenty of them depending upon where you are. You will find lots of earlier models like this. Let me open one for you. So if you didn't, since a relay module that we have, it's a simple single relay module. And it has got three pins for interfacing. Those treatments usually are the supply pin, ground pin. And this exempted the required resistor diode and all the socket layer already available over here. What you have to do is just give the supply pin properly to whatever is the supply voltage of the relay. In this case, it's a five volt religion. So you can interface this radically with raspberry pie board because we have a fiber connection on the Raspberry Pi board. So it goes to five volt or Raspberry Pi pin. The middle pin goes to GPI of raspberry pie, and the last spin goes to the ground of not sweetie pie. So as it's shown here, a ground, this a C signal. So it gives me helping businesses, depending upon which one you have. You may have different pin out at Shun before. This is how your connections should be from NO common to switch on an AC load. So this is a pin which goes on to socket. Second part of the pin goes onto the bulb. And the 2, which is switching, should go to common and just like that. So this is a schematic shown with Arduino. Similarly, you can have one with Raspberry Pi. And if you want, you can have a higher number of channels really. Also. I have shown you this you Alan, for the purpose of understanding, but it is not mandatory to perform in the same way and you can lose this readily available really modals. Also. In next video, we'll see how we can interface a relive module with Raspberry Pi and make it go on at all. 21. Raspberry Pi and Relay part 2: Hi. In this video, let's see how we can connect this relay module width plus three pi. So these are the three signals that we have grown with the CMB signal. So I have three over here, which is a very nice schematic, softer. It's not needed for you to use for this particular course, but I'm using it for demonstrating you the connections of raspberry pie and the relay module. Now let us go back a bit into our presentation that we have the GPIO structure. So let us see. So this is the GPL structure where five volt at this three pins, two pins, but number two pin number four and number six is ground. So what we can do it, this spin-off relieves power. This spin is grown. So let's first connect a ground pin to decrement peanuts. So that's three pi. Then the five volt of Raspberry Pi shouldn't be going to five volt of the relay model over here. Let's change the color of this particular fire. Could read that's power. Then we have the signal connection. Now you can connect the signal pin to any GPIO. I use GPL 21 for the sake of simplicity. So just GPR 21 should get to signal. Now, these are the jump two hours, but I think it's about the idea of how we can have the connections done. Once the connection is done or once the virus has done, what it can do is you can simply bend it outward to make it look a bit better. Just like that. Similarly, I'll do that for the, so I have this linear model over here, which is what, 12 volt input on ground pins. But let's use dividers and try to make a connection. Let's copy this previously, which we used for interfacing. Really, sorry. And we can see it through the connections made on the Raspberry Pi. The program is very simple. It's nothing different than simply blinking a particular pin. So just make it high and low. And you can see that really in operation. Now, we'll also try to see how we can interface a load, an actual load to this really and see how it works. But before doing that, I will remove this power connections. So let's see. Let's move it aside and it will get, I have a folder over here, which I have this two wires coming. And I have this two pin cable as well. So what we need to do is if I connect this spins directly to each other, and if I insert this into my main supply, the load should turn on, the light should turn on. But now, since we have to use this really for switching purpose, then 1 of the load should go to 1 on this wire. Like this. Let me close the program. So this is 1 of the load going to supply. The second of the load and the second of supply, both of them should be doing to really and they should be going to a known and commonly. So let me do the connections I have not connected, this is apply yet. You have to make extreme care. You have to take extreme care whenever you are doing direct experiments with AC. So everything is powered off. My lambda when disconnections accepted us. But there is no AC supply connected. So it is done. Then this is the adenovirus which goes to common. So let me then I can insert this vial into it. So the virus are connected. Well, this is the only open wire over here. And when you make the experiments, make sure you put insulation tape onto it. Now what I need is a bulb and I can insert it into the supply. I have this bulb over here. Only this point is open, so I'll keep some safety over here. And I will connect this wire two mins. Now let's run the program again. Now you can see the light. It's turning on and off with two seconds of delay. So this is the relay model, which is making the switching action happen. I repeat, do not touch this open while it's harmful and it's deadly hazardous. So that's it for this video. Thank you for watching. Whenever you are experimenting, make sure you are experimenting with proper safety at your hand. Thank you. 22. Accepting Digital Input On Raspberry Pi Part 1: Hi there. In this session, we'll see how we can accept inputs on Raspberry Pi. So let's begin. Now. You have to understand one thing before giving any kind of input to the US, very pi. And that is the GPIO of Raspberry Pi, whatever that we have discussed so far, the GPR of Raspberry Pi can only accept logic inputs. Now what I mean to say when I say logic inputs is it can only receive logic one, or it can only receive logic 0 as input signal. As discussed before, the logic one would be 3.3 volt, and logic 0 would be 0 volt. Any voltage greater than 3.3 volt might damage the pins, as well as any voltage less than 0 volt or some minus voltage may also calls trouble with the Raspberry Pi pins. So let's see how we can accept inputs, particularly logic and puts with Raspberry Pi and how to write down a Python program for them. So that's 3.3 volts when applied as an input to any GPIO pin. It's treated as logic high, or it is also called as true or logic 10 volt. It is treated as logic low or false, or logic 0. Now when you have to accept input, raspberry Pi, what exactly is this logic input and where from this input will come. So particularly, this logic input can come from a switches or buttons, which can press against Vcc or ground, or 3.3 volts or ground of your Raspberry Pi. Or it can come from some particular sensors, which give logic higher or logic low as their output voltage. As a result of sensing something. For example, a clap sensor or a sound sensor will give logic one when a sound is detected, otherwise it will give a logical 0. A fire sensor will be a logic one. If it detects a fire, otherwise, it will give logic 0. Loud point completely depends upon the sensor that we're using, about what logic levels it will give us an output. So let's see how we can first accept the logic input from buttons. Button basically is a simple 2 switch. So if I just have to draw a button, it is simply like this. So it's just the two points which, which can get connected to Raspberry Pi. 1 of this switch would be going to GPIO. Let say this is going to GPIO, or let's call it Pi. And this point is going to either plus 3.3 volts or it can be going to 0 volts plus 3.3 volts will treat us logic 10 volt will be treated as logic 0. It should not be greater than 0 volts, 3.3 volts, and it should not be less than 0 volt. Now, there is a concept which is very important and which needs to be understood. For example, you have connected a switch like this. And very well, you have connected this particular point here, going to 3.3 volt. Now what happens in this case, it's see, whenever you press the switch, we are sure that onto this point over here will be the saving 3.3 volts. But what if when I don't press the switch? I mean to say, whenever I press the switch, I'm sure that this particular point will get 3.3 volt, throw the switch. But when I don't press the switch or when I keep this switching released position, then what signal does appear onto this particular pin? Now in this particular case, or in this particular circuit that I have drawn over here. In this case, what will happen when the switch is not pressed? There is no voltage at all. It is called as a high impedance state or trial state in locker digital electronics, not trusted condition is not expected. And you also have to understand one thing, that absence of logic one does not mean presence of logic 0. I repeat this line. The absense of logic one, or absence of logic high, does not ensure presence of logic low. So at this particular point, if I don't have logic one, then I must make sure that it receives logic 0. Now how do I ensure that this particular pins gets logic 0 when the switch is not pressed. So to do that, look at this configuration. What we have done here is to the pin, which is going to pi. We have connected a high-value register at ten K resistor, which is going to ground. Now what happens is whenever this switch is not pressed or whenever the switch is not pushed, the pin gets ground potential or 0 potential through this register. And the pin will stay at logic 0. And whenever you press the switch, because the second of this, which is going to 3.3 volts, it will receive logic one. This concept is called a pull down resistor, admins. The resistance job is to keep the status or keep the logic level of the pin pulled down to 0 as long as the switch is not pressed. And whenever I press the switch, what happens is, since the supply is coming from 3.3 volts, as it is appear here. And a very small current will flow through this resistor to ground. This current. So significant because of the high-value register that it is completely okay for us and there is no need to worry about it. But this ensures a very nice thing. And that is keep this status or keep the logic of the pin connected to ground when the switch is not pressed. This concept is called pull-down resistor. In the same context or in the same way. There is also a pull up resistor. Pull-down is used when the switch is connected against Vcc, or 3.3 volts pulled up is used when the switch is connected against ground. As you can see, if this particular point is going to the Raspberry Pi pin. Then what happens is whenever this switch is pressed, it receives logic 0. But when the switch is not pressed, it is not ensured that it receives logic one or 3.3 volt. In that case, what we do is we connect a high value resistor in will up configuration. Second bands on the resistor is going to 3.3 volt. So what happens is when the switch is not pressed, the pin status is by default, pulled up to 3.3 volts. And whenever this switch is pressed, a small current from 3.3 volt will flow to ground. And the particular pin will now receive. Logic 0. This concept is very important and used across the embedded systems for interfacing number of different inputs switches. Whenever there is an input switch, particularly to interface, we have to take care of pull up or pull down configuration. Now it simply means that with Raspberry Pi, you cannot directly interface a switch and you need a pull-up, pull-down register. Is that so? No. Because the good thing is the Raspberry Pi is having internal pull up as well as pull down registers. So whenever you connect a switch, you can directly connect a switch like this. Here, this particular pin, I have connected to ground or 0 volts. It is the exact connection that you can make. So this is the ground pin over here to which 1 of this, which is going the second part of this, which is directly going to pin number 40 or GPIO 21, my favorite pen because it is easy to identify. And what you can do in Raspberry Pi, it's through the programming. You can enable the internal pull-up resistor. In this configuration. Since the switches connected against ground, we need up pull up register. If you are connecting a switch against 3.3 volt, then you might need a pull down resistor. And you can enable the pull up or pull down through programming. It makes the concepts are important for us for overall understanding, but not necessary to use a resistor externally with Raspberry Pi. Let's see the program for it. It's very simple. So this is the default declaration whenever you want to make any particular pin act as an input pin. So when you declare the Raspberry Pi's pins as input pin, it is declared, or in this particular way, if you declare it like this, then it is simply the tri-state condition which I just discussed some time ago. But if you are using a switch, then you might need a pull up or pull down. And it has to be configured in this way. So you can see this, this particular declaration over here is GPIO.setup 21. That is spin number comma GPIO.output. It means you are specifying it to be used as input pin. And then pull up underscore down is equal to GPIO dot POD underscore. It simply means that what you have done is we have declared the particular pin as input pin. And you have an enabled the internal pull up. If you want to enable the internal pull-down resistor, then simply make this line POD underscore down like this. So with this particular declaration, with these two declarations, with these two declarations, you can enable the pull up or pull down resistor on Raspberry Pi. And it makes the overall programming much, much easier whenever you're interfacing with the switch. Remember, all this declaration and all this logic that I'm talking about is important only when you're interfacing with us switch. Why? Because with only a switch, you pin can remain floating or tri stated. And therefore you need this pull up or pull down. But if you have some different kinds of sensors, which we'll discuss later, but I am just explaining it now. So if you have a sensor here, then you can directly connect the logic output of sensor two pi. The sensor will take care of giving logic one and logic 0 accordingly. So this is the declaration guys. Instead of writing GPR dot setup 21 common GPIO.input, you should declare it as GPIO.input comma pool underscore. Underscore down is equal to GPIO.output PUT underscore up or beauty underscore but down depending upon your particular case. Now in our case, we have connected this switch against ground. So what we need over here is we need up, pull up. So we're going to use this particular declarations. We will be needing to use this declaration for us, which enables the pull-up resistor. Now let us see the code for it. The core for it is very simple. The only change in this code here is let me see. Instead of writing it PUT underscore down. I need to make it beauty and the score up. Now let's read import Rpi.GPIO as GPIO, import time, GPIO.setup more GPIO.output, ECM. And then GPIO.setup 21 comma, GPIO.output comma pull down is equal to GPIO dot PUT up. And then the main code is like this, while true, which is for infinite loop. If GPIO.input 21 is equal to, equal to true, it means if the pin is reading logic one, then what we have done here is we have printed when 21 is higher, and then we take a dealer of 1 second. Otherwise. Otherwise means the pin is not trade as true. It definitely means that it is read as false, or in short means the pin 21 is low. And then we again take a daily off 1 second. The program in itself, it's quite simple, but let's try to see it when we actually interface a switch with Raspberry Pi. So let's see how we can interfaces which with Raspberry Pi and see the program in action. Thank you for watching this video. 23. Accepting Digital Inputs On Raspberry Pi Part 2: Hi there. Now as you can see, I have the usual breadboard with me. And onto this breadboard. This is the switch that I can connect. It is not necessary to have a breadboard to connect switch. You can also connect the switch directly without inserting into breadboard. But it's better for clarity and simplification. So what I have more here is I have two wires. These are, as always, the male-to-female type var. So this end will inserted, will get inserted into bread board. And this one will get inserted into the US very pi over there. This one is over here. So let's go into Switch node. Now I will use the vertical lines and I will insert the switch like this, not like this. Okay? Remember guys, if you insert switch like this, then it will be completely short-circuited because all file ends of breadboards are connected with each other internally. So I need to connect this switch like this, okay? And now wherever I have connected the switch or wherever my switches inserted exactly in parallel to those wires are exactly in parallel, I have to insert these two connectors. One of them will go to Raspberry Pi pin, and one of them will go to ground. So this is the raspberry pie that I have not yet powered on. So let's see. This will go to GPIO T2 and T1, which is right over here. So I have this hat connected. So GPR 21 as further diagram, and this will go to ground. This is here. So that's about it for the connections of this particular switch with Raspberry Pi. Now let's power it up and let's try to write down this program over there. The Raspberry Pi has been powered up. Now this is the remote control of Raspberry Pi through VNC viewer that I have. And let's open terminal, and let's open Tawny. Make sure you open Tawny with pseudo permissions so that you can do the GPR related programming. So pseudo thorny, let's make a new file and save it in pi. So I have a folder here. And let's call it switch. Now let us try to write down the entire code over there. So this is the code. The indentation is important in Python programming. So after a while true, you just make sure that the code is in ten, indented correctly. Like that. Now we can simply run the code. And you can see, since I have the switch is not pressed condition over here, the internal pull-up is making it read as logic one. And therefore, we are getting the output. 21 is high. Let me press the switch. Now have pressed the switch. And now you can see the output that I'm getting over here is print 21 is logic low. If I release the switch, it's again high. Getting it. Now based upon this particular phenomenon, if you have another switch connected, then the program becomes exactly like that. Now let me stop the core and let me make the changes. But this time what will happen is you will repeat this line for another GPIO, Led Zeppelin API. And we will write down another if loop. The time dot slip is only for our understanding. If I don't give time dot sleep, what will happen is I'll get a continuous stream of messages, which I don't want form now. And that's the only reason I'm giving time dot sleep. Now I've done this score. And what I'll do is I'll go to my GPIO pin out because I don't buy hard it. I need to know various GPO it in. So it is closed here. So let's instead of 18 MCAT 20, because it is exactly close to 20 m 21. And it would make things simpler for us. So pin 21, sorry, 20. Now let's run it and see the output. So both of them are high and the same is shown. Now what I'll do is I'll simply have one more wire. This will go to 20, pin number 20. And instead of connecting a switch, what I would do is I would simply connected with ground connection over here. I can say as soon as I inserted in ground, the status should change. Now let me insert it. It's done. And now you'll see in the output, the pin 20, it's coming low continuously. So if I remove it, it will come as high as you can see. It is coming as high. And if I keep it pressed or if I keep it inserted, it should come as low. Sometimes the breadboard gives you not so curate slow now. And if I press the switch also, then the seconds which will also read it as low. So both the readings will read as low. The one with capital L is 421, and the one with small-cap says four pin 20. So in the same way, you can connect as many switches as you want with Raspberry Pi and accept the logic inputs with it. Now I'm gonna give you a simple programming assignments that you can complete where you have to interface the switch, an LED with Raspberry Pi and see the output. Thank you for watching this video. 24. Sensor Interfacing With Raspberry Pi LDR1: In this session, let's start discussing how to interface sensors with Rasberry Pi. And before doing that, we must know what is exactly a sensor. So let's start discussion with what is exactly a sensor. Sensor is basically a physical component which can sense changes into some kind of physical quantity or some kind of physical parameter. Like there is a sensor for temperature, then for pressure, humidity, there is also sensors for LPG leakage and steles, detection of alcohol. You know about the sensors present inside your phone, which includes a compass, as well as the proximity sensor, which turns off the display when the call is on and so on. And there are hundreds of different types of sensors which are available. And all of them can be used in electronic projects depending upon what type of output they produce. These sensors are broadly classified as analog and digital sensor. For example, let's say there is a small sensor available, which is called as LDR. Now it's simply a resistor which displays the changes or which shows the changes in resistance whenever the light falling onto it changes. And let's see in detail about the sensors. So absurd, depending upon the type, broadly, sensors are classified as analog or digital sensor. And unlock sensor means some sensors which are fabricated to give a calibrated analog outputs. And what I meant to say back calibrated analog output means at the time of manufacturing the sensor itself, the outputs of the sensor are calibrated to the physical parameters that has been sensing. To give you an example, LM 35 is a very recent temperature sensor, which gives analog output. And the analog output, it gives its ten millivolt per degree Celsius of temperature. So for example, if right now the room temperature is 25 degrees Celsius, the 35 will give 25 multiplied by ten, it means to 50 millivolts as output. So this is a kind of sensor which is, or which we can call as an analog sensor. And then there are some sensors which are fabricated to give a digital output as well. The digital sensors, or the ones which give digital output, give data on to some kind of digital communication mechanism or something that we technically call its protocols. There are a number of different types of protocols, like one wire protocol, I2C protocol, SPI protocol for communicating digital data with something like microprocessor, microcontroller, with Raspberry Pi, we have to understand one fact that we cannot directly interface an analog sensor like Ellen 35 to it directly and Raspberry Pi and need to be only supports digital sensor. Because on raspberry pie board itself there is no analog to digital converter. But if you have to connect an analog sensor like Ellen 35 to Raspberry Pi, what you need to do is you need to use an external a to D converter. Now, in this session, what we're going to do is we're going to see some of the sensors which are analog as well as digital. So let's see. The very first one that we can discuss is an LDR light dependent resistor. Now, LDR is, by its nature, you cannot call it as an analog sensor because it cannot directly gives you an output. It's just a resistor. And we have to create a conditioning socket around it so that it can give an analog or digital feedback tools. Debunking of LDL is very simple. It's basically a resistance. This is the circuit symbol of LDR, and the resistance of LDR changes with respect to the fallen light onto it. If there is very low or no light falling onto the LDR Equus, there is a dark condition. In that case, the resistance of LDR is very higher. And when there is sufficient light or when there is enough let onto the LDR. In that case, the resistance offered by it is low. If the light is much brighter, falling onto it, the resistance is lowest. And if the darkness or if the light is very dark, there is no light falling onto the idea. In that case, the resistance it offers its highest. Now let's see how we can interface the LDR with Raspberry Pi even without having an analog-to-digital converter. So let's see the simple hands-on in next exercise. 25. Sensor Interfacing With Raspberry Pi LDR 2: Now let's see how we can interface the idea with Raspberry Pi. At said, more light means less resistance offered by it, and less light means more resistance offered by LDR. And therefore, whatever significant listening is to be done onto the LDR, we have to do it in our interface and socket. Now let us see the interfacing circuit for LDR. Now, as you can see here, we have to create an interfacing circuit like this, where we have an dear interfaced with a capacitor like this. Now, the walking off the circuit would be very simple. 1 of the alleles goes to 3.3 volt. Second part of a layer goes to a junction. Rules. 1 goes to the GPIO pin of raspberry pie, and the second goes to the capacitor's sponsor to pin. The negative pin of the capacitor goes to ground. This is supposed to have an electrolytic capacitor, and therefore it has its own positive and negative terminals. Now let's see how it will work. Now, as you can see, 1 of the LDR is going directly to 3.3 volts over here. And this spin is going to Raspberry Pi GPIO. So the algorithm would be something like this. Initially, what we will do is we will make the Raspberry Pi pin act as inputs. So very first thing is Raspberry Pi pin will act as input pin. And what we're going to do is we're going to write down an algorithm where we can sense the voltage on to this spin, where it goes from 0 to 3.3 volt. At soon as it becomes 3.3 volt, we will read it as logic one. And when it is 0 volt, we will relate as logic 0. This is how the interfacing is done. So let's first understand the logic. Now, to be precise, let's see how the exact algorithm should be. Let me clear it whatever was the previously done. Now, what we will do first ICTY 1 of the capacitor is going to ground, and the second is going to Raspberry Pi. So the very first step in our program should be this particular GPIO pin will be made output, ok, we are going to read it as input, but first let's do it output. And in the second step, what we do is we make the particular pin as false. Write a false value on to the output, which will write a 0 volt on the output. Now what happens because of the 0 value, this spin of raspberry pie, the spin will become 0 volt. This spin is already ground, means 0 volt. So in this condition, what will happen? The capacitor will be completely discharged. So there is no charge on capacitor at all. Now what we will do is we will be making the pin work as input. So now the GPIO, we'll invoke as input when. But we want an AML any pull up or pull down. So it becomes, or it steals tri-state. Now what happens because of tri-state nature of the pin? Let's see. Now, what will happen is depending upon the light falling onto the LDR, the capacitor will receive some amount of current, and based upon the current resumed through this resistor and the capacitor will start charging. Right now, the capacitor is completely discharged. So the potential at this point, which can be read 0 volt. As the capital C2 starts building charge, its voltage will rise slowly, something like this. So it's 0 volt. And based upon the India, it will write something like this. And after some point, it will reach to a value, let's say 3.3 volts. If this is the 3.3 volt threshold bar, that reform. And it's sure to take some amount of time enriching to that point. Now, if there is a dark, light, completely dark room, in that case, the capacitor will take full-time to charge because the resistance of LDR would be highest and because of the highest, Because of the highest transistor, because of the highest resistance. What will happen is the current flowing through the capacitor would be very slow or very low. And therefore, it will take a lot of time to charge completely. Whereas if it is a well lit room or if you are holding a light source onto the LDR, that it will charge rapidly. Because in that case, what will happen is the resistance offered by each will be too small, and therefore, the current flowing would be large enough to charge the capacitor faster. Now what we will do in our program is we will try to major the tiny. We'll try to measure time needed for this spin. To become one or two become logic one. Now let us see, this is the interfacing diagram of LDR and capacitor with Raspberry Pi. So this is exactly like this. You can use, you can use a one microfarad capacitor or a ten microfarad capacitor, but don't use more than ten microfarad capacitor. One to ten, any value would be, okay. This is the interface and diagram. 1 of the LDR is going to 3.3 volt over here. Second of a layer is going to capacitor and the same 0. So going to pin number 21, GPIO 21 that we have been using. And the second pin of capacitor is going to ground exactly at shown over here. Now let us try to understand the program for it. Now, this is the program and this is the algorithm, if you can see. So what we've said first was will make the GPIO pin workers output pin. So here we are setting it as BCM. We're specifying PIN number. And in vile true, what is the first thing that we did? We first made the particular pin here to work as output quinn, OK. Next what we did, we write the pin to 0 volt that will ensure that the capacitor gets completely discharged. We also wait here for 1 second so that the capacitor is discharged completely. And then what we do is we make the particular pin Voc as input when translated input pin, you can see. And then the line is vile GPIO.input pin is equal to, equal to low. Reading is equal to 19 plus one. It means basically this program will continue as long as the pin is low and as long as the pin is low, what will happen? A variable called reading will be incremented by one continuously. Now when the pin will become one or wherever that pin becomes one, this particular while loop will be broken. Till then it will keep making the readings increment by one. And when the pin becomes one or when or when the pin will become one, whenever the LDR, it's fully charged. So after this point, at this point, when the LDR, when the, sorry, the capacitor charge becomes 3.3 volt at this point. This particular while loop will be broken. And then what we do is we print the reading on to the terminal, and then we again wait for 1 second before repeating the entire loop. So as you see, first of all, make the pin output. Then what we do is we make the particular pin 0 volt. Then we wait for discharge, then we make it input. And then we again VT. Now what we went for to become true or one. And while we waited, what we do is we increment a variable. Now when you printed the value of this variable, it will directly indicate or it will be directly proportional to the amount of light falling on the LDR. If the amount of light falling onto the LDR is very low, or if it is very dark, then the reading will be high. And when the amount of light is sufficient enough, the reading would be low. In this sense, I can say that the print value would be inversely proportional to light falling. So if the light is higher, the reading, we're going to suppose, if reading we're supposed to get is low, and when the light is low, the reading we are supposed to get is high. Now, enough of theory. Let us try to see it practically when we interphase the capacitor and LDR with Raspberry Pi. Let's see that in the next video. And let's see the output. 26. Sensor Interfacing With Raspberry Pi LDR 3: And as you can see, I have an LDR over here. And this is how it looks. It's basically a two pin component. And it can come in smaller size. Also, this one here is a media sites LDR that I have. Now let's try to check it. So this is a multimeter I have over here. Let's put the multimeter onto the resistance or this ohmmeter mode. And let's check the LDR. Now, the multimeter is into resistance measurement mode. And now what I'll do is I will connect this two points of LDR multi-meter. Now, as you can see, it's calculating the resistance and it's about 1.4 K. Now if I give darkness onto the earlier, you can see it's 678 k. If I make it completely dark. And something around 48 key, you can see there is a resistance the LDR is offering. Now if I keep it as it is, then it is 1.3 kilo ohm. And what I have here is a torchlight in the battery bank. So let me just keep it like this. So if I take the LDR and threat of full light, just hold it like this over here. And again see the resistance is so reduced that it's about a 100 and moments something 70 ohm. This is an actual room light on national room LED. You can see the resistance coming out to be something like 1.3 K. And when it is met dark, it's something like 50 kilo ohms. So, so that's how you can check the LDR. Now let us proceed further. Now had the Raspberry Pi working over here. And I have a breadboard. This is a one microfarad capacitor that I have. Now, the negative of capacitor is easily identified by this kind of white patch onto it, which indicates a negative symbol. Now what we need to do is we need to connect the LDR just at shown on Tuesday schematic. So 1 of LDR will go into the breadboards, one pin, other point will go find another suitable hole. And then a resistor-capacitor from that second to another point onto the breadboard. Like this. There isn't much to the connections. Now, let us connect the Raspberry Pi to it. So this is where I'll collect 3.3 volts anywhere here. And this is the ground pin. And then what we need is the data up in data pin is the middle one, which is here. As you can see. The combination of LDR and capacitor is the data in the metadata pin will go to pin number and GPR 21. Then this one will go to 3.3 volts and this one will go to ground. No, it's good. Now my connections are done. Now it's time to write down program onto the raspberry pi. And let's see the output. Now let's connect to the Raspberry Pi through VLC viewer. And let's try to write down the same program over there. Let me do the remember password checkmark. This is my raspberry pi. Now what I want is I want to open the Python editor here. So let's open terminal and let's type sudo Anthony. So pseudo gives us permissions to deal with the GPIOs. That's why pseudo. Now let's try to create a new file. And let's save it. So I'll call it a test folder as the retinas LD S. Now all we have to do is we have to copy this. Over here. There's the core. There is about it. And let's try to run this program. The output should be shown in this window here. So the print reading should be in parenthesis that scripts, no other changes needed. Now against their number has been printed according to 1303. Ok. 1303 is been continuously printer. Now, if I take my hand there to earlier, if I print some doubtless onto it, you can see the number is increasing. If I reduce it and keep it in normal room light, it is again close to 1.71299. If I again take the hand amounts, you can see that adding increasing once again. Now if I take the top slide and put onto it, and you can see the reading will drastically reduce two hundred two hundred fifty three hundred and so on. Well party will when it, if I. So this can be a very simple experiment, but it can also act as a clear indicator of how much is the lead presented your room. So this is normal light because this is a mess. You can say something greater than four thousands, dogmas, something greater than 10 thousand, it's complete darkness. And now I am NC. I have put my finger on to the idea and the red against more than fifteen thousand, eighteen thousand or something, and so on. Now using this simple program, you can create any light will enter mini-project. I will repeat that this is not a perfect indication. Often lumens of light that is present in the room, but in some definitive indicator whether the light is sufficient, it is dark or it is brightly lit or super brightly lit. Now you can perform this experiment and see the output for yourself. And you can also perform some tasks based on it. Thank you for watching this video. 27. Sensor Interfacing With Rapberry Pi DHTT11 part 1: Hello. In this video, let's see an actual sensor in action with Raspberry Pi. For this particular video, we have chosen this sensor, which is called as a D H T11 to interface with Raspberry Pi. There are several reasons for choosing DHT VT_1. The very first reason is it's very simple digital sensor, and therefore, it can directly get interfaced with Raspberry Pi. The second reason for choosing this one is it gives us two values. Those are humidity as well as temperature. So it can sense the atmospheric humidity as well as temperature, and it can give us those two hairdos. The third important reason for choosing D S21, one digit sprites. Almost anyone would be able to afford it because THE 1-1 comes very cheaper. Now let's see how we can interface the HTML none with Raspberry Pi, and how we can write down a Python program for the scene a little bit about DHT feminine at sir, it's a digital temperature and humidity sensor. This contents a negative temperature coefficient thermistor for measuring the temperature value. And it consists of a resistive type humidity sensor. Some both the temperature and humidity are sensed by changes in the resistance itself, by the elements which are present inside the sensor. But the sensor also consists of all the required circuitry which is required to process this values coming from the sensor. And therefore, what we get is a complete digital data onto a single wire. It regards only single wire or one buyer for data signal, and therefore, it is easier, it is very easier to interface DHT one-on-one with a variety of different controllers. Any controller or any microcontroller like Arduino, or any computer like Raspberry Pi can be easily interfaced with DHT 1-1. The HTML non operates on three to 500 power as well as input output pin. So it is okay if you operate it out 3.3 volt by using with Raspberry Pi and five volt value using it Arduino, the maximum current into requires is quite low. It is 2.5 milliampere for that toll. During the conversion. And the humidity readings are good between 20 to 80% with 5% accuracy. The temperature readings are good up 250 degree Celsius and the tolerance is plus or minus two degree Celsius. The sampling rate, it means the data rate with which it can pass on the data should not be more than one hertz means it cannot give data more than once every second. The body sizes specified a bit, and it also specifies it has got four pins. Although we need only one pin for interfacing and to pin for power connection. One redundant or incipient is there, which is not to be connected anywhere. Let's do the pinout. So this is the pinout of DHT women. Now, in this particular pin out, as you can see. The pin number one or the first pin from left-hand side is VCC, which should go to five volts or 3.3 volts. In our case, it will go to 3.3 volts because we are interfacing it with Raspberry Pi. So this is the pin number one, which will go to 3.3 volts. The second when its data pin 30 minutes NC, and the fourth pin, its ground or 0 volt pin. This is how we have to give connections. So this one will go to 3.3 volt. This is data pin, which should go to MEG PIP and of our Raspberry Pi. And the last spin is ground. Moreover, there is one thing required, and that is this pull-up resistor. This is something very important and you simply cannot miss this. You have to connect an external ten kilo ohm pull-up resistor between Vcc and data pin. So it will be something like this. You can connect it on a breadboard. Well, interfacing. So that's how the interfacing of 11 is to be done with Rasberry Pi. Let's see the library installation for the STK11, how to install the library required, and how to write down a sample program. Now before installing any libraries from GitHub get up. I will discuss in detail in a later video. It is an online repository where the software codes can be saved and easily downloaded. Make use of the Adafruit made libraries. Adafruit is a very popular company making DIY kits, which it's situated in New York, USA. And they also create a lot of different libraries for Raspberry Pi to make things easier to handle the sensors like the HTML. And now in order to install the library, what we have to do is we have to run some commands on Raspberry Pi. So let me show you what are the commands that we need to run and how to install the liability? The very first command is this entire thing. Git clone HTTPS, slash Adafruit slash Adafruit underscore Python underscore DHT, dot kids. The underscores are not seen here because it is treated as a link. Let me show you. If I remove the hyperlink. You can see the underscores are there. This is the first command. What will happen with this command is you download this software onto the Raspberry Pi. So this will simply download the code. The job of this is download code. Second, what we do is it downloads the court in a folder, okay. So it downloads the quota folder. That's the first commands to execute. The second command to execute is this. It means we go inside the downloaded folder with this particular command. The third command is installation of some essentials which are required to install Python libraries. So sudo apt-get install, build essential Python Davis already there. By third, OpenSSL is required so you can run this command depending upon if the packages are available or installed or not, it will require those ones which are not installed. And then the last command which you can see is installing shut off Python library. Now this particular command here, it's sudo python. And therefore what I have done is I have given you additional instruction. Then you can also directly install it for Python three with pseudo PIP3 install Adafruit, Python DHT. So either this or this approach, it's suitable. So all these above steps or the single step below, okay, the fifth step or on the UML steps. And when you're doing it for Python three, instead of making it Sudo Python because Python three install it. Let me show you now let's do it on the Raspberry Pi itself. So what I'll do is I'll follow this commands first, downloaded the code, then go inside it and build it on morass. Very bad. So let's copy this command. Let's upon my Raspberry Pi clothes, whatever it was open over there, full-screen tier ones. And I'll paste it and it will download the Adafruit underscore Python underscore DHT. Now I can open the Home folder and you can see the folder been created Adafruit underscore Python underscore DHT. Now let's go inside that folder, CD Adafruit underscore, underscore DHT. At this point, we have to install some important or required dependencies by this command. Sudo IPT get installed, build essential, All in all. So let's copy this and enter. So those packages as required are installed and they're going to look at Python dash tell Python OpenSSL. So let's remove the Python dash div. Let's keep what lead by ten OpenSSL. So they are already installed. No need to do anything over there. Now let's run the last command, which is sudo python install. So though Python three, I will use install because we are installing the libraries for Python three and ask any pi by default contents both Python two as well as Python three. And whenever you refer to something as just Python, it is oftentimes referred to Python two. And hence, if you have to specify my country, but I will simply write done Sudo Python three like this. Now it will not run the Laggard is it will install the libraries onto Raspberry Pi, which we have just downloaded. Now the liability installation is done. Next, what you have to do is go to Adafruit underscore Python DHT folder. You will see the examples folder over there. And here you will see this So simply copy the simple Keep it somewhere. So what I'll do is I'll create a folder over here. Course scores. I'll just paste it here. Simple I will rename it so that it reads DHT. There's a simple desktop by now it's time to perform the connections with Raspberry Pi and see the output of this program. Let's see the connections, and let's then try to see the output of this code in the next video. Thank you for watching this one. 28. Sensor Interfacing With Rapberry Pi DHTT11 part 2: Now as you can see, I have the HTML one module over here. So there isn't much change in what I showed you. And this module. The only change is the required pull-up resistor is precedents onto this PCB, along with a power one indication LED. And therefore it has got only three prints. As we come in, we see, see data and grammar. So if you have a model like this, you can directly interface VCC pin here, data linear and grounding right over here. Otherwise, you can install the DHT levels sensor if the breadboard, and then perform the corrections as you want. For me since I have this module, I don't want to use this red point now. I can simply use female to female character as directly connected to Raspberry Pi. No, I'll just keep this setup aside. And this is the LDR setup. And you can see this is the T to T male bias. Both times our human connectors, as you can see. Now connected like this. All three wins against it. I'm right is VCC and the browser is ground, the brackets delta. So the white is Vcc and all its branch. So this is the Vcc connection that I'm making. The curriculum lead. Postpaid for lip seconds, Vcc, the third pin from right said it's grown. After this connection, I can see the LED powered arm over here. And this is the beta, which I correct today identify and been in number 21. Now the connections are length for this particular sensor. Now let's see the output. Let's keep it as it is. Now let's open this DHT underscore simple in Tawney ID. It's the simple testing quote guides. So I will first demonstrate this, and then we'll try to do something out of this test code. It has got lot of comments into this code. First, there is a declaration of sensor, so we are not using the Z22 beer is in VHDL E11, so just make a DHT 1-1. And let me clarify the code a bit so that you understand it well. And don't think that it's quite big or quite heavy. So first, declare shout the sensor if you can, if you want and can use DHT to-to also, which is a bit accurate then DHT B17, but expensive if it is to just make it to two and the rest Beckett 1-1 connections and everything remains almost same. Then here we mentioned the pin. Right now we have connected it to 21 number of us very pile. So let's make it 21. And now this after lens, some temperature, humidity command temperature is equal to theta fruit underscore DHT dot read, retract. Vibratory dry is because in single reading human not contiguous Stephen month response. And therefore, you want to rewrite this particular line over here. We'll wait for two seconds and it will retried for two seconds. If there is no data, then an error will be displayed. After the data is received. On the next line, what we do is we are checking if humidity is not None and temperature is not null. It means we have got some fair a valid values for temperature and humidity. And in that case, what will do is I will remove this complications and make it simple. And then what we'll do is we'll print temp is equal to the first parameter and the humidity is equal to second parameter. So temp is equal to bracket 0. You will retain circled two curly bracket one dot format temperature, humidity, else failed to get benefiting triangle. It wins if either of this two value is none or 0 admin spent to get the reading and try again. Now let's run this code. The connections are done and we're supposed to get the reading over here on the temperature and humidity value over here. As you can see, we've got the temperature and humidity values. So temp is equal to 28 degrees Celsius and humidity is equal to 47%. But the program exhibited by giving a single reading. Now what I want is I would like to convert this program intro code, which can do continuous values. Let's switch to the regular mode of funny by closing it. And this starting it again. And this is the full mode in which you can save the programs as needed. So I go to find and I will call it the same ads. And then DHT. This love simpletons, let us called continuous test. Let's shorten the code. Now you have got a fair idea of how it is working. Now what I want is the code should run in infinite loops. So I will also import time library. And from this point onwards my programs should be running in a while true loop so that it gives us continuous readings. After you write down why 2ND curly brace, the colon is opened, you need to indent your program like this. After, if also the indentation is required like this. Similarly for l. Now this is done once. After single iteration. What should we do is we'll take a daily of, let's say 1 second. And now let's run this code. Now let's see the output over here. So we are getting the ratings temperatures 12, 27 degree Celsius immunity is equal to 48 something, 49. I'll also happened to have a soldiering gL over here. So this is the salt and iron that I have. And I can keep it close to this HTML. So that it can sense some of the temperature that it's giving me. So the soldiering is turn on. Red started emitting up. But we'll take some time. Now. Let us try to see. The LED is quite hot now. Let's keep it closer and closer we're through it so it can sense in the atmospheric temperature and therefore, not much change will be observed still, you can see that I had written as rises by one degree Celsius in proximity to the government. I have a more experimental, which we can do here is notice ordering and now I use the hot air. How much differential it can sense. The hotter than that I have. With me. Show you. So these are the seconds for it, so I'll just make it all now. This is the area and this is temperature settings. So let's keep the Declaration on the very setting. A or normal should not be very too much high flow. Other sensor would get damage. Make sure if you or when this kind of experiments that you per distance between the nozzle and your hand, as well as the nozzle enter sensors. So this has been awesome. And this is, this is part of the heart is stopped, like stop it and let's run it again. So again, this is the tricky one degree Celsius. Final blew the air close to the fish really did intellectual value 3435. If I Rosa. So it is faulted existence as an integrated user use because I'm looking for the seven or don't do it more than that, otherwise we might address the sensor. Now let's, let's close the flow. Moves the setup and some techniques slowly. They will come back to the novel position or the seven. And so on. Should take some time. But after sometime it will come to nodal point. So this is the code that you need to run or to read the temperature from DHT 1-1 sensors. We have seen DBH T11 sensor in action, as well as we have seen its extensively tested with the hot air gun also mixture. Whenever you perform this kind of experiments, you maintain proper safety. Thank you for watching this video. 29. Sensor Interfacing with Raspberry pi Using SenseHAT: Hello there. Now that we have seen how we can wire the sensors, wire up the sensors are who cover the sensor with Raspberry Pi and see the output for it. Let's see if we have some other simple option. Many people are not that comfortable with dividing the sensors to Raspberry Pi and therefore are a bit afraid of experimentation. If it's something like you, or if you want gluttony, more sensors to experiment with, without doing much of dividing, then this particular beauty is for you what this is called as is a Sense HAT. This is an official Raspberry Pi foundation product, just like Raspberry Pi itself, which has got a number of different interesting things, which makes the Raspberry Pi computer a lot more interesting. Let's see what the sensor has got. You have to understand one thing basically about sends out that what exactly it is, it is not a computer. The computer is Raspberry Pi itself. Since that is an additional board which will sit on 2D Raspberry Pi itself. So we can assume that if this is the pi, if we have, then the Sense HAT will simply do what? It will simply add some value to it. So pi plus sensors apply plus sensor hedge, which it's short funded synset. So using this connector, this sense that sits onto the Raspberry Pi and gives access to a number of different sensors, which includes temperature sensor, humidity sensor, pressure sensor, gyroscope, accelerometer, digital compass, joy streak. And there is a very interesting this eight by eight RGB LED matrix. All of these things make interfacing of the Sense HAT very interesting with Raspberry Pi. In order to know more about how to interface this end set, what we can do is we can go to this simple link. I'll keep it open in one window. So this is basically the official Raspberry Pi website, which I'm showing to you and said, you can use this end sat with Raspberry Pi directly. And since it's an official product, they have also given you one choice. You can use the physical sense hat on the top of Raspberry Pi R. We can also use an emulated sense had. What does that, I'll tell you in short. Let's look at the link first. It's very interesting. And we have a clear indication here how you can use send sat with Raspberry Pi. So this is how it looks. Let's go next. Let's go next. We can see a lot of different things are there in this attaching a sense that you can see this is the Raspberry Pi computer that we have. And this is how the Sense HAT will look like. After installing. It should look like this. So this is a simple GIF, which is very interesting, yet important. Let's look at it. So this is how the sensor gets attached. A connector sense on the Raspberry Pi onto which this inset is connected. And then the force groups come onto it, which fixes it. So whenever you have purchased a sense that we can connect it to us, very pi, like this. It's very simple. Let me just reload the particular thing and let's watch it once again. So that's how it gets installed onto the top of raspberry pi. Now at same, synset is just an add-on board. Remember, you have to understand the difference between add-on board and the computer itself. And add-on board. It's supposed to add functionalities of an existing board. So this is how it is right now. If this is the Raspberry Pi, then send SAT is just an addition to it, just like a hat itself. And what it will do is it will give us access to some very interesting sensors which are built onto it. Now these are the sensors which we said. And very interesting thing about sensor it is, as I told you earlier, also, you can also use Sense HAT without having an actual hardware with you. Let me show you how. So this is a sample program, $0.04 at, in most of the Arduino's, most of the Raspberry Pi versions, the library for sense sad is pre-installed. So this is the program from Sense HAT, import Sense HAT. It will import this and sat into it into the program. Then we import time. Here. We create an instance of the library with this line over here. And since dot clear will clear the display of synset so that nothing gets printed onto it. Then I can see the three sensors are red with this simple instructions, pressures are going to sense dot get underscore pressure. Humidity is about $0.02 dot get underscore humidity. It should have been here. My mistake. Let's make it humidity. And temperature is equal to, since dot get underscore temperature. This sense is nothing but an object of the sensors that we have created over here. Now if you have a physical sense at, then simply collected to Raspberry Pi. And you can run this program to read the values. I told you without having a physical sense that also you can use this. Let's see how. So for now I'll just skip the presentation and I'll go to my Raspberry Pi. So this is my Raspberry Pi. Let's close the existing code, whatever is running. Now in the menu, you can see over here in the programming, you will see an option called Sense HAT emulator. Just click that option. The Sense HAT will open in front of you. So this is an emulated synset Here, you can decide the values of the sensor. Let's say temperature to be 25, pressure to be, let say 729 millibar and humidity to be 45. Now if, if these are the values, then my program changes a bit. The only change is instead of sense underscore hat, we have to make it sense underscore AMU, nothing else changes. Instead of sense underscore hat. What we have to do is we have to make it since underscore AMU and the same code will work for emulator. Now this is okay if you are more interested in IoT and you may just want to get on with the sensors, even if you have a hat. If you are like me, then I wouldn't, I'm pretty sure you will buy this inset because it is very interesting. Now let's try to do this score. I'll copy it from here. And let's take a new program. I'll save it. And I'll just name it hat underscore, AMU, underscore test. So the program is pasted over here from sense underscore AMU import sensor. And then the values will be printed over here with a delay of 1 second. You can see the values are coming here. Now if I change the value in the emulator here, the respective values should be changing. So the temperature Alice has changed. You can see now it has become 43.5. Humidity is 45. Let me reduce it here. So it's, it points something now. And the pressure 729 something. Now this is how you can emulate this values. I'm not saying this is the only way. If you have the hardware synset with you much better, you can see this ansatz sensor values in practice directly and see the output of them. Till then, you can use the emulator. Moreover, talking about the sense that it has got number of interesting interfaces, including the nice RGB display that it has. So you can also display colors onto the Sense HAT. But this different commands. You can just go on through this tutorial in detail. It's very interesting. So a single message is displayed onto the LED matrix, where the message is seen in a scrolling fashion, as well as on an eight by eight matrix you can run. Or you can also display some colors like this. So this Miley button, it's created or smiley faces created like that. You can create a number of different interesting phrase sense or any effects using the RGB. It bad metrics. For now, we are interested in to this three sensor values, temperature, pressure, and humidity that we have seen out of the sensors. You can perform a more experiments on percent sat by looking at this simple projects over here. There is nothing much to explain about. This ends at all the interfaces and everything is taken care of by the operating system itself being a complete original Raspian product or Raspberry Pi product, there is nothing much to install or there is nothing much to look after. The sense that if you don't find the sample codes, you can simply go to Start Menu here. Were to programming open the Sense HAT simulator. You will get this inset emulator over here. And then through insensate emulator. You can open the examples. Simple examples, intermediate examples, and advanced examples. That is enough for getting you started with Sense HAT and Raspberry Pi. So do some experiments at the emulator and see the output. And if you have got a physical sense at, then tried to connect it and then see the output for it. Thank you for watching this video. 30. Ultrasonic Sensor Interfacing with Raspberry Pi: Hi there, told we are going to see how we can interface an ultrasonic sensor with Raspberry Pi. Along with the explanation of the Python programming. Let's begin. Now. This CSR 0-4, it's a very popular low-cost ultrasonic sensor, which is used in number of different DIY projects and number of different systems. It's operating voltage is plus five volt. But we know that Raspberry Pi's operating voltage, or the GPIO voltage is only 3.3 volts. So we'll see how we can interface it with the US vary by the measuring angle is 15 degrees and the ranging distance, it is from two centimeters to four meter. Now this sensor works on a reflection phenomenon. So one of the two transducers act as transmitter. So the transmitter will emit a short audio bust. And when it is reflected back from a surface, then the same is received by the wrist second transducer, which acts as a receiver based upon the time required or the time period between transmission of audio and deception of the audio, we can find out how much was the distance calculated. And because it, it's calculated based upon the speed of sound, the accuracy is pretty descent. Let's see how it is actually done. So it's a four pin sensor, as you can see, it has got four pins, VCC trigger, ICO, ground USE needs to go to plus five volts. Ground needs to go to ground and trigger an eco needs to be given to the controller, like Raspberry Pi or Arduino or ESP 32. Now what we do is we give a very short ten microsecond pulse to the trigger pin. Apps residue, a small ten microsecond pulse to the trigger pin. A small audio burst, or a simple audio burst of ultrasound audio. It's transmitted. Now when the audio, it's transmitted absolute as the audience transmitted from the sensor, the Ethiopian becomes high. As you can see here, the coping becomes higher. And wherever the audio reflects back from the surface and is received back onto the sensor, the Ethiopian becomes low. So the total duration of this Ethiopian corresponds to the total time period taken by the audio to transmit from the transmitter to the obstacle and back from the obstacle to transmitter. Now in order to understand this, let's try to make it in a diagram. So we know that the duration of echo pulse will give us the time period, how this time period is utilized. Let's see. So the audio is transmitted from one of the sensors. And when it is reflected back from a surface, it is received back by the second sensor. As soon as it is received, the ICO signal becomes low. Now, the distance calculation is like this. We know that the speed is equal to distance upon time. And therefore, distance is equal to nothing but speed multiplied by time. Here, the speed is the speed of sound. However, we are not performing the calculation of distance and the obstacle. We are performing the calculation of distance at the sensor end itself. What it means is the audio travelling, it is travelling Actually the double distance. So this is the total distance, Let's say x. But the audio is going from sensor to the abstract and from obstacle back to the sensor. So we can easily understand that the distance traveled is 2x. Therefore, what is done? Distance is equal to speed multiplied by time divided by two. Or you can also do it like this, speed divided by 22 times. So let's see how we can convert it into a Python program. So the speed of sound is 344 meter per second. If I want to do the calculation in centimeter, then it is 34400 centimeters per second. Based upon this will perform the further calculation. Now this is the calculation as simple as that. So what we do is we simply make half of the, or we simply assume half of the speed. You can assume 343 or 344 doesn't make much difference in calculation of the distance. And the formula that comes out to us, it's 17150 multiplied by time. Now we got the formula, but now we have to understand how to find out this time or how to find out the high duration of eco pulse through the Python programming. Now this is the interfacing diagram. What we do in interfacing diagram, it's simply this C. So if this is my ultrasonic sensor, then it has got this board four pins, VCC trigger, eco, ground. When Cs is directly given to plus five volt on Raspberry Pi, ground is given to ground. The trigger pin is also given to Raspberry Pi pinning or Raspberry Pi GPIO. Because the trigger is input to censor, it doesn't affect the GPIO. But Ethiopian is output from sensor and input to the raspberry pi, and it is working on five volt logic. So what we need to do is we need to reduce this voltage down to three or 3.3 volts. So what you can do here is you can simply connect a resistor network like this. If you keep the value of one K and 1.5 k, then whatever voltage that appears at this point should be when you apply five volts on this pin, the voltage appears here to be three volts. So you have logic of five volts and 0 volts becomes three volt and 0 volt at this point, which is therefore suitable to interface with trust SVD pair. In our sample, we have connected this to GPR number 20 and the echo pin two GPIO number 21. Let's look at the diagram. This is a breadboard configuration which I have shown here. So we see c can be connected to the five volts pins of Raspberry Pi. Ground can be connected to ground pin. That trigger pin directly goes to 21 number GPR 21. The echo pin is given with a 1K resistor, and then there is a 1.5 k resistor which goes to ground. The center point of this two comes down to our Raspberry Pi GPIO pin, that is pin number 20. Now let's look at the connections that we have made on the US very pie with a breadboard. Now as you can see, this is the ultrasonic sensor that we have inserted from facing this side. Then the VCC, the ground pin, trigger an echo pin. If you can notice, the two resistors are also connected to form the kind of circuit connection that we need. Over here. I didn't think so that would be much clearly visible. And therefore, this breadboard circuit diagram is given. Now let us try to write down the program and run it. So this is the placement of my sensor and I can keep my hand like this over here. Now let's go to Raspberry Pi, and let's look at the core. So this is my Raspberry Pi and this is the program for it. Let's open it was Anthony. This program is written in Python three, and it will work on Python two as well if you're using, but better to avert a Python two. Now, let us see the program. So we have imported the Rpi.GPIO library as GPIO imported time library. And then we have declared the trigger and echo pin over here. And then we're setting the mode as BCM because we want to use it as the GPIO pin name. Then this is the while True program or while true loop, which will execute infinitely. We have given the distance measurement in progress commands. Then first of all, what we are doing is we are making the trigger pin, workouts output pin and the Ethiopian work as input pin. You can give these declarations here also before starting the program. Now what we do then is we create the trigger pin or we make the trigger pin low. Let's see how this logic is actually created. First of all, what we will do is we will create the trigger pin low that will stabilize the sensor a bit. Then what we will do is we'll make the trigger pin higher. This will do what? This will send. The audio bus will keep it high only for ten microseconds. And then we will make trigger Pin Lu. Now at this point what we will do is we will monitor or we will read the Eco's signal. What we want to do is we want to monitor eco signal at this point. Now we had said that whenever the trigger pin is given with some pulse, then the Ethiopian becomes higher. So what we will do here is we will monitor the ICO signal or vile ACO is low. We will wait here and start a counter, and then it becomes psi. So what we'll do is vile, ACO is high, will wait here and update our counter. Now the counter is updated using a function called time. So Time.deltaTime returns epoch time. Epoch time is basically the total number of seconds which has elapsed from first January 1970, midnight, 0.0.0, 0. Why we use time got time function is because it gives us a continuous stream of seconds that are passed from 1 to next. So what we will get is we will get the latest time at which the trigger Ethiopian become higher and we will get the last time when the trigger pin become low. So we will have this pulse in time and this pulse startTime. If you subtract the pulse startTime from pulse in time, we will get the total duration of this pulse, which we can multiply with some number and get the distance. Now let's look at the code how this algorithm, it's spread out. So distance measurement in progress trigger pain made higher than Ecofin is input, sorry, trigger output, ego input, then trigger matter false. Wait for some time here, and then we make trigger pin true or higher. Then what we do here is we wait. We keep it high only for ten micro seconds. Then the trigger pin is made false. Now we wait here. Wait till it's low. And what we are doing is we are recording the Time.deltaTime means in Pearlstein water will happen is the latest time will be present before this while loop breaks. When the while loop will break, when the echo pin becomes higher, mess the pulse start will record the time when the echo pin became higher. Then the next while loop is viable. Gpio.input ICO is equal to, equal to one. It means that we are visiting here till ICO is high, means the total duration of Ethiopian We are waiting at this particular point. N is equal to Time.deltaTime. It means the pulse end will continuously keep record of the time or the total number of seconds. It will only brick or it will record the last entry when he coping becomes 0. Thereby impulse end, we have the last second or last time of Ecofin being higher and PR start as the first time of Ethiopian being higher. So pulse duration is equal to pulse end minus well, distance is equal to pulse duration multiplied by 17150. Here we round off the distance and we are printing it over here. The program will be repeated every two seconds. Now let's try to run this code. The distance sing or distance recorded is 35.73 centimeters. Now if I bring my hand a bit closer to the sensor, now you can see the distance is 15 centimeter. If you take it closer, the distance comes out to be four centimeter. It should not be assumed correct, beyond four centimeter. And as you go forward, the distance value will vary accordingly. You can check it with a scale. If you have how accurate the distance calculation is. It is very, very accurate up to the scale of the core and the circuit diagram. And the presentation is given in the link which is given below this video. Please download the code and experimented for yourselves. Thank you for watching this video. 31. BMP180 with Raspberry Pi: Hi. In this video, we'll see about a sensor which can be interfaced to the US very pi over I have to cede pins all over. I do see protocol. Let us begin. So this sensor is called as BMP 180, which was also previously available, adds B and B 085. The beautiful thing about the sensor, it's integrated very small form factor sensor, as you can see here. And it has got an I2C interface. Now we're tied to see interface. The benefit is you all need only two pins to interface it with plus vdp. Those groupings, alcohol, that's SDA and SCL mode about how I perceive works and what are the details about I2C are given along with this video, which you can read in your spare time to interface this with Raspberry Pi and to write down a program for retold liver, it is not required that you have to have a complete understanding of I2C. You can just not the basic fundamentals and you can start writing your program by introducing this sensor with Raspberry Pi. So let's see what this sensor gives. This is a Bosch manufactured sensor which gives integrated temperature, pressure and altitude values. It works on 3.3 volt power supply. But the sensor model at such which looks like this over here, we don't use that, but usually purchase are big ECB, which is having the sensor on it. So you did not worry about the powers of life. And if you apply 3.3 volt or even if you apply five volt here, it will be converted to 3.3 volt for the sensor using the on chip regulator. At said, it works on I2C protocol. And one another benefit of IPC protocol is academic. You can also connect to multiple devices on I2C. And just give you a very sharp idea about it. Not technically, but how physically I perceive evoke. So if this is the Raspberry Pi that you have, then I proceed has got two prints at said When it's called deaths SDA. And another one is called deaths as C L. Now, with this two pills, what happens? You can connect one to our multiple such sensors directly. Let me show you how we can connect two of them. So this devices will have the same pins called SDA and SCL for interfacing. And every device has a specific I2C address associated with touch. With that address, that device is identified. And we're gonna interface many devices at a time. Since the addressing I2C is a seven bit address, therefore, a maximum of 128 devices can be connected in I2C bus because 7-bit addressing can generate address from 0 to 127. So this is how we can interface it with vast VD by at the time if you want, you can also interface too different. The same BMPs. It favor a BMP when it is sensors, but in that case you will have to change it centers. Now let us see how exactly we can use this sensor. So if you buy a model of this sensor, most were Beverley, you will get something like this or like this shown here. So it's a complete sensor model which has also got on chip voltage regulators. Now, if you look at the IPCC pin out or if you have to look at the Raspberry Pi when out are the totality belt structure, then you can identify the i2 sequence lengths. So this one over here, its SDA and pin below it. It's a CL, which are GPIO2 and GPIO three I2C sensors should not be connected to any other GPIO. It shouldn't must be n. It should be always only connected to recipients. Raspberry Pi has gotten I2C on the processor itself, and therefore, just taken note of the spins and let us see how we can do business sensor. So this is how the introducing will go. As such, it is very simple. If you look at even here, you can get to know about it. So you have to connect this VCC to 3.3 volts, kind of ground to ground, connect the SCL pin, a seal, and connect as reopen to SDA. So that search and the sensor its interface to plus 30 bite. But it doesn't end here because I wanted to interface the sensor to Raspberry Pi. We have to enable the I2C off last VD by, by default, when you install operating system on it, the I2C is not an average. So the first thing to do is we have to enable the I2C protocol. Let's see how we can enable the I2C protocol on Raspberry Pi and see if we can connect the sensor properly to it of March. So these are the steps to enable the I2C industrially pie. We will have to open up the Raspberry Pi Config menu using a command called Sudo, Our SPI hyphen config, then such a window will come up there. If you look into the seventh option that does this, or sorry, not seven to the fifth option that is interfacing options. So if you have drew or if you go to the interfacing options, then you will see another interesting option like this, where you can enable the interface for Canberra, SSH, VNC, SPI, I2C, CDL one wherein the MSP Oh, we're you must have done or you must have gone through it to enable the association VNC before. Now, go to the IOC. And then simply an avalanche. Once you enable the I2C interface in the Raspberry Pi GPIO. And once you connect the sensor to the Raspberry Pi, you can then check if the sensor is connected properly or not using a very simple command. Remember after enabling the I2C, always remember after enabling the I2C restart is important. You have to restart the Raspberry Pi after enabling Ibis. And then you can use this command, sudo I2C detect hyphen space, hyphen vajra space one. After this command, a list of devices connected to i two c will come up, which we showed the address of the BMP went into sensor that you have connected to Raspberry Pi. If it is properly connected, if not, the address will not be shown. So that's a very simple debugging to know whether the sensor is properly connected or not. Let us do all the steps practically in the next video. Thank you. 32. Enabling I2C On Raspberry Pi: Now as you can see, this is the BMP. When it is sensor that I have, it's quite small in the form factor. That's how it looks. On the bottom side of the sensor, you will see the pin names are mentioned when grown a seal SD, depending upon which model you have, the order of the pins may change. It may not be the same. However, you have to make sure that you connect it properly. So let's make the connections. First of all, I will connect a V1. So this pin should, will do at specified VCC, you can connect it to five volts or 3.3 volts completely up to you. Then connect the ground pin that I'm connecting next. And shown in the diagram. Branch. Make sure to connect all the connectors first, here I'm using the female to female connecting wires. Now the VCC is connected, now the ground is to be connected in this bin here. That's okay. Then the next spring here on the sensor is far less as seal after the Mississippi and drones. A CL, as shown by the green figure here, should, will do the third pin from the left-hand side of the number five. So this is a C and then C SVA on data. Now, my sensors connected to Raspberry Pi. And let us open the VNC viewer and tried to enable the I proceed to this over here. So this is the Raspberry Pi login. This simply open, I'll just skip this camera windowsill. Open the command prompt. And then we'll do sudo ADA SPI, hyphen config disciplines the Configuration window for us at cell B2, interfacing options. And then I do see interface options. Just what do I do three and hit Enter. It will ask, would you like the arm I2C interface to be enabled using your left arrow key, simply shift to yes and hit enter. That will enable the arm I2C interface. Now just vote to finish. And Ed said nuh-uh, reboot. Once you perform the reboot, we can use the command prompt to check if the sensor is properly connected or not. The remote usually takes around ten to 15 seconds. So let's just wait here. As you can see, the sustained has remote. So let's open the command prompt and let's check if the sensor is connected appropriately are much. So open the terminal and the command to check its pseudo. I do see detect space, dash or hyphen vajra, space one. Solo, I facilitate hyphen while spins one and simply hit Enter. Now can you see something at the address called 77? It's appearing over here. It simply means that our device has been properly connected to the bus. If, for example, if I remove one of the vial slips and I'll remove this is deep in the last year, the last SDP Nolan here. And I have removed one layer here. Now let's try to run this command again. We'll see that now what happens? Now you can see nothing. It's shown over here at address 77, or in fact, the 77 address itself is not shown. So it will show up or it will come up on leave and you connect the sensor. Now I have connected the sensor. If I rerun the command, again, I can see 77 coming apart here. This means you have properly enabled the I2C of Raspberry Pi computer. And you have also properly made it dividing between the sensor and Raspberry Pi and the sensor, it's properly and healthily connected to the computer and is now ready to use. And the next video, we'll see how we can let down program for rich and see yourself porch. Thank you. 33. BMP180 Python Code: Hi. Now that we have seen how we can enable I2C for us with the fire and how to connect the sensor. Let us try to see how we can die Donald program for rich. Now before I dig up Nam 48 andar SVD by there is important that we install the IOC deleted liability for Phyton industrially path. This is the command to install the liability in by the Raspberry Pi. So they get install Phyton assembles. Once I install this library, then we'd be able to see how we can. I don't program for this sensor. So let's begin. So let me close the presentation now, which we don't want anymore. And now let us login to other US VD by VNC viewers. The IP address of us, the Debye. And here we are. So I'd said fostering for our students, installing the liability. The command for the liability is pseudo. Mpd, get installed, or you turn hyphen as Nimbus. Most probably the liability would only be present in your last visit. But if it is not, then this command will help install the library for you. Just hit Enter and see what happens. The command sets by ten assemblers liability is already the newest version, so we don't need to worry about it, the liabilities or the very latest. Now let us look into the quarter voltage. Now what I've done is I have written the code for this particular sensor in two files. One acts as a package or library file, and another one will be our main program from which we will call this package. The package is called deaths, BMPs, and server.begin. And all you have to do is you have to keep this package in the folder where you want to keep your main program. So whenever you are creating this program, it doesn't matter if which is on desktop than desktop. If it is on any other folder, then keep it in any other folder. The only thing is this file should be present in the folder that you are going to write down this score. Let's look at the code. Now as you can see, this is the Destin core for our BMP pressure and temperature sensor module that we have created. The program is very simple. So what do you have to do first is import BMP sensor. That is the reason I told you to keep the BMP sensor dot py library in the same folder that you have kept the main program or your testing program. So it can be tested. Pm2.5 are customized sensor dot py or my main program dot pi. It can be anything, it doesn't matter. The only thing is this BMPs and server 55 should represent in the same folder. So important BMP sensor then import time to generate out of conduced some dealings. And this is all we can read it. Remember, the order of these three values is important because this module or this library that we have, returning the sensor values in a prescribed order only. So first it returns temp, the second value returned is pressure and the target value return this altitude. Temperature is in degree Celsius, pressure is MBA or Pascals, and altitude is in meters. Now let's run the program and see if the values are correct or not. So this is giving us degree Celsius. This is giving us permission. In Pascals. You may want to convert it to kilopascals by a blanks and formula. Far No, let's keep it in Pascal. And this is going to give us the altitude in mitosis. Looks it on the board. As you can see, the temperature is 30, pressure is 94,600 something, and altitude it's filed 74. So this is for my own geographical location. Temperature is, of course, my room temperature. So if I start an air conditioning unit now, the temperature will start to reduce drastically. And if I just do something with the sensor are let me just rub my hands a little bit. And if I just touch it over here, then the temperature readings should be immediately increased. You can see 3334, something like batch. Make sure you only touch this metallic part and don't touch DIY. Electronics socket bark on the tiny components over there. So you can just rub your finger to a surface. It becomes quite taught momentarily. Now see that temperature sensitive thirty-five point one. The pressure and altitude values are not going to change no matter what you look. Another way to increase the temperature, it simply press that model a little bit like batch and you can see the rise in temperature. So now it's 35.1 degrees Celsius. So this is how you can write a Python program and then incorporated in any of your project programs or any of your projects. Bmp vanity is a very easy and simple to use sensor, which can be incorporated with glass VD by thank you for watching. 34. Getting Started With IoT: Hi there. Now before starting developing an actual IoT application, let us try to understand the details about the background networking involved in IOT. So let's begin. Now here, lets clear our understanding till now by looking at this simple block diagram. And it's very clear based upon this that what we are going to do is we're going to need a particular embedded processing unit, just like microcontroller or Raspberry Pi. Now why do we need this particular embedded processing unit is to actually process the data coming from sensors. Or if you have to turn on or off any actual physical device, then the same has to be done through this controller. This controller is also responsible to talk with this network interface and send this entire information or sentence infer data right over to internet. Now, so far, in whatever discussions that we're going to have, or whatever discussions that we're having. This controller for us here, it's Raspberry Pi. And we have seen a number of different inputs sensors, as well as we have seen how we can make some output devices go on and off. All of these. So far, it's run by a, some software which is written inside our Raspberry Pi, which is till now present in python programming language. Now let's see, what else do we need or what else do we need to have in order to create an IOT application? So these are the next steps. So right now the very first step is to connect our system to internet, then send the data over a communication channel, like so deciding a particular communication channel to connect to internet and send data. Then after having decided the communication channel, we have to understand what protocol we have to use in order to send it to our Internet-based survey. Once the data comes onto the server, next thing is to understand, or next thing is to see how we can visualize the data and then perform some valuable analytics based upon our data. So let's see. Now, when it comes to connecting to the internet, there can be two options. One is a direct connection and another one is an indirect connection. Direct connection, it's something where you have a direct connectivity either in terms of land, Wi-Fi or cellular network. So in direct connection, what is happening, your device or whatever your controller you have, let's call it D, is directly getting connected to internet through some mechanisms like LAN, Wi-Fi or cellular network. Indirect connection is a kind of connection where the controller or where the device that you are using is not having any capability to get directly connected with internet. In that case, what we have to do is we have to make use of some other communication protocols like Bluetooth, Zigbee, or any other RF technology. So what happens is if this is your sensor device or this is your end device, then it will communicate its data through some other technology to a host, which we'll also call it as gateway on hosts. This communication may happen through a number of different communication channels. So this can be, this can be RF, This can be Bluetooth. It can be a number of different technologies available. And this gateway will then connect directly to the internet and send the data. So this is an indirect communication, and this is a direct connection to Internet, both of which are needed depending upon the application at hand. Now let us see what are the IoT communication requirements. Now, you have to understand this thing very clearly, that every IOT application has its own requirements. This connectivity applications which are working very good, very nice for one application, it may turn out that the same connectivity option is completely useless for some other kind of application. Now in order to understand this thing very well, let's see what requirements are applications can have. For example, if I see about this force requirement, we can have thousands of remote sensors to send the data onto the internet, and therefore, the battery life is a critical considerations. In many cases. In many cases, your battery life is expected to run for several months or even for several years. So here the prime requirement is battery life. Then second time, there can be a case where we have a lot of heavy data, like videos or images. In that case, high bandwidth is essential in a third kind of requirement. What happens is whatever data that we're sending, its very important. Let's consider banking information or your credit card or debit card information. In that case, your security is most essential rather than the battery life on high bandwidth. And then there can be some cases where there is a life or death decisions which are to be sent over the internet. And therefore, here the most important aspect is time, not even security, not even bandwidth, and not even the battery life. The most important lessons you factor is the time, time that it takes for data to travel from defense to Internet and from device back to the, well, from Internet back to the device. Therefore, the time is most important criteria here. And remember, a single application will never have all of these requirements. It will have either one or two of these requirements whenever you are creating a particular application. In a nutshell, these are the communication requirements and IoT, low battery life, high bandwidth, security and latency. Latency should be as low as possible. It means it should be very fast to send the data over internet and get the response back. Not depending upon this communication requirements, you can choose the communication protocol as well as you can choose the solver where you're going to send the data. Now let's consider some applications and remote area. For example, there is a classic example which I had walked on that wasn't jungle. So whenever you have to deploy an application in jungle, let's say for fire detection or let say for gunshot detection. In that gives direct internet connectivity is not possible. And therefore, we need to route the data through some channels using communication like ZigBee or RF. So in that case, there is no direct connectivity. Here the connectivity from sensor is taken through some different protocols, and then a particular gateway will then transmit that data to internet. In our case, where we are using Raspberry Pi, our ultimate goal is to connect with Internet and with Raspberry Pi. We have these two options directly available with us. That is land as well as wildfire. Let, depending upon which microcontroller you have, the option of using land, Wi-Fi or cellular connectivity to perform a direct connection. Acid Raspberry Pi already, hence, these two interfaces. So with Raspberry Pi, we have a Wi-Fi as well as LAN. Bluetooth is also there. And most important is LAN. Bluetooth is also there. But we use land or Wi-Fi because there is a direct connectivity with these things. With Bluetooth, what you can do is you can connect to the Raspberry Pi with a phone, which can act as a hot spots, and then it can connect to internet. So that is also an option. That is just an option which is present to us if you are chosen some microcontrollers or if you are not having Raspberry Pi, that application. And if you have created your application on a microcontroller, then there is a possibility that the microcontroller that you are using may have an on-board Wi-Fi. Now to give you an example here, ESP F66, as well as ESP 32, deserves some very popular microcontrollers, which do have an on-chip WiFi, which can connect with your local Wi-Fi network. If you don't have, I find just like Arduino Uno for example, doesn't have any network interface. So in that case, you can use an external Wi-Fi module or internet molecule or a cellular model. Cellular modules like 800, same 800, eight are very nicely to give a direct connectivity to a microcontroller. Now, the connectivity has to be sorted for us with respect to Raspberry Pi, the collectivity, it's sorted for us, it is either land or Wi-Fi. The next thing to understand once getting connected to the network is how we are actually going to send the data over the Internet. There are a number of different communication protocols which are used in, OUT. Most primarily the most popular and the most common, 1A, HTTP and HTTPS. But apart from HTTP and HTTPS, there are several other protocols also like COAP, that it's Constrained Application Protocol and AMQP, MQTT. Mqtt is Advanced Message screen protocol, and MQTT is messageQueue, Telemetry, Transport, HTTP and HTTPS. Although they are secure and they have a lot of different features, many times they are not suitable for IoT because the number of data that we have to send, the latency that is expected, we need very fast communication and sometimes HTTPS cannot drew correct onto that particular requirement. In such cases, what we have to do is we have to have specialized protocols for IoT, Lixue, APO, MQTT. If you have heard about IoT for some time, then you might know that MQTT is now considered to be a de facto standard for creating IoT applications. We'll see about all these protocols when we have to create an application onto it. For now, let's see what is and how we can use HTTP for creating an IoT application. Now if you have to use HTTP to send data, then it has to be in some form of GET or post requests like XY is forward slash, my temperature is equal to something and something like that. So this is how data can flow through HTTP. And therefore, in order to test the communication using HTTP protocol now will see some different cloud applications with support creating such an application. So let's say the cloud applications now, and let's try to create an actual IoT application with it. Then we will study in detail about MQTT and then try to understand how MQTT Vox and then get an application or create a project on MQTT as well. Thank you for watching this video. 35. Getting Started with Microsoft Azure IoT Hub Part 1: They're now understanding Internet of Things, application development. You have got one thing so far now that what we need to have is a baseline device, which can actually communicate with the sensors and get the read Tao that is needed instead, the memory. In our case, that device here is raspberry pie. And it can be connected to numerous different types of sensors. Now what we have to do next in IoT, it's very to get this data through an internet connection to something called as cloud. Or we need to basically get d zeta onto Internet on some cloud computing server. Now if you remember, we have had a discussion about cloud services that there are primarily two types of cloud services available. One it's called ads platform as a service, and another one is called as Software as a Service. Now in PAAS, In this course, we are going to discuss about Microsoft and soon. And then we'll see about some other essays product also, that is things speak. If you understand the USSR first, it would be very important later on to see how these different software works. First of all, what we'll need to do is vary to study things about Microsoft associate. Now with PAS service guides, you need to know one thing that it's a complete platform given to you in order to create your applications. It's literally a platform and there is nothing ready. So we need to create whatever we need to do over here. With respect to Microsoft Azur, they provide us with two services. One is called as a sore IoT Hub, and another one is called as a zoom OUT central. Now, IoT central is again the Azores stake on creating a software as a service. Whereas IoT Hub is an entirely platform service. So this is what we are going to discuss first. And in order to do so, what we're going to have or what we're going to need is create an account on assert. So let's first do this thing. Let's create an account on Microsoft Azure. If you have to create the account on Microsoft, assume what you will need is you will need your email address. Then you will need your phone for verification, and then you'll need your credit or debit card. Now why credit or debit card is needed? Because Microsoft, assume for the sake of authentication, will charge you a very small amount on your credit and debit card. And the same amount is also refunded. Don't worry, this amount is not like some hundreds of dollars or some ten hundreds of rupees. If you are worried about that, don't worry at all. It's a very, very small amount, and that too is again, credited back to you. Moreover, Microsoft Azure, it's completely free for one month. Okay? So completely free for one month. You can do anything and everything in this first one month free trial. And after finishing your one month, you can opt for opt for pay as you go. Now what happens in pay as you go method is you only pay for the services that you are using. Now in my case, my own account on Microsoft Azure, it's currently into the pay as you go subscription and streaming and not charged more than $5 per month. So don't worry about it. Let's first create a free account on Microsoft Zune. And let's start studying about IoT hub. For the first month that you have the USSR free of cost, you can experiment quite nicely with a zoom and almost get done with every exercises that we have to cover. So let's get started with creating an account on Microsoft assertion. 36. Getting Started with Microsoft Azure IoT Hub Part 2: Now to grade Microsoft Azure account, open a web browser on your computer, and head to portal So portal is a place where you can create your account directly. Otherwise, we can also come to this place by simply searching for a XHR and then go into the homepage of Microsoft as well. So this is the homepage of Azur. And from here you can see there is an option to create a free account. So if I click on free account, then it will ask me to start free or by now. So let's start free. And after you start free, it is a series of steps which involves putting your email address and then some details. So let's see. So first of all, if you have a Microsoft account, you can sign in with that account. If you don't have a Microsoft account, then let's click on Create one. So I'll create, I'll click on create one. Now I'll have to enter my email address. So let me enter my email address. After putting email address, let's click on next. Until asked to create a password. So I've entered a password. The next step is to verify the email. So let's open this email address in a separate window. And let's try to verify what you should have received an email like this from Microsoft. Verify your address. To verify your address, use this security code and there is some code given. So let's copy that code and put it over here. Then click on next. So the account verification, the email verification has been done. So now there is some capture that I have to enter. So that's the capture. And now the Microsoft account has been created. Once a Microsoft account is created, the next thing to do or the next step to do is to create d as soon account. Let's see. Now let's click on the email address. Let's put on the emulators that we have created. Now that's Microsoft account we just created, and that's a password for it. Now at this point, you'll be logged in with the newly created account on allure and you will come up with a similar page like this. So the first thing to do, it's trials for free as the notice sits, and then you have to enter all your details. Now here, I will not be entering my details because I already have an account and I can create only one, so I'll enter the details of my wife. Who's account I'm having right now. You'll have to give your mobile number. And let's call the organization to be whom. Then it will also verify the identity using phone. So let's click on Text me. And it will receive a text message with the identification code. So I haven't saved the message. This is the code that I have. So before identity is done in this way, now the phone verification is done. The next step that is we have to do is identity verification by card. So you won't be charged unless you upgrade. You can also go through these features over here, 12 months of free products. This is the free credit that we get, 25 plus always pay products and no automatic charges at all. So unless you upgrade, you won't be charged anything. Don't worry. He'll give you a card details, not the cardholder name. Details about your card. The card will be verified. 37. Getting Started with Microsoft Azure IoT Hub Part 3: Once you have created your account on a zuo, Let's go to portal and then sign in over there. So using email ID and password to login to Microsoft and soon. And when you login to Microsoft Azure, The very first thing you will see is a simple dashboard like this. So first of all, what you have to do is get comfortable with Microsoft Azure because we're going to spend some time over here. Now, I am into a piece as you go subscription. But if you have created your account recently, then you are into the free subscription and you have a lot of credits which you can utilize free of cost. Remember, the credits are there for one month and even after one month, you are not charged unless you subscribed for any particular plan. If you have some services created aerial account, they will be halted after the first month is completed and they will not resume unless you opt for a subscription. So you can experiment worry-free with Microsoft Azure without worrying of getting charged for anything. Now, the cloud computing fear aware about the cloud computing architecture, then let it be Microsoft as 0, let it be Google Cloud, or let it be AWS for Amazon Web Services, more or less the format of the USSR services, of the cloud services, it's same. So there is a button everywhere where you can see or where you can create a particular resource. Then the service list down over here, what all resources you have. So this is the Azure marketplace where you can select a particular service or this source and then start working on it. So there are plenty many services here. Windows Server, Ubuntu server, web app, SQL database, a lot of different things are there. Storage account, then in the same services or new resources tab, you can search for internet of things, which we are interested in to now. And then there are different IoT related services which are listed over here. Now, what we have to do in order to start experimenting, as we have discussed, is we have to first create this particular thing called deaths IoT Hub. Iot Hub here is, you have to understand first thing conceptually, what is IoT Hub? So in this entire ocean or in this entire platform called Microsoft Azure, IoT Hub is just one service. It's just one piece of the service. And what you can do with this piece of service is you can create an IOT application. So the process is like this. First, you will create an IOT hub, and then you will create a device under your IoT hub. This device, it's your entity, your software entity, which resembles to the harder entity that we might have. For example, if you had asked very Pi over here, with which you want to experiment. Then this is the physical Raspberry Pi computer you have. And this device that you create instead, IoT Hub, is the software entity which resembles the Raspberry Pi or whatever data this Raspberry Pi will send between synched to the device that you have created over there. Let's see how we do that. So it's a bit difficult to imagine theoretically, but let's see how we do it practically. So first of all, what we have to do is go to create a resource and then go to Internet of Things. In Internet of Things, what you have to do is you have to create or click on this IoT Hub. So I'll just click on the IoT Hub. Now, once you click on IoT hub, it will ask you to select a particular subscription for you. Now, since mine is not free subscription and therefore it's showing my subscription name that summit answer for you. It might be free trial if you have recently created your account. So just selectors subscription here. And then you have to select a resource group. For a fresh account, there might not be any resource group, so you can simply create new. Remember this is a new concept. Again, resource group is just collection of your sources, a collective name to the sources that you are creating. This, understand it like an insider group which we might want to create over here. This is needed. So this resource group will take all the related services that you create in your Asura count. So let's create a resource group for yourself, like clicking here and then select it from the list. I'll choose CloudShell storage, central India for me. Then region, keep it as it is, is 2S. This is actually the physical reason where the services are. Service provider is located. If you click on this Ising model here, as it has more global regions than any other cloud provider, offering the scale needed to bring applications closer to users around the world. Preserving data residency and offering comprehensive complaints and resiliency options for customer. What all it means for you is when you are creating an actual application, whether you're creating an actual product, then it would be much better to choose a region to close to your deployment. So they have Australia, Japan, Korea, South India, Southeast Asia, Canada, France, north Europe, UK, then Brazil, Central US is US. Not, not centrally with South Central US, West us, lot of centers are there. For now. I would recommend you that don't change anything whenever, at least you are experimenting with it. And then simply give you an IoT Hub limb. So I'll give my name as my PI hub. You can choose any name you want. If the name is available, it will be shown. If it is not available, it will be shown as well. So my PI hub name is not available. So let me call it my IoT Hub. Let's say if it is available, it is also not available. Now lets call it Ahmet hub. Yes, it is available. Now go to next size and skill. Here. You have to understand the size and skill here for IoT Hub. So we have several sides and skill options. Adds, let me tell you. So there is B1, B2, and then there needs to be three. And then there is S1, S2, S3. And out of all this data is F1. Let see what are this. If you choose s1, t, you can see, you can have 400 thousand messages per day. And these are the costs per month plus all these additional services are enabled. I won't talk about all these additional services now. We'll talk about them when needed. If I choose a studio, you can see the number of messages has been drastically increase to 6 million. So it's the charges permanent. If I choose S3, you can see the number of messages and costs are further increased. All the services have been an avalanche. Now if I choose B1, you can see the messages and same as S1. But the cost is less because some of the services are not available. Similarly, there is b2 and b3 packages are almost the same except some services which are available only in S1, S2, S3, and not available in B1, B2, B3. What I'm interested in, it's creating an F1 tier where only 8 thousand messages per day are allowed and all the features are enabled. This is enough for us to perform all the kind of experimentation that we want to do. Now let's click on Review and simply clear. Now the deployment at starter for IoT hub, it will take some time. And once done, it will be shown to you over here. Once the deployment is done, you will get a message over here in the notifications log. And sometimes it takes longer time than usual. Now you can see the message comes up. Your deployment, it's complete. All you have to do now is click on go to the source, and then you will be inside the IoT hub that you have created. The details will also be shown to you like what is the current location, what is the pricing entity or how many number of hubs you have created? So that's about it. In the next video, we'll see how to create a device and then start sending the data on to assume IoT Hub. 38. Create Device inside Azure IoT Hub: Hi there. Now this is the IoT Hub that we have just created. In our last step. I would like you to look into all the different settings that comes when you try to create a new IoT Hub. But make sure you choose this plan as F1, F3, If you are in to the free trial or if you are in the first month of your free trial, then it doesn't matter whether you choose B1, B2, B3, or even S1, S2, S3. Because first month it's completely free and you have a lot of credits to be used for default Month, so it's okay. But if your first month is done and if you are experimenting like me, It's better to choose F1 even if you are into the payment subscription just like me, the F1 subscription, it still free. So better to choose F1 in that case. Now once the IoT hub has been created, it shows here in the same overview window how many messages you have sent for the day, how many IoT devices you have, then how are the different operations and some graphs about it over here. So that's about the IoT Hub. What do you need to do here is then goes straight down and look for this option called IOT devices. You will see that option here in overview. If by some mistake, you closed your window after creating IoT Hub and then not able to find it out. The let me show you. So whenever you go to your home, you will look at such a resource like this. It is sent to the sources. And even if you find it in that way, what you can do is you will just click this three dots over here and click on all services or all resources. So when you go to all the sources, it will list the resources that you have created. So i have yet created only IoT hub. That's why only this wonder sources shown. So let me go to that. Then. A window like this will appear into this. You have to search for something called as IoT devices. So just go to this window and just see IoT devices here. If the USSR options have changed because the change almost every month, then simply search here for IoT device and you will come up with this. Iot devices tap. Once inside the IoT device is, you will be able to see the number of devices that you have connected to your IoT Hub. Now the number of devices that you can connect to your IoT Hub, it's currently limited to 1 million devices. So one device of an IoT Hub can be connected to 1 million devices. And it can also be increased upon a request which you can do to Microsoft. Now let's go to, So as you can see, there are no devices found here. Now let us go to this plus symbol over here and create a new device over here. Tried to understand the analogic eyes here. And the analogy is very simple. As I explained you. Iot Hub is a particular service which you have inside your cloud. Here it is. And device easier entity is your software entity or a physical device that you have. For example, if you have multiple such Raspberry Pi's, then you will have to create multiple such devices in IoT hub. That is, remember that it's important for you to understand. And remember. Now let's come to the IoT devices here and let's click on new device. Now once you click on the new, First, you have to give device ID. I give my pi as the simplest device ID. Then keep the authentication type to security key. Don't go for this, sign certificates or self-signed certificates for now. In that case, you don't have to do anything else. Simply give device ID and click on save. After clicking Save, your first device in your IoT Hub will be created, as it says, device my pi, it successfully created. Let's close the notification and let's refresh this window here. Now the device is shown over here. If I click on that device, then the details about the device will be shown to me. Those details including device ID. Then there is a primary key, secondary key, then there is primary connection string and a lot of different things. For us. Here we have two important settings. One, an apple connection to IoT up. So it's this device enabled or not? Yes, it is an element to this primary connection string. We want this biomedical action string in order to be able to send data to this particular device from our Raspberry Pi. So you need to copy this primary connection string and keep it somewhere in a Notepad file. So I'll just open notepad. I have clicked this button over here. You can view the primary connection string by clicking this i and then copy it using this button. Or you can simply copy that in it's entirely. And Control C button. So pasted in a Notepad file, we're going to near this device ID. We're going to need this connection string, primary connection string in order to send any data to this device. So that's about it here. Nothing else needed to be done with respect to IoT Hub or this particular device that we have created. In the next video, we'll see the next steps, how we can install the required libraries on Raspberry Pi, and how we can start sending data from Raspberry Pi will try to send a dummy data from Raspberry Pi to IoT Hub. And then we'll see how we can view the data in IoT Hub, where we can see the incoming data in IoT Hub. Thank you for watching this video. 39. Enable Azure Cloud Shell and enable IoT Extension: Hi there. Now that we have created an IoT Hub, and we have also created our first IoT device, inserted the IoT Hub. It's time to add some data or it's time to try sending some data from Raspberry Pi. Now, for doing that, we need to run some commands onto the CLIA or command line interface of Microsoft Azure Cloud. You need to run these two commands before being able to send any data to answer. Let's see how and where we can run these commands. So first of all, let's go to the cloud, the login that we have. So here we have created an IoT device. Right now we are into the IoT hub and we can see the IoT device that we have created. What you have to do next is look for this symbol. It should read as CloudShell. So what do you have to do is you have to click on this cloud shell. After clicking on the cloud shell, it will ask you to create a storage account before running any commands. So simply click this storage account that it asks for. And then we can start the shell and run these commands. So let's begin. So here is the CloudShell button that I have. You can do it from any screen of Eurozone. So even if you are at all the sources are all that services or even at home, listen matters. So let's click on the cloud shell. It will initialize the Cloud Shell. And C, It will ask that you have no storage mounted. So at this point, just simply click your subscription, which should be the free tier that you have. And click on the Create storage button. Once you click on the Create storage button, it will take some time. And it will also ask you whether you want to open the shell in Bash or PowerShell. So in that case, just select Bash B-A-S-H. In my case, since I've done it several times, I might not get that option, but you will definitely get that option here. So it's creating and the CloudShell is being initialized. As you can see here, I have already selected the environment as Bash B-A-S-H. Now this storage account has been created and my cloud shell, it's starting to get initialized now the terminal, it's starting. Now here, I have the Cloud Shell running for me. So there are two options, Bhatia and PowerShell. We just weren't Bosch. So you'll get that option when you do it first time. Once you come to this point, you simply need to copy and paste this two lines over here. So ASI extension, add name Azure, CLI IoT X3. So this will basically add the IoT extension to the CLI or command line interface. We want this in order to view the data on command line that we are sending from Raspberry Pi. It will download the extension and install it into the cloud shell. So this is first of all. Enabling the Azure IoT CLI shell. The next command we have to add its tests, but we have to run this command when we are monitoring the data coming from the US scary part. So with this command, what you have to do is you have to specify your IoT Hub over here and then device name over here. So my IoT name was Ahmet by hub, and my device ID was my pie. So we'll run this command when we have been running a program on the Raspberry Pi to send the data. And then with this command, we would be able to view that data over here. So let's see what we have to do in order to run a sample program onto Raspberry Pi. So for doing that, what we need to do is we need to install some packages on Raspberry Pi. So these are the packages. So Azure IoT device, Missouri IoT Hub, Azure IoT Hub service clans, and Azure IoT device client. These are the four packages that we need to install on to Microsoft onto our Raspberry Pi. So let's see, let's login to Raspberry Pi. And let's try to run this commands one by one. Now let me open my VNC server over here, we'll see viewer and then the IP address of my Raspberry Pi, which is 1-0 five now, it keeps changing at my end because I have several different asks repairs which I used randomly. Don't worry for you, the IP address of Raspberry Pi should remain the same all the time. So let's give ID password, checkmark on remember password and click OK. So this is the IoT hub. This