Cognoscis

Think. Understand. Apply

Modulated IR sensor

Posted by cognoscis on 3rd October 2008

You want better quality sensors that are immune to noise and have a good range too. All the conventional methods yield low range. Hence, we go for the modulated IR sensors. Modulation is a process of imposing the message signal on a “carrier”. Anyways, lets not get deep into it. For the context, its just that we use a particular frequency to transmit and receive the signal that is used in the sensor. Now, I am going to discuss the circuit that works around a IR receiver IC called TSOP. This receiver works at 38kHz frequency, hence the transmitter must be woring at the same frequency. So, lets design an IR transmitter for the same.

As shown, we use 555 timer in the astable mode to get the required frequency and supply it to the IR LED. The operation of the timer is pretty straight forward. The relevant equation is given below

f=1/(0.693 x C2 x (R1 + 2 x R2))

The values I have given are just an example. You can try out different combinations so that you will be able to place resistors that are close to the calculated values(meaning, we dont get resistors with value 111? so choose the value carefully). The reisitors R3 and R4 are current limiters and the transistor 2N2222 is used as a switch. You may use any other transistor as a switch. Now, lets come to the tricky part

The LED will always need more cooling time. You cant pump in more current into the LED than what it can take. If you dont take care of that, the LED will overheat and will be spoilt or worse generate very high noise. Hence, be sure of the current it can take and set a suitable value to R4. of course you can calculate the current flowing through the LED by considering the branch from VCC-R4-transistor-LED-ground. Usually the drop across the transistor will be 0.2V (It depends on which transistor you use) and the drop across the LED is around 2V (Again it depends on your LED). So, 5V for VCC minus 2.2V which leaves 2.8V across the resistor R4. So, 2.8/47? ? 60 mA .

This is the same current that flows through you LED!! Simple right? Now, depending on your LEDs you can increase the current flowing. Varying R3 will increase the current too so you may use that to tweak your power. Also, you can send the 38kHz as bursts for short time. This will allow the LED to cool between bursts. By doing this, we can increase the current that is driven through the LED thereby increaing the power output. More power means, more range. But be careful NOT to send more that 125% of the rated current calue through your LED. A simple burst circuit may consists of two timers, one at 38kHz and other at 1kHz and these are given to AND gate. Hence, the output will be burst of 38kHz waves for 0.5ms(50% duty cycle). You can use 2 LEDs in the same circuit, but you need to decrease the resistance R4 appropriately. But more than 2 is not recommended.

Now lets look into the receiver part. TSOP is an IR receiver module. It has many series that work at 38kHz and 40kHz. Lets consider the 38kHz(Since I have used it, I am considering it. You may try the other receiver modules as well, there are plenty of modules available in the market).

Its a 3 pin IC as shown and the pin that is away from the other two is pin number 3. Pin 1 in ground and pin 2 is Vcc. Pin 3 is the output of the sensor which will be a logic 1 or logic 0. Please read the datasheet for more details. Anyways, this receiver IC makes our life much simple as we dont need to break our head to build a receiver circuit and get digital output from it. The simplest way to connect the circuit is as shown below

Simple right? Anyways, you need to orient your sensor and transmitter correctly so that you can receive the reflected wave efficiently. So, mounting is very important of both your LED and TSOP. The receiver has a directivity of 45°. So, you might want to see to it that you will keep it aligned as straight as possible. To use this IC efficiently, as mentioned earlier, use two timers and AND gate to send burst of signals. That will eliminate noise and the efficiency and accuracy of the receiver will improve. As said in the data sheet “After each burst which is between 10 cycles and 70 cycles a gap time of at least 14 cycles is neccessary.” Hence, by sending bursts, you will be able to improve the range also. This circuit must give you a range of 30 cm from transmitter and receiver.

Any suggestions, corrections or queries please comment :)

Tags: , ,
Posted in Robotics | 7 Comments »

IR sensors

Posted by cognoscis on 13th June 2008

After the LDRs, I now come to the next level of sensors, the Infra red sensors. I am going to describe the use of IR LED and IR photodiodes today. Now, if you have my post about LRD sensors(http://cognoscis.wordpress.com/2008/05/01/sensor-ldr/), you will notice that the working of the IR sensors in exactly the same. Then whats the advantage of using these sensors one might wonder. The main advantage of IR sensors in that it will not be affected by noise as much as the LRDs would be. Since LRD use white light, there can be many sources of noise for it.

IR LEDPhotodiode

IR LED(left) and IR detector(right)

The picture shows an IR LED and a photodiode that can detect IR radiations. We use the same principle as that of the LDR when we use these IR sensors to follow a white line. Once you have seen its working, you can apply it for different purposes. Similar to LDR, the photodiode will conduct only when IR light falls on it. That is, its resistance is very high when IR light DOES NOT fall on it; and its resistance is very low when IR light falls on it. Here again the output will be analog in nature as in the LDR circuit. So, if you are using this output to drive any IC, you will need to convert this to a digital signal first. That can be done in two ways, using comparators or using ADCs(Analog-to-Digital Converters). I will be using the comparator(similar to the LDR circuit) as its very easy to handle and also cheap. After the comparator, you will get a signal that can be fed to any IC, be it a micro-controller or logic gates.

IR emitter and detector circuit

IR Sensor circuit (Click to view)

The above circuit shows a simple design of sensor circuit. Towards the left is the emitter part. The 120? resistance is to limit current through the diode. You can make the LED grow brighter of dimmer by changing the value of resistance. But the problem with IR is that we cannot see it. But, the cameras can. If you have digital camera, mobile camera or a web camera, just see the image being formed on the screen, you will find that the LED glows with a green or blue colour. See, how easy it is :)

Now, lets see what happens in the detector part. This is the same as the LDR circuit. The comparator used here is the ever popular LM339D. its a quad comparator IC package. It has four comparators and here only one of them is shown. The potentiometer R2 acts as the reference voltage for the comparator. You can use a potentiometer of 10k?/10 turns so that you can set a suitable reference value. The IR detector is placed between VCC and ground. Now this acts as a switch. When OFF, the input to the comparator is VCC. When ON, input to the comparator is zero. Now, after you set up the circuit( preferably on your bread board) check the various voltage levels once.

See the voltage at the center pin of the pot(potentiometer) that is given to the pin 7 of LM339D. Now, by turning the pot you will be able to vary this voltage. Set it to 2.5V initially. Now, you check the voltage at pin 6 that is due to the detector. First, when the IR detector is covered, you will see that the voltage is equal to VCC. Now, allow the light to fall on the IR detector and see the fall in the voltage. It will around 0.5 to 1 V. Now, that you have tested your inputs, its time to see if you are getting the proper output.

The resistance R3 at the output is called the pull up resistor. The chip provides an output of only ground. hence, you pull up the output line to high using this resistor unless the IC pulls it down. Now, when the light falls on the IR detector, the input at in 6 will be less than the reference voltage which we have set at 2.5V. Now, the output will be low. If you take the light off the IR detector, the voltage at pin 6 rises above the reference. Hence, the output will be high. Thus, we get a digital output from the circuit. Now, one more good thing about this circuit is that you can set your reference voltage level by varying the pot. This will help to operate the sensor in any environment. All you need to do is check the minimum and maximum voltage from the LDR as described before and set the reference voltage value somewhere in between the two values obtained. Thats how you calibrate your sensors to a given environment.

Any problems or additions, please post as comments )

Tags: ,
Posted in Robotics | 12 Comments »