We have discussed completely about programming, section related to arduino, so here we have discussed about arduino programming. So there we have discussed about this different concepts such as uh, how the loops works, how the syntax of the audio programming look like and how to uh define different uh variables and whatever constants and different operators and much more so it is the real module where You have you how to develop your skills on the programming so that you can solve your use case so in this module well be dealing about arduino sensors, so there are different kind of sensors that can be attached to your arduino board. So here we shall discuss few sensors in this lecture of this module. So let us move into the topic. Oh Music, so the first sensor we are going to discuss is ultrasonic sensor. The name itself shows ultrasonic. So these are some sound. These are some type of waves, so use with the help of the ultrasonic waves. This sensor works. So let us move into the description of this sensor. Ultrasonic sensor, hcsr04, this sensor, technically known as hcsr04, is a sensor that can measure the distance. So this sensor has the capability to measure the distance. It emits an ultrasound at 440 000 hertz, that is, for 40 kilohertz, which travels throughout through the air, and if there is a object or obstacle on its path, it will bounce back to the module. So it says that this sensor will be continuously emitting the ultrasound waves, so these waves, we are having the frequency of 40 kilohertz and then travel through the air, and if some objects or obstacles come into its path, it will bounce back to this module.

That means these waves will bounce it back to the back to this sensor or module. Considering the time travel and the speed of the song, you can calculate the distance so since these are sound values, ultrasonic wheels. So, with the help of the speed of the sound and the time taken to bounce back and reach the module, so this sensor can calculate the distance that is being traveled by the wave so that we can find the distance of some objects which is present in Front of this sensor, so this is the pin configuration of ultrasonic sensor. So this is the typical view of ultrasonic sensor, so here well be having some one transmitter module and another one as the receiving. So with return with t, it is transmitter and return with r. It is a receiver and we have four pins one two and three and four, so the first pin is vcc. That means we want to give some voltage say, for example, five volts, so any board in the electronics works only with the voltage and current. So we are giving with 5 volts voltage and one as the ground pin. So these two are the oldest supply, pin to this sensor or module, and there are two pins trig and echo. Although we have to develop two functions for the sensor, the first first function or the first task – is to transmit the waves so to transmit the waves. We need one pin to trigger the sensor to send the waves and another one is to receive the waves that are being reflected so to receive or to hear the waves that are reflected by this sensor.

We require a pin that is a copy which listens to the waves that are reflected here comes the working of ultrasonic sensor. So here we have transmitter and the receiver part of this sensor, and here we have the uh this. This is the crystal oscillator. So here we have transmitter and receiver. The transmitter starts transmitting the ultrasonic wave sound waves. So this travels at 40 kilohertz frequency. So when they hit the object, they soon start reflecting back to the module or sensor, so that this receiver will receive the waves that are being sent by it so based upon the distance between the sensor and the object can be calculated. So here. This is the original signal that is the emitted by the transmitter, and here comes the reflected signal that is received by the receiver, and here is the place of the object, and this is the distance. So this is the way by having some formula we can calculate the distance between the sensor and the object. So this is the pure working of ultrasonic sensor here, the working of every area. Every sensor is very much important to know because only you can solve your use cases only if you know the working of that particular sensor or module or some water. So here the specifications of ultrasonic sensor. So before we have discussed the different pins, we have four pins in ultrasonic module. So here here comes three 0.3 centimeter resolution, so it has a resolution of 0.

3 centimeter. That means we can have some uh resolutions up to 0.3 centimeter and an angular angle. Less than 15 degrees, so we have some angle difference less than 15. So here we have current up to uh less than two milli amperes, so the only the current uh it works only or if it is uh below a less than two milli amperes. It can work and another one is that direction range two to 450 centimeters. That means i can only detect the objects which are between 2 and 450 centimeter, for example. If the object is present at a distance of 1 centimeter, then it might show the error and if it is present above 500 450 that say 500 centimeter, then it might not capture the distance of that object, because it is out of the range for the sensor. Here is a pin diagram of ultrasonic sensor, so any sensor we are using here in this uh we are. We need to connect to the microcontroller board to read the different values produced by this sensor, so in our entire course will be using the arduino uno board, which i have told many times. So even we have a module where we have seen the different specifications and different parts and the uh and completely about the arduino board. So this is the view of the arduino board. So here we are having our hcsr04 ultrasonic sensor. So here this sensor having four pins so how we need to connect the arduino to hcsr04, sensor or module, so we are having the vcc of hc sr04 must be connected to the 5 volts.

Generally, all the sensors work up to 3 volts, but ultrasonic need 5 volts for its functioning, so the vcc of ultrasonic must be connected to the five volt pino arduino board. Here it is, the red wire is the vcc generally, the red will be taken for vcc and the black will be taken from ground. So here the ground wire is connected to the ground. The ground of ultrasonic is connected to the ground of arduino and later the other two pins of vcc and sorry echo and trigger echo, is in allo. Color is connected to the uh. Sorry uh. This is a trigger trigger in the yellow. Color is connect to the d3. That means digital pin 3 in the arduino board is connected to the drip pin that means trigger pin of ultrasonic sensor and similarly, the d2 uh. The digital pin on the arduino board d2 is connected with the echo pin uh echo pin of the ultrasonic sensor so here completes the complete pin diagram. So only if the connections are made clearly and perfectly enter module working and the entire project working or enter your use case will be solved so ensure you take good type of wires. That wires might should be very good uh and i always suggest to use. If you have jumper wires, then it is better to go with some jumper wires, because these jumper wires will make your connection very perfect, and this arduino board and this sensor are very compatible for these jumper wires.

So it is better if you go with jumper wires. So here comes the distance calculation using the ultrasonic sensor, so we are using our ultrasonic sensor only to calculate the distance. So it is very much important for us to solve this use case. So at the background we need to know the formula or the logic how the distance is calculated so that we can solve our use cases by writing a program. So we can only develop the program if you know the use cases for the different formula, how the task is being working in the background. So here the speed of the sound is velocity of the sound is 343 generally here rounded to 340 meters per second. So here, since we are taking our distance in centimeter, so we can convert it into a centimeter, so zero point zero three four centimeter per second, so that uh basic like formula is time, is equal to distance by speed. So here we are having distance of 20 centimeter speed of 0.034 centimeter per second. So by calculating this we are getting a time of 588 588 microseconds. So if you multiply this 588 value time with the zero point, zero three four by two then well be getting the distance so uh, based on this time, so here uh how much time uh we are taking. So this is based on the distance, so well be getting that well be getting how much uh or like how much distance our uh object is placed with the sensor.

So using this calculation we can uh with this uh formula. We can obtain the uh distance of our object from the sensor, so this calculation is very much important. So in the programmatic part, we will be using this calculation and will be storing our output, like the output of this calculation in our variable and will be showing that variable as a distance of the object from the sensor. So here the next sensor is ir sensor. So what is an io sensor? Uh, an infrared sensor, is an electronic device that emits in order to sense some aspects of our surroundings. So io sensor is an electronic device, so infrared sensor emits some some sort of waves or some sort of heat or some sort of radiation to a sense. The things around its surroundings, so an ir sensor can measure the heat of an object as well as detects. The motion, so io sensor can can measure the heat of an object and it detects the motion. So these type of ir sensor that measures the that uh emits the heat of an object and it detects. The motion is known as a pir sensor. They are known as the passive infrared sensor, so this passive infrared sensor measures the heat of an object and detects the motion of the objects. So, but we are technically dealing with only the io sensor, infrared sensor in this slide, so the intranet sensor pin configuration. This is a typical view of our infrared sensor, which are available in the local stores, so this is how our infrared sensor looks like.

So we are having different things on this uh pcb board and we are having. This is the ir receiver, and this is the ir emitter led. So this emits emitter led – and this receives so as told in the definition or the description io sensor will is like an emitter, so that emits some sort of radiations and some sort of waves and it identifies or sends its surroundings uh through this receiver. And here we are having the distance adjust, so how how much distance these ir sensor are. The light waves must be emitted by this led can be adjusted by using this potentiometer, and here we are having the power led when we are given with the proper supply voltage. This led will be glowing and here we will be having some obstacle led, but this is not present in most of the operas like uh uh, practical ir sensors, so this led uh will present, and here we have the pin configuration we have three pins vcc ground And output pane so as told in before every board requires some voltage for its functioning. So vcc and ground are front. Voltage are the power of the board, and out is the output pin that whatever this is uh senses the information it is being sent to the microcontroller through this pin? Let us look into the working of ios sensor, so here we are having uh one reflecting surface and one with without any reflecting surface.

So here we have the transmitter and the receiver similarly transmitter in the receiver. Here the transmitter is led, which emits the uh light wheels. So here the led emits the waves uh, and these are uh being reflected by the some reflective surface if they are reflected. Obviously they are captured by this receiver. So we can uh estimate or we can uh believe that there is some obstacle, so this ir sensor can capture some obstacles which are present in front of it, whereas in this case these are emitted, but there are no objects or reflective surface in front of it. So these waves are not reflected; hence there are no objects present in front of this. So generally, the use case of ir sensor is to capture the. If there are something present in front of it or it is used for line followed robots where you can very, it follows the black line path with the help of this ir concept. So in this way the io sensor works here. It is a pin diagram of ir sensor. It is very much important to know about the pin diagram of any sensor with the or without microcontroller board. So here we are having our ir sensor with the three pins, a vcc ground and the output pin. So here the vcc and ground pin are connected to the five volts and ground of the arduino board uh. So here in the arduino uno board, the digital pin to d2 is connected to the output pin of ir sensor.

So whatever the things that are being censored by this sensor are given input to this microcontroller and uh by with the help of our programming or our code, we can manage uh these information and perform our task or the solve our use case. So in this way, the ir sensor working and the pin diagram lies. So it is very much important to know about the different kinds of sensor. Uh that are being used are being useful uh to solve our use cases. So in the upcoming lectures i will be discussing about other type different kinds of sensor, so this is the end of this lecture.