Sunteți pe pagina 1din 25

Sensors

A sensor is a device which measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument. They are used to provide feedback from the external environment

WORKING OF IR SENSORS
The infrared phototransistor acts as a transistor with the base voltage determined by the amount of light hitting the transistor. Hence it acts as a variable current source. Greater amount of IR light cause greater currents to flow through the collectoremitter leads. As shown in the diagram below, the phototransistor is wired in a similar configuration to the voltage divider. The variable current traveling through the resistor causes a voltage drop in the pull-up resistor. This voltage is measured as the output of the device

IR reflectance sensors contain a matched infrared transmitter and infrared receiver pair. These devices work by measuring the amount of light that is reflected into the receiver. Because the receiver also responds to ambient light, the device works best when well shielded from abient light, and when the distance between the sensor and the reflective surface is small(less than 5mm). IR reflectance sensors are often used to detect white and black surfaces. White surfaces generally reflect well, while black surfaces reflect poorly. One of such applications is the line follower of a robot.

IR Sensor Pair
IR sensor Pair Object / Line

Transmitter (Tx)

Receiver (Rx)

Transmitter = LED( Light Emitting Diode) Receiver = Photodiode

The resistance of the sensor decreases when IR light falls on it. A good sensor will have near zero resistance in presence of light and a very large resistance in absence of light.

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 ATmega16


Out: 1
Out: 0 PORTA

A T M E G A

0 1 2

In

Programming IR sensor with ATmega16


#include <mega16.h> void main() { int x; DDRA=0b00000011; // last two pins as o/p for Vcc & GND PORTA.0 =1; // Vcc PORTA.1= 0; // Gnd x= PINA.2; // now you can use x for any calculation u want }

COMPARATOR

Registers used in the ADC ADMUX ADC Multiplexer Selection Register ADCSRA ADC Control and Status Register A
These registers are used to configure ADC However when using CVAVR this will be done by code wizard

Configuring ADC using Code Wizard


1. Open a new project 2. Select yes to use code wizard 3. Goto ADC tab on Code Wizard ADC

Line Follower : Design


The bot has two IR sensors facing downwards (towards the floor).
Sleft

Sright

The separation between the sensors is such that in normal (correct) position of the bot , both the sensors are on white surface. ie separation > strip width The bot is driven by two wheel differential drive ie the two back wheels are driven by independent motors.

Line Follower : Algo


When the bot is in correct pos, both sensors are on white & read LOW. The robot should move forward in this case.
Sright

Sleft

Sleft LOW

Sright LOW

Movement Forward

Line Follower : Algo


Sleft Sright

When the bot is over line from right side, left sensor is on white & reads LOW whereas right sensor is on black & reads HIGH The robot should take a right turn in this case to come back in correct pos.

Sleft LOW

Sright HIGH

Movement Right Turn

Line Follower : Algo


When the bot is over line from left side, right sensor is on white & reads LOW whereas left sensor is on black & reads HIGH The robot should take a left turn in this case to come back in correct pos.

Sleft HIGH

Sright LOW

Movement Left Turn

Line Follower

Sleft LOW

Sright LOW

Movement Forward

Left Motor Forward

Right Motor Forward

LOW
HIGH

HIGH
LOW

Right Turn
Left Turn

Forward
Back

Back
Forward

IN THIS WHEN VOLTAGE V > 2.5 OUTPUT IS 1 AND IF V < 2.5 OUTPUT IS 0.

Contacts
Name Nikhil Gupta Manish Singhal Rishabh Tekriwal Tanmay Agarwal Deepak Kumar Contact 9795359594,9044059843 9450150792 8960976256 8573900881,8009607882 8565997407 Email nikhilgupta1003@gmail.com manishsinghal230792@gmail.com tekriwalfamily@gmail.com tanmay.iitbhu@gmail.com deepakrocks0009@gmail.com

Gaurav Mishra Prabha Shankar lahariya


Rishabh Yadav Vijay Singh Harshit Gupta

8303340071 8004274085
9044172285 9044612364 7860495316

gauravmishra0098@gmail.com plahariya72@gmail.com
yrishabh24@yahoo.com vijaysingh15793@gmail.com harshitgupta1108@gmail.com

S-ar putea să vă placă și