You are on page 1of 31

Micro-Controllers & Robotics

Raman kumar Lovely Professional University

A sensor when coupled with an electronic circuit converts the physical change into a signal which can be read by an observer or by an microcontroller.

The most common use of sensors is to get feedback from external environment.

IR Sensor Pair
IR sensor Pair Object / Line

Transmitter (Tx)

Receiver (Rx)

Transmitter = LED (Light Emitting Diode) Receiver = Photodiode

Similar to normal LEDs but emit infra-red light Glow can be seen with a digital camera or mobile phone camera.

A photodiode is a diode that conducts only when light falls on it.

O/p = = 5 V 0.7 V


Principle of Operation
WHITE surface Maximum reflection T1 is turned ON Vout is LOW

BLACK surface Minimum or No Reflection T1 is turned OFF Vout is HIGH

R1< R2

Interfacing IR sensor with microcontroller

Out: 1
Out: 0 Port 1

A T 8 0 5 1

0 1 2


Sensor Connector on board

Vcc GND O/p

Programming IR sensor with 8051

#include <regx51.h> void main( ) { P12=1;

while(1) {
If ( P12==1) // do something else // do the other thing } }

Vout is ANALOG
But uC being digital can only read it as 0 or 1. 0 if Vout < 1.2 V 1 if Vout > 1.2 V However most applications require much higher resolution & multiple levels.


Vcc O/p


is also an IR sensor, but phototransistor in the following aspects.



- O/p is either 0 or 5V
- Responds only to IR pulses at 38KHz ( or 36KHz) - 3 terminal device (Vcc, GND and O/p)

- Has a lot of electronic circuitry inside along with simple IR Rx.

TSOP is the IR receiver used in TV sets for receiving signals from remote control.

TSOP Output

No IR Light

f = 38KHz Constant IR Light

f 38KHz

O/p = 5V 0V

Commonly available models of TSOP are
TSOP1736 TSOP1738
responds only to pulses at 36KHz responds to 38KHz pulses

To use TSOP as Rx, the IR LED must blink at 38KHz (36KHz).

So a 38KHz waveform needs to be applied at the +ve i/p of IR LED instead of the constant +Vcc as in earlier case. This 38KHz signal can either be generated used PWM mode of timers or separate astable multi-vibrator made using NE555.

Complete TSOP sensor



38KHz waveform source

O/p Vcc

Wireless Control of Robots

RF Remote (radio Control)

RF Modules
IR Remote Mobile Phone

RF Remote
Plug n play remote, everything ready
Numerous controls Very costly Rx Can be directly connected to motor driver

RF Modules
Rx Can be directly connected to motor driver Require external Antenna to be connected. Require parallel to serial converter at Tx and vice versa at Rx Commonly avai freq are : 315MHz, 345 MHz, 434 MHz

IR Remote

Replacement of H bridge

Raman 9988900339

Download this ppt
From within LPU : student login UMS