Understanding Embedded Systems and IoT

Introduction to Embedded System and IoT_2

Estimated read time: 1:20

    Summary

    In this lecture, the focus is on understanding the essentials of C programming within the embedded systems and IoT framework. The presenter elaborates on how C, due to its middle-level language status, lets programmers efficiently interface hardware and software, crucial for developing AI and IoT applications. Various controllers such as STM, TI, and NXP are discussed alongside languages like Python and MicroPython. Key components like compilers and IDEs are explored, highlighting their role in cross-compiling code for different architectures. Concepts like variables, data types, volatile keywords, and fundamental elements of C such as loops, functions, and structures are covered. Highlighted applications include robotics, home automation, and medical devices, showcasing the extensive use of embedded systems.

      Highlights

      • Explore cross-compilation tools to bridge different architectures - flexibility is key! 🔧
      • Embedded systems improve efficiency through precise programming with C. 📈
      • Controllers like STM32 and TI are featured for their versatility in design. 🔍
      • Practical applications of C in embedded systems span several fields, from home automation to healthcare. 🏡💊
      • The importance of functions and loops in controlling devices in real-time. 🚦

      Key Takeaways

      • C programming is central to embedded systems, bridging hardware and software effectively. 💻
      • Understanding data types, like integer and float, is crucial for programming efficiency. 🔣
      • Cross-compilation allows code to work on different hardware architectures seamlessly. 🔄
      • Real-world applications of embedded systems include drones, medical devices, and automation. 🤖
      • Bit manipulation in C can optimize how we manage and access hardware registers. ⚙️

      Overview

      This session delves into the intricacies of C programming as it applies to embedded systems and IoT. Emphasizing its role as a middle-level language, C facilitates the seamless connection of hardware and software, essential for developing AI and IoT applications. Different microcontrollers, from STM to NXP, and IDEs such as STM Q and Keil are explored, emphasizing their role in optimizing embedded systems.

        Key fundamentals of programming with C in embedded systems are dissected, from understanding data types like integers and floats to using volatile keywords. The session explains cross-compiling, enabling the use of the same C code across various processor architectures, from PCs to ARM-based systems, without changing the core syntax.

          Real-world applications of embedded systems are showcased, with illustrative examples in automation and data processing. The integration of sensors and actuators in projects like smart street lights or greenhouse temperature controls demonstrates how embedded systems enhance functionality and efficiency in everyday technologies.

            Chapters

            • 00:00 - 00:30: Agenda Introduction The chapter introduces the agenda for a session focused on C programming, particularly in relation to embedded systems. It mentions providing an overview of what will be covered in C programming, emphasizing that C is considered a middle-level language, which is close to hardware.
            • 00:30 - 01:30: Overview of C Programming This chapter introduces the purpose and relevance of learning C programming, particularly in the context of programming embedded systems. It explains that embedded systems comprise both hardware and software, where the written code, referred to as firmware, is embedded into the hardware. The chapter emphasizes understanding the reasons behind learning C programming and its application in embedded systems for effective hardware programming.
            • 01:30 - 03:00: Real-time Application of C Programming The chapter introduces the application of C programming in real-time systems, highlighting its significance alongside AI and AIOT (Artificial Intelligence of Things). The agenda includes an overview of C programming topics and real-time applications, especially in embedded systems where C is predominantly used for writing programs on controllers, alongside languages like Python.
            • 03:00 - 04:00: Introduction to Embedded Systems The chapter provides an introduction to programming embedded systems, focusing on the use of Micro Python to program various STM controllers. It hints at an upcoming detailed exploration of specific topics related to embedded systems programming.
            • 04:00 - 05:00: C Language and Embedded Systems This chapter focuses on the role of the C programming language in embedded systems. It argues that C serves as the backbone of embedded systems ('M system') due to its high efficiency and portability. The notion of portability here refers to the ability to write code on one system and potentially use it on different systems. C's low-level abstraction is also highlighted as a key advantage in the context of embedded systems.
            • 05:00 - 06:30: Cross Compilation and IDEs This chapter discusses the concept of cross-compilation, which allows code to be compiled on one machine but run on a different machine with a different configuration. The example given is writing code in C on a personal computer and then using that same code for a microcontroller, like Arduino. This process helps in developing applications that need to run on various hardware platforms.
            • 06:30 - 08:00: Applications of Embedded Systems The chapter discusses various aspects of embedded systems, focusing particularly on different types of controllers and processors. It compares PC processors, such as the x86 processor, with microcontroller processors that are Arm-based, highlighting their applications and differences. Specific examples of controllers mentioned include ST controllers, TI, NXP controllers, and the STM32 F46 R1 controller.
            • 08:00 - 09:00: Basic C Concepts The chapter 'Basic C Concepts' covers the differences between processors and controllers, using the example of Cortex M4 processors. It explains that the architecture of different processors can vary significantly. The chapter also touches upon the process of writing a program in C on a PC, highlighting the stages involved such as compilation and preprocessing, ultimately leading to the generation of a binary file.
            • 09:00 - 10:00: Variable and Data Types This chapter discusses the process of converting a C program into its binary form, which is then loaded into RAM to produce the desired output. It emphasizes the importance of compiling the binary according to the specific architecture of the hardware, particularly when dealing with different types of controllers. The compiler must be compatible with the hardware's architecture to ensure successful compilation and execution.
            • 10:00 - 12:00: Importance of Volatile Keyword This chapter discusses the importance of the volatile keyword in programming, particularly in embedded systems. Various integrated development environments (IDEs) and cross-compilation tools are mentioned, including those for specific microcontrollers like HTM and those provided by ARM and microchip manufacturers. The chapter highlights the roles these tools play in optimizing software development for different controllers.
            • 12:00 - 15:00: Sensor Data Handling The chapter titled 'Sensor Data Handling' discusses various IDEs used in embedded systems applications, specifically focusing on real-time applications of C programming. It highlights examples such as robotics and drone controllers, illustrating how C can be used to enable control in these areas.
            • 15:00 - 16:00: Control Structures in C The chapter focuses on the various applications of control structures in the C programming language, particularly in different operating systems and fields. Examples include home automation systems like greenhouses, medical applications such as pacemakers and heartbeat monitoring, and engine control in electronic control units (ECUs). The chapter likely discusses how these structures are implemented within these contexts.
            • 16:00 - 17:00: Traffic Light Controller Example The chapter titled 'Traffic Light Controller Example' begins with a basic introduction, indicating a progression through different topics in sequence. The focus is on applying C programming concepts practically, starting with understanding variables and data types. The transcript suggests an emphasis on foundational knowledge in C, especially variables and data types, as a necessary step before delving into more complex applications, such as a traffic light controller.
            • 17:00 - 18:00: Functions and Modularity in C The chapter titled 'Functions and Modularity in C' covers the concept of variables and data types. It explains that a variable is something that changes over time, highlighting the etymology as 'vary' plus 'able' to denote something that can vary with time. The discussion extends to data types, which determine what kind of data can be stored. The text suggests there are primitive data types, but the details are cut off.
            • 18:00 - 19:00: PWM and Duty Cycle The chapter provides an overview of PWM (Pulse Width Modulation) and Duty Cycle, relating them to embedded systems, including controllers, processors, MPUs, and MCUs. It briefly introduces applications in edge devices but focuses on a preliminary introduction rather than in-depth details.
            • 19:00 - 21:00: Smart Street Light Controller Example The chapter titled 'Smart Street Light Controller Example' elaborates on the application of artificial intelligence in creating smart solutions, particularly focusing on the Internet of Things (IoT). It highlights the concept of 'buetti', a keyword mentioned as an important variable that ensures data is read strictly from memory to avoid discrepancies. This approach is critical for maintaining efficiency and precision in smart street light controllers, which are part of broader IoT systems. The chapter underscores the significance of this method in the development of intelligent systems that rely on accurate data retrieval and processing.
            • 21:00 - 22:00: Arrays and Pointers The chapter 'Arrays and Pointers' delves into the concept of the volatile keyword in programming, particularly in the context of microcontroller units (MCUs). It explains that the volatile keyword is vital when dealing with hardware to ensure that certain variables are not unintentionally altered by other parts of a program or by multi-developer interactions, as often seen in large projects with numerous developers and multiple C files.
            • 22:00 - 23:00: Structures and Unions in C The chapter discusses the use of volatile and constant keywords in C programming, focusing on how these keywords help manage data types used by different developers. It mentions potential conflicts when multiple developers work with the same data types, and how using volatile ensures that changes made by one developer do not inadvertently affect another developer's variables. Additionally, the constant keyword is introduced as another method to manage such scenarios.
            • 23:00 - 25:00: Memory Management The chapter provides an explanation on memory management, focusing on reading values from registries in a microcontroller (MCU). It covers the role of Analog to Digital Converters (ADC) within the MCU, particularly highlighting its importance in converting analog signals to digital signals. This conversion process is crucial for interpreting and utilizing sensor data effectively in electronic applications.
            • 25:00 - 27:00: Preprocessors and Macros The chapter discusses an embedded system using C with a focus on preprocessors and macros. It highlights the components involved, such as the controlling unit, sensors, and actuators. The sensor's role is to detect various environmental conditions like temperature and position, which are then read by the Microcontroller Unit (MCU).
            • 27:00 - 28:30: Bit Manipulation The chapter focuses on bit manipulation as applied to physical mechanisms like actuators, using the context of a greenhouse effect. It explores how actuators can be controlled to manage agricultural environments, particularly in maintaining suitable temperatures for various crops through the use of temperature sensors.
            • 28:30 - 31:30: Project Examples The chapter titled 'Project Examples' discusses the importance of controlling dirt temperature for optimal crop growth. It highlights the need to understand and manage the temperature within a greenhouse environment, which may differ from the outside temperature. The text suggests the use of a temperature sensor to monitor the current environmental temperature, allowing for appropriate adjustments to be made for effective temperature control inside the greenhouse.
            • 31:30 - 33:00: Conclusion and Assignments In this chapter, the focus is on understanding how a digital device, particularly a Microcontroller Unit (MCU), interfaces with analog signals via an Analog-to-Digital Converter (ADC). The ADC's role is to convert analog temperature readings into digital data that the controller can interpret and act upon. For example, when you set a desired temperature, the ADC allows the system to read the actual temperature, such as 27°C, and process this digital information to make necessary adjustments. This chapter bridges the gap between analog input and digital processing, illustrating the practical functionality of microcontrollers in real-time applications.

            Introduction to Embedded System and IoT_2 Transcription

            • 00:00 - 00:30 so to today agenda is um see we have to go for uh okay just a minute okay so C programming so I just give you the S programming overview of whatever you are going to we are going to cover as a C programming and then for if and then for this is for embedded system so if you see the c c is your middle level language okay so that will be near to
            • 00:30 - 01:00 your Hardware so if you want to program our Hardware means embedded system is nothing but a combination of hardware and software okay and whatever the program we are writing uh that will put in a hardware as a we will call that code as a firware okay so the thing is we have to understand first why we are going to learn that C programming and then we have to implement that uh C programming in embed system to get our a
            • 01:00 - 01:30 artificial intelligent and aiot enabl some applications some devices okay so our today agenda is means I will just show you the uh overview of the uh all the C programming topics and then uh we will see some real time application of C programming so once uh means if you are going for em system means we have some controller so in that controller what we are doing we are just write a program so either mostly if I have a controller I we will use C programming and pythons
            • 01:30 - 02:00 also we are using right now so using micro python also you can program your STM board whatever so many controllers are there so you can program controller using micropython also okay so now let's see let me just focus each topic one by one and then we will just uh go ahead okay so first thing is uh let me introduction to intro okay intro to see in embeded
            • 02:00 - 02:30 system okay embeded system okay so if you see okay so as you know the if I say that uh C is a uh backbone of M system because why we are telling this C is a backbone of M system because its efficiency is very high and it's a lowlevel AIS and portability is also so portability in the sense means you can write the code in some uh some system
            • 02:30 - 03:00 and then you can use cross compile the code using some compiler and then you can put that code in that some different some different machine that have some different configuration okay so if you uh if you noticed that uh once I write some code in C okay that in my PC okay and I write the same code for my uh microcontroller okay you heard about aino I think think mostly of you heard
            • 03:00 - 03:30 about aino as a btech you heard about aino okay then we have some other controller like St controller TI okay nxp controller okay so if I just give you one that stm32 f46 R1 controller is there so the thing is uh in PC we have a processor that is our x86 processor okay and in our microcontroller we have a processor that is Arm based processor
            • 03:30 - 04:00 and that is depending on the controller we have different different processors also so if I say I have some cortex M4 processor so the architecture of both are different that are not same okay so once you write the program for uh in you in your PC that is specific that once you just compile the program and you will get uh your binary okay you know this steps of how we write the program in C and then the compiler pre-processor compiler some stages are there through
            • 04:00 - 04:30 that stages uh the C program will convert it to the binary and that binary will loaded okay in the RAM and then we will see the desired output okay so if I say that binary if you have to compile for your controller okay so controller in the sense so that controller uh architecture is different okay so with respect to architecture your uh compilers should be able to compile the binary with specific to that Hardware
            • 04:30 - 05:00 whatever the controller you are using so for that we have a some cross compilation tools or we have some IDs okay ID is nothing but integrated development environment so that ID means if I say HTM microcontroller sof we have a HTM Q ID we have a kale ID we have a arm we have arm also provides some license button the arm ID and then we have some um microchip based ID also microchip also chip manufacturer so also
            • 05:00 - 05:30 provided some IDE so so they are different different ideas so we you can use okay so now uh so application if I say means um um automative so so real time application if I if I say can you tell me the real time application of C in embedded system so if you see right now you can see robotics okay robotics drone controller you can you you can make the Drone controller you can enable the uh robotic so you robot also have some
            • 05:30 - 06:00 different operating system that is Ross operating system okay and then you can apply in uh uh some home automation green greenhouse and then you can apply medical also Pac maker and something uh that hardbeat monitoring okay so and then you can use for uh uh engine control in ecus okay so there are different different applications okay so now let us do the next I will move to
            • 06:00 - 06:30 the this is basic introduction I have to provide you then let us give go for one by one each topic and then I will try to show you how we apply the C concept okay so basic C concept if I say if you know the basic first you have to understand about the variable and data types okay variable and data types so variable and data types okay so if I say variable okay so
            • 06:30 - 07:00 variable if you see the variable in spit this will okay just a minute okay okay now I will use this so variable means that something that will vary with time so that's bury plus able that is variable so something that will vary with time that is your variable okay and data type means what data you want to store okay so there are some pried data types so that is uh if I
            • 07:00 - 07:30 say that is integer character and Float something so I will not we will just see all these thing in depth I am just giving the overview today okay and application of this C in your controller or your embedded system basically if I say embeded system then you have controller also and you have a processor also so we have a mpu and we have a mcus okay and the this we will apply in uh sub some Edge devices so that we will
            • 07:30 - 08:00 get the application of artificial intelligent we can apply and then we got the iot purpose for this one okay so now okay so now what we have to understand is the buetti keyword one word we are using over here is the buetti okay so buetti means Ure we have to Ure variables are read for from memories only so that they will not read from any other so that time you can use
            • 08:00 - 08:30 the volatile keyword okay so this word you can see once you are you are you are programming for some MCU that time you will see this volatile keyword frequently in the sense when you have some hardware and you don't want to inter someone others will change this variable see you if you try to understand when some developer are developing some application it's not a single developer will work on one application and one project okay so there are multiple developers will work on the same project so there are multiple C files okay it's not at one. C
            • 08:30 - 09:00 file so it might happen that different different developer use some maybe the same same data type they are both the both developers are using so that time if he will change this variable then that will affect to this variable so that time what we will doing we are using the volatile keyword so so that will what it will do means uh so so other will not use so or you can use the some constant keyword also okay okay so then if if if I see uh if you
            • 09:00 - 09:30 see then uh I want to read something from register okay so if I say in my MCU we have a ADC okay so you are I think mostly of you are the uh if you in electronics background so that time you learn ADC and D okay ADC if I say one is the successful proing time analog to digital converter is there okay so that will convert the analog value to the digital value so why we need ads means if you see the mostly sensors now so so
            • 09:30 - 10:00 we have a if you heard about see this embed system now I will just go one just simple things I will tell you so we have some controlling unit and then we have some sensors and then we have some actuators okay so actuator means if you try to understand the sensor unit what will do it will sense some device sensing something sensing the Sens it will sense some temperature some position okay so whatever you want to sense okay and this will detect by the MCU it will read the things and
            • 10:00 - 10:30 accordingly it will just some physical mechanism we will provide through actuator that will control whatever you want to control that suppose I have a uh uh let me see let me take some greenhouse effect okay so what in greenhouse effect what I to do I have some temperature sensor okay so I yield one in agriculture we have some crops and different different crops need some different uh temperature okay so with
            • 10:30 - 11:00 specific to dirt temperature so you have to control the temperature okay according to your crop okay so now how we will control so outside outside uh temperature is different and you have to maintain the temperature in this green house so how we will control so first you have to understand what should be the what is the temperature right now okay so using temperature sensor we will just try to understand what is the temperature in our environment and accordingly it will send the
            • 11:00 - 11:30 temperature that whatever you are reading that is the analog value the ADC because this control is a digital device okay so we have some converter ADC converter that will convert this analog value to the digital value and it will operate on that value and accordingly so if I say I will set the temperature 21° C okay okay so that means it will read okay let the temperature will Le something 27° C okay so now this MCU
            • 11:30 - 12:00 will sense this uh temperature and I have some actuator means actuator in the sense some physical device that will operate some things that will control something so I will here I will has some AC some air conditioning device that will just cool out the temperature so that temperature will decrease okay so now I for that particular crop that need 21° c okay that need 21° c but my temperature is rout right now to 27 so in my coding I will write okay if the temperature temperature is greater than
            • 12:00 - 12:30 21° cius then I have to turn on AC if temperature is greater than 21° cus that is my critical temperature then I have to turn on this AC this actuator so temperature sensor will sense this one okay so now and this this this analytical thinking this this will I wrote in the code so it will sense okay I will I sense 27° C but that is greater than 21° CSUS so that what what will it will do it will turn on this AC so there
            • 12:30 - 13:00 is one simply we have some GPI signal that we will give and it will give here 5 volt and here we have some relay mechanism that relay mechanism will turn on that the strip the coil and that will just connect the things and then it will get the supply so simply what we are doing using 5 volt we are just operating to 30 volt Supply okay we will just control this one okay so now this is one if you just try
            • 13:00 - 13:30 to understand mostly means M system it's not like a single M there are network M systems also there okay so I will not go in that way so now we have to understand means variable and data types how I will apply this variable data types in in emit if you write somee in embit system so there is one integer okay so int so if I want to suppose you have some value in a is equal to 8 okay 8 a is equal to 8 so what I'm doing this
            • 13:30 - 14:00 variable a I'm assigning some value eight and later I will use this a variable or I will not assign so I will just use int a some value okay or if I say in this system I will use some temperature okay in temp the temp is my variable that will vary with the time means uh it will just temperature sensor will sense the value and I will put that value in the temperature this variable so integer will take I think it will take four bytes okay so you know that
            • 14:00 - 14:30 one by is is equal to the uh 8 Bits okay so four by means 8 for 32 32 bits okay so so what happen sometimes so that integer also is to type unsigned and signed okay so this all you will learn okay in this course okay so but now for specific to my embit system I don't want to use 32 bits okay because it will take more storage so what I will do I will use un you you ID
            • 14:30 - 15:00 you signify it's unsigned so unsigned means it's it's taking only the positive values okay if it's signed it will take negative and positive both values so unsend means U and then I will use u in U in and whatever means I want I don't want 32 bits okay so for suppose my variable it is maximum 8 bit is okay so I write u 8core t so that is specified I using sign in I'm not using 32 bit I
            • 15:00 - 15:30 using bits okay and then you know if a pointer I will specify ASC that denote the pointer okay so this you will see so I will take one variable adcore data okay this is my one variable so I this variable pointing this pointer is pointing toward unsigned int and that will take eight bits and this should be a volatile okay so volatile un sign that this is a
            • 15:30 - 16:00 pointer that will point to one integer that is of eight bits and that should be a volatile and here I will just specify this one with some volatile and sign in in and I just mention here some address so this address is what this address of your controller controller address so in the sense it will reading the ADC registers okay so what we are doing so so for reading the register so if you see in c means it will register level also you can just man manate uh the bits
            • 16:00 - 16:30 so if I say that also we will see bit manipulation okay so bit manipulation means if I want to if I have a 32bit register okay so we have a 32bit register so each register suppose a 8 bit register so I don't I don't want to change other bits I want to change okay let me let 0 1 2 3 4 five 6 okay and then I have a seven over here and then I have a eight okay
            • 16:30 - 17:00 suppose this bit anything so I will write the star means that should may be zero and one I don't know anything about these bits okay but this bit number five that I have to change without affecting the other bits so that also you can do using C means uh uh we will see how we will just do this bit manipulation so I want to so using bitwise Operator bitwise Operator so we will see how what are the operators we have and then we will see it's a bit wise operator so means at a that bid wise means at a bit level we will just change the operator
            • 17:00 - 17:30 so bit level means if we have a register so register have some memories means some values are there okay zero or one binary form okay so I want to change some some particular position which I want to change without affecting the others that also we can do that is bit manipulation you can change so mostly if we have a controller that have some addresses and then addresses you are just changing what you are doing you are just changing zero and one that's all because if if you see I have a computer whatever
            • 17:30 - 18:00 the machine that understand the binary only so if you if you go for that some address so how will go for the address so for going for a particular address you should understand how to use the pointer so using pointer you can you can go for that particular address that address if you see if I say that address for register is this one okay I will go for that particular address for this ADC and then I will change any bit over that one okay that is also possible okay and then we have a some other thing if I say
            • 18:00 - 18:30 we have a control unit okay so control structure so control if you see I want uh to control structure means some conditions are there okay so some conditions are there means in Loops if I say we have a four Loops so uh so see I I will take that same example we have that this example only so I will just put this one only so we have a temperature okay temperature sensor controller and then we have actuator so this temperature sensor I will put so
            • 18:30 - 19:00 how much time it will read the temperature it will continuously read the temperature okay so that should be in the loop it should not okay the temperature sensor will take the reading for one second one time only and then it will stop no it will continuously reading continuously operate and just uh read the temperature environment temperature where we put the things so the thing is we something we want continuously infinite times it will go on it will not stop till we are not stopping some from externally so that
            • 19:00 - 19:30 time we will go for so there are two two things one is the polling polling mechanism and another one the interrupt mechanism okay so polling means uh we will go outside and we will check every time interrupt means when something will happen then it will go interrupt okay it will interrupt the things so we have some ISR interrup service routin there and is mode where we are writing the thing suppose I am writing my program so my program is running right now normally so it's running normally and someone is
            • 19:30 - 20:00 interrupting suppose let me just tell you how what is the interruptor suppose right now I am delivering a lecture to you okay so someone come so what I am doing my normal normal task right now I am just delivering lecture so now someone come to me and uh ask okay you do this thing so what he's doing he's interrupting me so so what I doing I just go to that person whatever he demanded I will complete that one and I will then I will again come here and I
            • 20:00 - 20:30 will do this what are the normal I am doing so that also dependent depend that this whatever the person is coming to me that is having the more priority than my normal task so what I'm doing right now suppose some some some CEO will come to me and some my company company coo will come and okay you do this thing so if I if I understood okay there is more priority to this one so I will I will entertain that one I will do that one
            • 20:30 - 21:00 and then after that will complete I will again come back to this one so that means if someone that is having more priority I have to entertain first that one so that will depend so this inter will depend on the priority which is having the more priority and the less priority and this polling mechanism means uh each time we are going and checking so what I'm saying if something you want to continuously you want to do that will go in the polling means I will write simply why while one so why is V
            • 21:00 - 21:30 one infinite time okay so this means while one means infinite time it will go inside this one now if I want to check some condition some condition means if and then I will go okay if button pressed okay if button pressed or if I write if if I say this temperature only if temperature is greater than some critical temperature okay this critical temperature I set that I WR 21° C
            • 21:30 - 22:00 then I will execute something I will do something I will send the data send data or I will uh turn on gpio so gpio means I will turn on AC so using gpio means some GP pins are there so I will write on that GP turn on I I will give some one signal that will be one signal means in digital means B if I that is to bdd if I say bdd is 5 volt then will take five volt and if I just go for zero mean
            • 22:00 - 22:30 it will just give the ground so that that depend on the actuator how actuator is working that high level low level at five volt if I give the five volt to that one that will turn on the AC or it will depend how the configuration for the actuators is there at that time okay so this also we will see mean Loops means while loop for Loop okay do while loops and then we have some uh statement typ means if else if so these conditions you can apply in
            • 22:30 - 23:00 mided also okay so if I say means the application where means uh uh traffic light controller so if if I want to design if I if I say okay you design one traffic light controller so you have a traffic lights okay okay so means uh Suppose there are four roads okay if I say means this there is a one highway there are one road two Road Three Road and four roads are there okay so now now you have to understand means from which Road is coming so accordingly
            • 23:00 - 23:30 you have to trip red red and then I think green and then one is the yellow okay the same for here so now you have to draw the you I think you heard about M Mor machine okay so that will you can use for the FSM Finance State machine is there so that FSM you have to draw okay then accordingly FSM means how many states are there how many events are there that you have to understand so if it's a one way traffic means one and two
            • 23:30 - 24:00 traffic then you can design the traffic light controller means this traffic is going on then when this traffic is reaching here so that time this traffic should be stop all the condition so how much time it will go for this traffic and then this traffic will stop okay so if the four light then you have to understand how many how many states are there okay so that you can draw FSM and then you can implement this FSM using CF C language okay so this also you can implement okay so once we are designing
            • 24:00 - 24:30 some uh some anims um some projects we have to see we have to draw we have to just understand the what should be the finite State machine for this one okay so then we we can Implement that FSM using coding also okay then fourth one we have a functions okay function so function is all other thing that we can use in uh C language okay so means if I write the uh everything in one function suppose in the main so the program is
            • 24:30 - 25:00 looking like an notp good mean everything you cannot put in the one thing so what we are doing we have we have to put different different functions okay so from Main we will call the some function and passing some parameter so that compiler controller will go to that function and doing that task so so mostly what if I just uh design some application control some uh some project or something so I have one app. C file that is the application file
            • 25:00 - 25:30 where I write means uh whatever the things I want to call so mostly if you see here we have only functions if I want to pass some parameter so what parameter I have to pass that I have to Define in this one then it will go to that function or it's not like that you have only one do C file there are multiple of do c files I have app doc then I have a main. c then I have some whatever the application according to I have some delay. C and then I have a header files
            • 25:30 - 26:00 also okay and then we have we can compile this file so that if we have a ID so we will comp these all things are compiled in ID and then we will get the one EF file that is executable linkable file and this El file will go to the from some some flash memory whatever the memory and the controller thisf file will go to the memory either is a flash memory or n memory or nor memory and then from here it will just once you
            • 26:00 - 26:30 just go it will go for the SRM and then it will run you know now when we have we write the program it will store in a dis and then uh we run it will go to the RAM and then it will run as a process okay okay you are following me now okay let me see okay understand now what going through it's not like a one way okay if you have
            • 26:30 - 27:00 any doubt you can raise your hand or you can ask okay person mic we we we can provide them mic also now if they or they can chat okay okay okay let me continue okay okay so now I think function so if if I say function means
            • 27:00 - 27:30 okay just a minute okay so in this function we we write different different functions and then we have a different do c files and these files okay this already I told okay now in this function if I say this uh application you can apply this in a motor control so we have a PM PM generation okay PW and pulse with modulation so you know what is pulse with modulation means if I want to bury the intensity of the light suppose the
            • 27:30 - 28:00 suppose I have some light that will be operate on 230 Volt or if I say some Led that will operate on the 5 volt okay so that led if I'm giving the if I'm giving the 5 volt so what happen the intensity is high 100% okay that it will get so that time if I say if you see the pwm we have on duty cycle so so that time we will see uh mean what is duty cycle and then we have a period okay what is the period okay
            • 28:00 - 28:30 and what should be the turn on time and turn off time suppose this one you have some PSE so this pulse have some turn on time and some some turn off time so okay so if I say what is the duty cycle so if half time it will turn on and half time it will turn off so that time duty cycle is if I say t onid by t period okay the t period is what T on plus T off okay so how much time it will be on so a accordingly your this voltage you are
            • 28:30 - 29:00 providing that will vary okay you will see so if I have a suppose I have 100% W cycle that means it will on for the this whole whole period will the this uh the it will be on so that means whole time it will get getting the 5 volt okay so if the duty cycle is 50% then what happen 1 by two into 5 volts so 50% means 50% time it will be on 50% time it will be off so how much average voltage this getting 1 by two of 2.5 volt so the
            • 29:00 - 29:30 intensity will come less only now when it's getting 5 volt intensity is more when it's having 2.5 Vol intensity is less so accordingly we can vary the intensity of light okay so that this will you we will use in a street light controller so suppose I have a smart street light controller okay a smart street light controller so what I but I'm doing over there suppose uh uh I have a controller and I have some uh position sensor or motion sensor okay
            • 29:30 - 30:00 some motion sensor I will put over here and then I have a uh uh some uh that uh LEDs okay street lights are there and before street light I have some controller that will control the street light and and then I I will apply this thing to the my controller so now what it will do this motion sensor will detect the uh motion of the the uh some beckles okay so when beckles are not moving to the road that time I I should
            • 30:00 - 30:30 save my electricity so that suppose night time also when vehicles are not moving my street light should not operate at a 100% duty cycle it should be at 10% duty cycle or 20% so that will be saving of the power then only it will be smart okay so when it will detect some motion of the Beckle so that time the duty cycle will go from 20% to 100% okay so that 100% means the intensity should be high that time it will get high at 230 volt so if it's a
            • 30:30 - 31:00 20% Min 20% of 230 volt you will get if the duty cycle is 20% okay so that way we can just apply these things and we will see how we will try to write okay so this time also so so here if you if if you write you can go for the polling or you can go for the interrup service routine ISR you can generate one interupt once some Beckle is coming you can generate the interupt once interupt is generating this duties it will come from 20% to 100% so you will write the
            • 31:00 - 31:30 ISR for this one or you can use the timer also okay and then next thing we have is uh next uh concept is our if you see we have a after function we have a array and pointer so we have array pointers already told and then and strings okay so this also we will see in C okay so pointer I already told if I want to use pointer means uh using pointer I can
            • 31:30 - 32:00 directly access the address okay so you can you can use the macros for that also has Define if i r as defined GPI some gpor Port some Port are there or you can you write here unsigned into some so if a 32bit controller suppose I I have stm32 f46 re or F f41 re okay so these are the 32-bit controller means 32-bit controller in the sense uh the address bus or address bus they the data they
            • 32:00 - 32:30 are sending at particular at any instant is 32 bits so the address they are storing is any address they a 32 bits address okay but the okay so means so then so the address is 32 bits means register size is 32 bits so so I have to write unsign is 32 uncore T and then I will write this as a pointer and then I can directly write the address so 42 Z so this is the direct accessing of the
            • 32:30 - 33:00 address so using pointer I will directly access the address of a particular controller what controller you are using okay so that is the one thing you can apply using the PO okay or if I say array so array means we have a some communication so if I want to send the data from uh One controller to another controller or I have a some suppose I want suppose you have a controller stm32 okay you want to uh enable this
            • 33:00 - 33:30 controller with uh you want that iot application should be operate on this controller means I means this controller should be a internet enable so how it will be internet enable so either you have some byi module with you okay or you have some ethernet in this controller some ethernet port should be on this controller or you have some uh 4G module with you okay so now if I say I have some byi module okay so the data
            • 33:30 - 34:00 the Wii module so this I have I provide my SS ID and password so SS ID and password I will enable some hard Sport and I will give the SS ID password so to accessing this one how it will the interfacing between data it will send from byi to stm32 so you you do the things and then you will send the data through this Wii module to the cloud okay so how byi module so this data from stm32 byi module how you will send Using
            • 34:00 - 34:30 usart okay so the communication us that depend the module you are using that is usart enable that is ITC enable or SPI enable whatever the communication in between them okay so usart means un Universal synchronous as synchronous receiver transmitter okay so so that time if I want to store the data for use chart okay I am reading this one so I have some temperature sensor okay I am reading the the temperature so after using this temperature where I put put
            • 34:30 - 35:00 this data so I need some array some something I need where I will store this data so that array we can use this array so that array have some sizes you can just you know denote some size for array so that time we will use this array as a buffer okay and then with this buffer we will send the data to the Wii module and through this byi module it will connect to the cloud so you have some Cloud Brokers so you using mq Duty you will send the data using mq duty to the cloud
            • 35:00 - 35:30 uh and then we have a broker so I will show you that one one whole uh things also so we have a things board Brokers and then we will communicate okay and then if I go next uh we are going to learn means that next is our structure okay structure and unions you can you see so what are these structures and unions so means uh some times what happens now you if you go for some
            • 35:30 - 36:00 particular module suppose I go for gpio okay so we have uh different different U uh registers are there in the gpos okay so how I will store these registers in all the registers of the GP so I will just make one structure because what is array array is a collection of similar data type it will the data type should be similar it's not like that array will store some integer value and some some character value and some float value
            • 36:00 - 36:30 that will not possible you know integer integer will means all the positive one 0 1 2 3 or might be negative also if I say character character means uh you have C this is one character if and then if I say uh c k l these all are the characters okay a float you know the decimal values okay either you can Define int s of 32 this
            • 36:30 - 37:00 array s is the array of size 32 and then it will take only either it will take only integer I mention here integer so it will take only integer but I want some data type should be there that will store not inor it will store some float values also some character values also so that time we will move from this to we will move to the structure okay so this I will just Define some type dep structor that that is the Syntax for this one and then I will write unsigned in 32t
            • 37:00 - 37:30 and then I wrote M so m is one register in our gpio then I will write sign 302t odr output data register and then I will name this if you want you can name this structure also whatever the name you want and then later I will use this uh this structures to access this element okay so this these things also we are we will use in our uh EMB applications when we are writing theed application okay okay so then we have a
            • 37:30 - 38:00 memory and the memory if I say then we have a St me memory management where we are doing the memory management so memory management if I say we have a St memory we have a heap memory and so if you see the virtual mapping of any c program now so we have a c programs and we will write so if I say a virtual virtual address for all any program we do we have a stack memory and then we have a heap memory then we have a data
            • 38:00 - 38:30 segment in data segment also we have a uninitialize and inial data segment then we have a text and or we calling this code also so when when you are write some code the code will come to this location it will put that binary okay and then if you have some variable that variable will go to this local variable with goal to the stack because stack you know it's a Leo system okay so means last in first okay so if you have some local variables that
            • 38:30 - 39:00 will have some segments so according to different different functions we have one segments in a stack okay and then each segment whatever the variables you are using that have some memory in the St okay once the function of that is over the segment is uh get depleted so okay so that will be not there in the St okay so that we will see that time storage class okay storage class classes also we will see so if I want to store
            • 39:00 - 39:30 some variable to the whole whole lifetime of the program so that time I will use the some static keyword or some Global variable should be there so before main we will Define some variable that will treat as a global variable so that will not store in the stack it will be store in the data segment so if you initialize that will go for the initialized part if you go for initialize it will go for initial part so the advantages is this variable you can use throughout of your code okay so means if you write something in a main and then you have some different variable and this variable is a local
            • 39:30 - 40:00 variable and this variable you want to you want to use in some another function you cannot use because this lifetime of this variable is still this this function only if you want to use this one uh this variable in this function also then you can use the static storage class static and keyword and then you can write the data type and the variable so that this variable will store in a data segment instead of storing the St so that you can use this variable throughout of your program so these all things we will see
            • 40:00 - 40:30 okay okay so then we have a pre-processors and then we have a directive and macros so macros means that will uh means it will Mo it will make the device inhance our code and and enhance the readability and efficiency and modularity so in the sense it will be easier so if I if I want to define something means has Define okay has Define pi suppose 3. .14 okay so now instead of using 3.14 I will use Pi so
            • 40:30 - 41:00 in whole of my program I will suppose I will use has defin something some some variable okay where and something I will write now 100 so uh suppose I write some critical temperature okay like I I will has Define critical temperature and I will write 21° C okay so later time what happen I I don't want now this uh suppose I will give this example try to understand uh same example you try to understand I have a greenhouse effect
            • 41:00 - 41:30 Greenhouse system in that what I'm doing suppose uh critical temperature I'm setting 21° C and my temperature is 20 27° C so this is for particular to one crop okay so what suppose some uh after some session this another crop will come come to the picture so that crop needs not 21 that need 81 18° celsi okay so that time what you you set this critical temperature to 18° Celsius so so this is one system Suppose there
            • 41:30 - 42:00 are multiple of multiple systems are there you don't write the code for single system you write for the multiples so you will not use One sensor for for average sensors you use 100 100 100 sensors okay so 100 temperature sensors you are using so for each sensor you just change the things so it's better you will change over here you use the critical temperature you just change over here that will that will just conflict so whether you where you are using critical temperature that will replace with the 18° Celsius so instead
            • 42:00 - 42:30 of putting everywhere the 18° Celsius or something you can directly change here and that will reflect in the program so that you can use in macros and then we have a if I if I want to include something suppose uh uh it's not like that all the time you have only one file you are adding main. C file it's not you have multiples of files okay so I have suppose app. C and I have some suppose RFID doc if I have some RFID okay or if I have some suppose I'm
            • 42:30 - 43:00 green if I so I have some green do C file and sub green do header file okay so now what happen uh in main program I want to include these header files so how I will include this header file so this functions whatever I'm defining over here and this all this to do C file that will be in the header file I will Define the Prototype so I want to include so that I will communicate with these files so I have to how include I
            • 43:00 - 43:30 will use has include and then I will read green do Edge or whatever you want to use suppose app. okay so that time has you can use okay using has means it's a pre pre-processor directives okay and then you use has if Define has if not defined so something you you are using and you if you are confusing that I am already defined or not defined so that time you can use have if not
            • 43:30 - 44:00 defined has if not defined you can use has defined so has if defined okay so if not defined you can you can Define the things if defined then it's okay okay so that also you can use this one okay so that mean has defin suppose I have has find LED if I say ledore pin so
            • 44:00 - 44:30 this pin I am using five right now I using port number five later I will change this to seven also that will reflect directly okay or something uh suppose if I just say has uh if Define debug okay I will use debug then I will use has Define log of x and then print F something X else if if it is defined this will go else s else else what you will do you
            • 44:30 - 45:00 will Define this one as Define log of x and has and if so this type of pre-processor you can use in your application so this also we will see okay then you can see the file handling also okay this will be more complex this you can leave now so bit manipulation I already told bit manipulation so bit manipulation means
            • 45:00 - 45:30 manipulation that you can use for uh clearing the bit or setting the bit so means if I write Port B okay or equal to one is less shift by some pin five okay so pin five means uh the pin number five this is one macro okay so you if you define this pin five as a five so this one is left shift by five so that means if this is
            • 45:30 - 46:00 my G one register 0 1 2 3 4 5 6 7 so it's a 8bit register so this bit I want to change so what it will do whatever the bit it will be there it will make this bit as a bun so that will this win or equal to and then I'm just what I'm doing I'm left shifting by five that will over here if I want to make this some bit number three I want to reset reset means I want
            • 46:00 - 46:30 to make this Bit Zero whatever the bit is I want to make zero okay so you know now how this exor operation is working suppose you try to understand uh suppose uh it will be 0 one0 1 okay and then what I doing one is left by five okay I will make this five also okay so if I'm writing here one I don't care about these things okay it will be zero or one okay so these all are zero only one is
            • 46:30 - 47:00 left by five now so this is one others are zero so what happen if xor is what if both are same it will be zero if both are different it will be one so one zero one so both are different it will be one so what happened now this one is return return so this data this if you see these all bits are same only this all bits are same only so I changing which bit this bit only
            • 47:00 - 47:30 clear so that is bit manipulation so that if I want to set any bit I have to use or equal to if I want to clear any bit then I have to use and equal to and negation of that one and operation okay so these all are the things okay now if I want to show you I will show you some project specification so that
            • 47:30 - 48:00 delivered here so smart Greenhouse I will show you okay so here okay mod b now so this you will not get okay we will leave this one h smart street light okay
            • 48:00 - 48:30 mod H okay so this I will try to show you so if you see here this industrial Energy monage System so what you are doing here we have some okay this slave also you will not understand mod now okay so okay smart is okay that is okay so if you see we have this controller
            • 48:30 - 49:00 and then we have a two Lowa modules okay or you can use some byi module over here so we have some relay sensor and these are some street lights and we have some LCD I2 cement here we will see show the status of the these street lights okay so now what happening uh we will just uh controlling this street light from this controller this is one actuator okay and then I don't put any sensor over here if you want you can put the motion sensor so instead of this LC Toc I will put
            • 49:00 - 49:30 some motion sensor okay so I will sense this motion of the thing and accordingly I will just uh just trigger this relay and then I will control this this LEDs okay and and this data I will send to the cloud means I would send so this this is data I sending this I will tell this thing as a node and this is our Gateway so this is One controller this is one of my mpu so from here to here the data is sending through wirelessly that is through Laura module you can use some WiFi module you can use B Bluetooth
            • 49:30 - 50:00 module anywhere or you can use wired so using V means us start you can send the data from controller to processor and then from processor I using some mq for this I am sending the data to the cloud and then you can have some mobile applications also so from here some remote location you are controlling you are just seeing this whole system okay so this way you can use so here I am writing the code in C only embedded C code and I have a controller here the
            • 50:00 - 50:30 controller I can use I can write the code in C also and python also here also you can write the code in P python if you want to write controller you can use the micro python that's all and you can here you can directly write the python script and you can run the things and you can write the C also so I wrote the code if you want to see that will be something okay so I hope now you somewhat you
            • 50:30 - 51:00 understood what application of uh your C language in U C programming in if I say controllers mean embed systems so these are the different different topics we are going to see in this whole course and that is not the thing means you can see some applications means FL controller thermal States real time applications say home automation pacemaker ventil Lors ecus
            • 51:00 - 51:30 okay so I hope now it's clear any any doubt uh means it it will be understandable okay so okay so this whole intention of this uh today as uh agenda is just to motivate you means what is the applications of C where we appli in M system and how after this if you want to write means how we will apply this AI iot you have to apply
            • 51:30 - 52:00 in some Hardware only or if you want to ACC some Hardware you have to use your uh C language or python some language should be there you cannot write in the Assembly Language or machine Lang language so some language you should understand okay you should learn okay so I hope it's clear so PR can we conclude the S on Sir yeah yeah yeah one second uh uh uh all of you just I shared one
            • 52:00 - 52:30 link right now in the chat box just go through that link and uh just sign register on that internship program also why we are doing these things because of uh you know so many people are not attending properly this is our live sessions so so many are not attending they registered but they are not attending proper uh classes because this is started one week is everything they will whatever so please register on
            • 52:30 - 53:00 this link and uh we will share one more activities tomorrow day after tomorrow like 1 2 three we will share the activities on the training have to okay complete all the things so PR okay one assignment all of you just okay just just let me one minute one one assignment all of you can try
            • 53:00 - 53:30 means take one any application of the embeded embedded application and try to write some uh Hardware Hardware diagram for that one in the sense means what should be the interfacing what should be the things so some application any application you can take okay and just uh write something about that one