Infrared sensor:

An infrared sensor is an electronic device, that emits in order to sense some aspects of the surroundings. An IR sensor can measure the heat of an object as well as detects the motion. These types of sensors measures only infrared radiation, rather than emitting it that is called as a passive IR sensor.


Usually in the infrared spectrum, all the objects radiate some form of thermal radiations. These types of radiations are  invisible to our eyes, that can be detected by an infrared sensor. The emitter is simply an IR LED (Light Emitting Diode) and the detector is simply an IR photodiode which is sensitive to IR light of the same wavelength as that emitted by the IR LED. When IR light falls on the photodiode, The resistances and these output voltages, change in proportion to the magnitude of the IR light received.

An infrared  sensor circuit is one of the basic and popular sensor module in an electronic device. This sensor is analogous to human’s visionary senses, which can be used to detect obstacles and it is one of the common applications in real time.Playme consists of three Infrared sensor known as left obstacle sensor, right obstacle sensor, Back parking sensor.

In this we are checking all three sensors.

Goto mblock software and open it.

Goto edit menu and select Arduino mode.


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Playme Robot Program is a Header file for Robot programming. It makes programming simple. By using this we can access all blocks easily and smoothly. If we are not using this then it may give us errors in program. So put this at start of program.


 

 

 

 

 

Figure 8: Loop Selection

Here we are using loop. Loop is area which will be repeated for certain times depending upon its type. If we write anything inside loop then it will be repeated along with loop. Forever loop means program will run continuously. For example if we write a program to run motor in forward direction with forever loop then it will run until we remove power applied to it.

Select block Send to Computer and drag it in programming window.

Put it in forever loop. Here we are writing Hello for message printing. You can write any message instead of Hello.


To get Left sensor value take Left Obstacle Block


Connect that block to Send to computer .



Connect wait statement of 1second below this.


Now save program.


 

Give name to program.


 

Select COM port

 


 

Click on Upload Arduino option


 

After uploading is done you will get this message.


Click on close option.

Again go to Serial port and select COM port


And see output of your program


To get proper message select Char mode for both send encode mode, recv encode mode.


And see sensor value on your screen. It will be displayed on screen after every one second.

Similarly you can perform above steps for Right obstacle sensor.


To get right sensor value take Right Obstacle Block


Connect that block to Send to computer .



Connect wait statement of 1second below this.


Upload program and Select COM port


And see output of your program


You can see this response which is not in proper number. To get proper message select Char mode for both send encode mode, recv encode mode.


And see output of sensor on your screen. It will be displayed on screen after every one second.

In playme back Infrared sensor can be used as parking sensor. This will help us to park robot safely without colliding with obstacle.

To get Back sensor value take Backside sensor


 

Connect that block to Send to computer .



Connect wait statement of 1second below this.


Select COM port

Click on Upload Arduino option

Go to Serial port and select COM port


And see output of your program


To get proper message select Char mode for both send encode mode, recv encode mode.


And see sensor value on your screen. It will be displayed on screen after every one second.

    
 

 

    

Subscribe To All Upcoming Tutorials

Join our mailing list to receive the latest tutorials and updates from kitflix team.

You have Successfully Subscribed!