Obstacle Avoider Using Atmega 8, IR Sensor, Embedded C Programming On AVR Tutorial
Obstacle Avoider Using Atmega 8, IR Sensor, Embedded C Programming On AVR Tutorial
Obstacle Avoider Using Atmega 8, IR Sensor, Embedded C Programming On AVR Tutorial
14
Obstacle Avoider using Atmega 8,IR sensor ,Embedded c
programming on AVR tutorial
This demo cum tutorial is basically to show and explain the functioning of one of the most basic
robotic projects that is the Obstacle avoider robot.
Now coming back to the IR sensors these sensors as you can see there are two led like structures
in the front, one of them is basically an IR led which transmits infra-red radiation and
the other is the receiver or more commonly known as photo diode ,the photo diode is basically diode
or a PN junction which when receives any type of radiation not necessarily be infra-red forms
electron-hole pairs in the depletion region thereby allowing more current to pass so whenever there
is an obstacle in front the receiver gets the reflected radiation of the transmitter
from IR led and it starts allowing more current to pass and if we were to connect a resistor in series
with it the voltage across the resistor would rise as more and more current is passed
as a result of increasing IR radiation which is a result of decreasing distance between the bot and
the obstacle now if we put the increasing voltage across the resistor into a voltage
comparator built with an OP Amp where we compare the resistor voltage with a pre-adjusted voltage
it gives us a high output on the op amp whenever the obstacle comes too close to the bot.
and that my dear is supplied to the input pins of the micro-controller which are programmed to
respond accordingly.
The grounds are all connected the left one is the IR led the right one is the Photo diode op amp acts
as comparator comparing with the output of a voltage divider.
Now when the microcontroller gets these inputs lets say it gets a high from the the right sensor and a
low from the left sensor so that means there is an obstacle on the right so
the bot moves back nd then rotates towards
left and again moves forward and vice versa now whenever there is an obstacle directly in front the
bot moves back some paces and and the rotates at random left or right then the
whole process is repeated so there you have it an obstacle avoider.
he basic concept of IR(infrared) obstacle detection is to transmit the IR
signal(radiation) in a direction and a signal is received at the IR receiver when the IR
radiation bounces back from a surface of the object.
IR Transmitter
ON state = 10ms
If the transmission of the carrier signal is prolonged, in other words, instead of having
a short transmission period(10 milliseconds in our case, as explained in the figure) of
carrier signal, if we have it for a long period of time then the receiver module will
treat it as a noise and ignores receiving the transmitted signal.
Here in the figure 5k ohms pot is used instead of 1200 ohms resister, so that it can be
adjusted for 38 kHz frequency. This adjustment is required because of the tolerance
value of the components used in the circuit. The best way to over come this is to
connect the circuit to the oscilloscope and trim the pot to get 38 kHz. In case you done
have access to oscilloscope, still you can check it with IR receiver circuit. Secondly
you can trim the 500 ohms pot depending on the distance you intend to operate the
sensor. Its observed that, by adjusting the 500 ohms pot to 200 ohms, it is possible to
detect obstacles with in 50 cms of range from the sensor.
This approach needs additional software and this software is referred as firmware /
embedded software because this software will be flashed / downloaded in to the
microcontroller.
The source code is provided in the “Software Section” of this web site. The steps
required to use the firmware are provided along with the source code.
IR Receiver
Code for IR based obstacle detection is provided in the software section, please go
through the link --> Code to detect obstacle using IR(Infrared) sensor
Once the transmitter and receiver is complete, both should be placed at a certain
angle, so that the obstacle detection happens in a proper way. This angle is nothing
but the directivity of the sensor, which is generally +/- 45 degrees.
Also remember, that a thick enclosure is necessary for both IR transmitter and IR
receiver, because the IR radiation may bounce back from the surrounding objects
which may not help when you want to detect obstacle in one direction. Some times, if
you don’t have a thick enclosure then the signal may directly reach the receiver even
without having an obstacle. The enclosure can be made out of plastic or even metal
materiel which is painted black in color.