Return to site

Ir Sensor Using Lm358

broken image


This blog has designed a simple and usable infrared sensor circuit. The design of it not only based on the LM358 chips and technology but also using the knowledge of digital and analog circuits. It can also increase the radiation distance by adjusting the resistance of the potentiometer so that the circuit can be used as an alarm. Read more about IR (InfraRed) proximity sensor / Obstacle detector circuit using LM358 opamp LED chaser circuit / Sequential LED flasher using 4017 IC and 555 timer A tutorial on how to make an LED chaser lights (or) sequential LED flasher circuit on a breadboard using 555 timer + 4017 IC and a few other components.

Hup seng biscuit. 1 to 10 of 10700 for Hup Seng Cream Crackers Cream Crackers (Hup Seng) Per 4 pieces - Calories: 160kcal Fat: 9.00g Carbs: 19.00g Protein: 2.00g Nutrition Facts - Similar. Hup Seng Hup Seng - Wholemeal Crackers. Serving Size: 3 pieces. How does this food fit into your daily goals? Calorie Goal 1,880 cal. 120 / 2,000 cal left. Percentages are based on a diet of 2000 calories a day. There are 150 calories in 4 pieces of Cream crackers by Hup Seng from: Carbs 21g, Fat 7g, Protein 3g. Get full nutrition facts for your favorite foods and brands. Protein 2.6g There are 162 calories in 1 serving (4 pcs) (31 g) of Hup Seng Wholemeal Crackers. Calorie breakdown: 47% fat, 47% carbs, 6% protein. There are 120 calories in 3 pieces (23 g) of Hup Seng Wholemeal Crackers. Calorie Breakdown: 46% fat, 47% carbs, 7% prot.

  1. Ir Sensor Using Lm358
  2. Ir Sensor Using Lm358
  3. Working Of Ir Proximity Sensor Using Lm358
  4. Ir Proximity Sensor Circuit Using Lm358

An IR sensor is an electronic device, that produces in order to detect some parts of the environs. An infrared sensor can measure the heat of an object as well as detects the motion. These sensors are used to measure only IR radiation, rather than producing it that is called as a passive infrared sensor. Generally in the IR spectrum, all the surrounding objects generate different form of thermal radiation.These kinds of radiations are not observable to our eyes, that can be sensed by an IR sensor. The emitter of the sensor is infrared LED and the sensor is an IR photodiode which is sensitive to infrared light of the same wavelength as that produced by the infrared LED. When infrared light drops on the photodiode, the resistances and o/p voltages change in proportion to the received magnitude of the infrared light.

What is Infrared Sensor?

IR sensor is an electronic device which is used to sense heat & objects. It works with the sensing of IR radiations and variation in heat in its nearby. IR sensors are classified into two types such as photo IR sensor and thermal IR sensor.

IR Sensor Working

  • A thermal infrared sensor detects the change of heat from its nearby objects
  • The photo IR sensor uses a photo diode to sense IR radiations. In this article as an infrared sensor a photo IR sensor is used to build the circuit.

The applications of the infrared sensors involve from domestic devices to industrial devices. These sensors are used in object sensing, motion detectors, obstacle avoidance robot, gas leakage detection, smoke detection, measurement of distance, robotics and many more.

Infrared Sensor Circuit with Working

The IR sensor circuit diagram is shown below. In the circuit below, the main parts of this sensor are photo diode and the IR receiver LED. Photo diode emits IR radiations when it strikes to any object, then turn back with some angle. The IR receiver detects reflected radiations. Because in this circuit, we are using a photo diode, so this type of sensor is called a photo infrared sensor.

The Required Components of Photo Infrared Sensor include IR receiver TSFF5210, Photodiode, 100 ohm resistor, 10k resistor, 10k variable resistor and LM358 IC. IC Lm358 is used as a comparator when IR receiver senses IR radiations. When the o/p of lm358 goes high, then LED connected at the o/p turns ON. The output pin of the IC LM358 is used to interface with PIC microcontroller.

IR Sensor Circuit Interfacing with PIC18F4550 Microcontroller

The output of the infrared sensor circuit is connected to PIC microcontroller pins and the microcontroller will take it as digital input either 0 or 1. According to the o/p of the infrared sensor module, the microcontroller will react by glowing LED.

Lm358

The o/p of the infrared sensor circuit is connected to RA0 pin of the pic microcontroller. It is arranged as i/p with TRISB registers and the o/p of this interfacing will be displayed on LED that is connected across PORTD includes RD5, D6, RD7. Here o/p pins are RB0 and RB1.

IR Sensor Circuit Interfacing with PIC18F4550 Microcontroller

This project doesn't need to perform any ADC, hence we are going to turn off the ADC and all the pins configured as digital. At the 1MHz default oscillator frequency, sometimes the o/p gives unbalanced result. Therefore, tuning the PIC microcontroller to 8MHz solves the problem. From this we can conclude that, this microcontroller works with 1MHz and we can change the settings of OSCCON bits to adjust the oscillator frequency according to your necessity.

OSCCON register bits can be found in the microcontroller datasheet with description. A bits settings table to configure the PIC microcontroller oscillator frequency, internal oscillator is configured with 8MHz to avoid rebouncing of the switch. In the above circuit, we can use voltage regulator IC 7805 to avid voltage variations which could damage the pic microcontroller. Make sure that the input of the microcontroller should not exceed +5Volts.

Coding for IR Sensor Interfacing with Microcontroller

/*
* File: infraredinput.c
* Author: ron
* December 10, 2012, 1:21 PM
*/
#include // Include Header for PIC18F4550
#define switch1 PORTAbits.RA0 // Switch on RA0
#define led1 LATDbits.LATD7 // led1
#define led2 LATDbits.LATD6 // led2
#define led3 LATBbits.LATB0 // led3
#define led4 LATBbits.LATB1 // led4
#define led5 LATBbits.LATB2 // led5
void main (void)
{
/* If you want your microcontroller to work at 1MHZ then comment the three lines below */
OSCCONbits.IRCF0 = 1 ; // set internal clock to 8 MHz
OSCCONbits.IRCF1 = 1; // For Avoiding switch debouncing problem
OSCCONbits.IRCF2= 1; //
/* Input output settings*/
TRISAbits.TRISA0 = 1; // RA0 Input for taking input from IR sensor
TRISDbits.TRISD7 = 0; // Port D pins output
TRISDbits.TRISD6 = 0;
TRISBbits.TRISB0 = 0; // Port B pins Output
TRISBbits.TRISB1 = 0;
TRISBbits.TRISB2 = 0;
CMCON = 0x07; // Disable Comparator
ADCON1bits.PCFG0 = 1; // These 4 settings below determines the analog or digital input
ADCON1bits.PCFG1 = 1; // In our case we are making all the pins digital
ADCON1bits.PCFG2 = 1; // by setting them as 1111
ADCON1bits.PCFG3 = 1; // Check with the datasheet for a nice desc of these bits and config.
ADCON0bits.ADON = 0; // Disabled ADC
while(1)
{ //Forever Loop
if(switch1 1) // On reading IR sensor value ON
{ //Turn led ON
led1 = 1;
led2 = 1;
led3 = 1;
led4 = 1;
led5 = 1; }
else if ( switch1 0) // On reading IR Sensor Value OFF
{ //Turn led off
led1 = 0;
led2 = 0;
led3 = 0;
led4 = 0;
led5 = 0; }
else { }
} //End While loop –forever
}
/* THE END */

The above code for IR sensor interfacing with microcontroller, comment lines helps you a lot for better understanding of the interfacing. By using this project you can develop your own applications as your requirement. This is very easy and simple to interface this project with motor driver to drive the motors as a simple infrared robot or an infrared sensor motor driver.

Ir Sensor Using Lm358

Thus, this is all about what is IR sensor, IR sensor working, IR sensor circuit, IR sensor interfacing with PIC microcontroller and its code.We believe that you have got a better understanding of this concept. Furthermore, any queries regarding this topic or electrical and electronic projects, please give your valuable suggestions by commenting in the comment section below.

Photo Credits:

  • IR Sensor Working by education
  • IR Sensor Interfacing by rakeshmondal

A tutorial on How to make an InfraRed (IR) proximity sensor circuit along with detailed explanation on how the circuit works. The sensitivity or Range of detection can also be controlled by adjusting the potentiometer. Watch the video above for detailed step by step instructions on how to build this circuit. Explanation of how the circuit works is also included in the video.

[Schematic for this IR proximity sensor circuit is at the end of this article]

Components Required:

  1. LM 358 IC
  2. 1 InfraRed LED PhotoDiode pair
  3. Resistors: 2 x 270R, 10K
  4. Potentiometer: 10K
  5. Breadboard
  6. Power Supply: (3-12)V
  7. Few Breadboard connectors

Explanation of Circuit's Working:

[Watch the video at the beginning of this post for better visual understanding]

The sensing component in this circuit is IR photo-diode. More the amount of InfraRed light falling on the IR photodiode, more is the current flowing through it. (Energy from IR waves is absorbed by electrons at p-n junction of IR photodiode, which causes current to flow)

Ir Sensor Using Lm358

This current when flows through the 10k resistor, causes potential difference (voltage) to develop. The magnitude of this voltage is given by Ohm's law, V=IR. As the value of resistor is constant, the voltage across the resistor is directly proportional to the magnitude of current flowing, which in turn is directly proportional to the amount of Infra-Red waves incident on the IR photodiode.

So, when any object is brought nearer to the IR LED, Photo-Diode pair, the amount of IR rays from IR LED which reflects and falls on the IR photodiode increases and therefore voltage at the resistor increases (from the deduction in previous para).

We compare this voltage change (nearer the object, more is the voltage at 10K resistor / IR photodiode) with a fixed reference voltage (Created using a potentiometer).

Here, LM358 IC (A comparator/OpAmp) is used for comparing the sensor and reference voltages. The positive terminal of photodiode (This is the point where the voltage changes proportion to object distance) is connected to non-inverting input of OpAmp and the reference voltage is connected to inverting input of OpAmp.

Working Of Ir Proximity Sensor Using Lm358

The OpAmp functions in a way that whenever the voltage at non-inverting input is more than the voltage at inverting input, the output turns ON.

When no object is near the IR proximity sensor, we need LED to be turned off. So we adjust the potentiometer so as to make the voltage at inverting input more than non-inverting.

Ir Proximity Sensor Circuit Using Lm358

When any object approaches the IR proximity sensor, the voltage at photodiode increases and at some point the voltage at non-inverting input becomes more than inverting input, which causes OpAmp to turn on the LED.

In the same manner, when the object moves farther from the IR proximity sensor, the voltage at non-inverting input reduces and at some point becomes less than inverting input, which causes OpAmp to turn off the LED.

Circuit Diagram:

[Note: For supply voltage of 9V or more, use 1K resistor for LED and 470R for InfraRed(IR) LED.]

Troubleshooting Guide:

  1. Double-check all connections by referring to the circuit diagram.
  2. Check if the LED's are working properly. (Digital cameras can detect InfraRed light, so you can check if the InfraRed LED is working by using any digital camera)
  3. The IR photo-diode used in this video is white and the IR LED is black. But it can also be the other way in your case. You can determine which one is LED/Photo-diode by connecting both the diode, photo-diode pair seperately to the power supply (via a 220 resistor) and see which one glows using a digital camera.
  4. At one extreme position of the potentiometer's knob, the LED should be off and at the other extreme position, the LED should be on. Now you can start turning the potentiometer's knob form the extreme position where the LED is on, until the LED just turns off. Now the IR proximity sensor should work properly.
  5. If the above steps doesn't help, feel free to post the problem in this project's youtube page: https://www.youtube.com/watch?v=qEMtCKfZOHw

Category





broken image