Top Banner

of 77

Pothole filler report

Jul 06, 2018

Download

Documents

Krishna Patil
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/17/2019 Pothole filler report

    1/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 1

    CHAPTER 1

    INTRODUCTION 

    The project aims towards providing an economical and reliable solution for pothole filling

     process. The idea behind this project is to help the society with technology that will provide an

    easy solution to the real life problem of monotonous task of filling the potholes. This project

     builds a robot which autonomously does the whole job of detecting and filling the pothole at

    regular periods to ensure the safety of the passengers on the road. Using real time and embedded

    system we present a prototype of the design, later this can be fabricated into a real life model

    with ease.

    1.1 

    General Introduction

    The aim of this project is to provide solution to the real life problem of fixing the potholes on the

    road by using embedded and real time systems. The autonomous filler robot will detect the

     potholes on the road and start filling them automatically and does the real time scanning for the

    filled condition. Filling a pothole is a monotonous task, it should be done at a regular periods to

    maintain the roads. Instead of manual filling of a pothole, automatic filling by a robot saves lot

    of time and funds which were wasted on the labours who work for repairing these potholes.

    In this project, Firebird V robot from NEX robotics is used as a platform for developing

    the robot. The basic platform is further built to have a mechanical assembly and is coded in such

    a way that it performs the pothole filling action by itself (without the aid of the user). The robot

    is navigated by means of two 75RPM DC motors, it also has position encoder to move exactly to

    a particular distance. It is fixed with four sharp sensors mounted on arm assembly to detect the

     potholes on the road. The arm assembly is rotated with the aid of servo motor. To fill the pothole

    the dispenser mechanism is activated by the stepper motor.

    The design of the mechanical assemblies can be of various sizes depending on the needs

    of the robot. The prototype design is limited with capabilities but real life model can be

    fabricated with little modifications.

  • 8/17/2019 Pothole filler report

    2/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 2

    1.2 

    Problem Statement

    In India, roadways are one of the major kinds of transport. Potholes on the roads pose a serious

     problem to the health and deeper potholes may even cause accident. Potholes should be regularly

    fixed by the laborers, finding a pothole and filling it manually is a monotonous task. Keeping

    these facts in mind, a robot is designed to eliminate the above problem.

    1.3 

    Methodology

    This project is applicable for fixing a pothole. This project is based on a microcontroller based

    autonomous robot which will automatically detect and fill the potholes which are present on the

    road. When all potholes are filled the robot indicates it with a buzzer sound.

    1.4 

    Scope of the Project

      The project aims to fix the potholes by an autonomous embedded system.

      Firebird V used as a platform for building the robot, further improvements can be

    made easily with this robot.

      The project makes effective use of resource and saves lot of time.

    1.5  Limitations

      Some parameters during design were limited to the prototype design. Real life model

    will be different.

  • 8/17/2019 Pothole filler report

    3/77

  • 8/17/2019 Pothole filler report

    4/77

  • 8/17/2019 Pothole filler report

    5/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 5

    Figure 2.2 Block diagram of FIRE BIRD V (Robotic Vehicle)

  • 8/17/2019 Pothole filler report

    6/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 6

    2.2 Hardware Requirements

      Fire Bird V Robot kit.

      Atmega2560 microcontroller

     

     Ni-MH battery pack, charger

      Geared DC motor ( 75 RPM )

      White line sensors

      Sharp distance sensors

      Motor drivers L293D

      LCD (16*2)

      External Motors

     

    Servo Motor

      Stepper Motor

      USB ISP Programmer

      Sun wood

    2.3 

    Software requirements 

      USB ISP Programmer’s GUI

     

    USB to Serial Drivers  AVR Studio

  • 8/17/2019 Pothole filler report

    7/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 7

    2.4 

    ATMEGA 2560 Microcontroller

    2.4.1 Pin description:

  • 8/17/2019 Pothole filler report

    8/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 8

    2.4.2 Features of the ATMEGA 2560 Microcontroller

    Advanced RISC Architecture, 8 bit microcontroller

     –  135 Powerful Instructions

     –  Most Single Clock Cycle Execution

     –  32 x 8 General Purpose Working Registers

     –  Fully Static Operation

     –  Up to 16 MIPS Throughput at 16 MHz

     –  On-Chip 2-cycle Multiplier

    256K Bytes of In-System Self-Programmable Flash

     –  4K Bytes EEPROM

     –  8K Bytes Internal SRAM

    Peripheral Features

     –  Two 8-bit Timer/Counters with Separate Pre-scalar and Compare Mode

     –  Four 16-bit Timer/Counter with Separate Pre-scalar, Compare- and Capture Mode

     –  Real Time Counter with Separate Oscillator

     –  Four 8-bit PWM Channels

     –  Twelve PWM Channels with Programmable Resolution from 2 to 16 Bits

     –  Output Compare Modulator

     –  16-channel, 10-bit ADC

     –  Four Programmable Serial USART

     –  Master SPI Serial Interface

     –  Byte oriented 2-wire Serial Interface

     –  Programmable Watchdog Timer with Separate On-chip Oscillator

     –  On-chip Analog Comparator

     –  Interrupt and Wake-up on Pin Change

    I/O and Packages

     –  86 Programmable I/O Lines 

  • 8/17/2019 Pothole filler report

    9/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 9

    2.5 Power supply unit:

    Fire Bird V consisting of 9.6v, 2.1Ah Nickel Metal Hydride battery which can be used to power

    robot for around 2 hours, in order to continue use for longer duration without worrying about the

     battery getting low, robot can be powered by external power source which is nothing but

    auxiliary power source. Auxiliary supply provides regulated 12V, 1Amp supply. When robot is

     powered by battery, it can use maximum of 2Amp current while Auxiliary supply will provide

    only 1Amp current. Robot’s power is divided in two separate power rails. “V Mot Supply”

     provides power to all the noisy devices on the robot such as motors and other heavy loads. “V

    Batt Supply” powers most of the electronics on the robot. Most of t he systems on the robot are

     powered by 3.3V and 5V via voltage regulators.

    2.5.1 V Batt Supply

    “V Batt Supply” stands for stabilized supply coming from the battery. This supply line is used to

     power almost all the payload on the robot. When battery is almost discharged (about 30% power

    remaining) and onboard payload draws current in excess of 2 amperes, then the battery voltage

    can fall below 6.3V momentary. Voltage regulators will not be able to function properly below

    6.3V and their output will fall below 5V. In this case the microcontroller can reset. To extend the

    usable battery life and to reduce the probability of microcontroller getting reset when battery is

    about to fully discharge, diodes D7 along with the capacitor C54 is used. When battery voltage

    suddenly drops, diode D7 prevents the reverse flow of the current and capacitor C54 maintains

    voltage within safe limits for about 100 milliseconds. For this duration capacitor C54 acts as

    small battery. Similar arrangement is done in the “V Mot Supply” using diodes D9 and capacitor

    C53. This scheme extends usable range of the fully charged battery.

    2.5.2 V Mot Supply

    “V Mot Supply” stands for motor supply. It is used to power DC motors and other heavy  loads

    which have lots of current fluctuations. It is the nosiest supply line on the robot. It should be used

    for heavy loads that require large amount of current. This supply can be varied between 8V to

    11.3V depending on the battery's charging state and type of power source (battery / auxiliary

     power) used. This line can supply additional 500mA to the external load.

  • 8/17/2019 Pothole filler report

    10/77

  • 8/17/2019 Pothole filler report

    11/77

  • 8/17/2019 Pothole filler report

    12/77

  • 8/17/2019 Pothole filler report

    13/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 13

    has very less infrared radiation even infrared black is still considered as black which makes red

    light as colour of choice.

    2.8 IR Proximity Sensors:

    Infrared proximity sensors are used to detect proximity of any obstacles in the short range. IR

     proximity sensors have about 10cm sensing range. These sensors sense the presence of the

    obstacles in the blind spot region of the Sharp IR range sensors. Fire Bird V robot has 8 IR

     proximity sensors. Figure 3.36 shows the location of the 8 IR proximity sensors. Sensors are

    numbered as 1 to 8 from left to right in clockwise direction. In the absence of the obstacle there

    is no reflected light hence no leakage current will flow through the photo diode and output

    voltage of the photo diode will be around 3.3V.

    Figure 2.6 IR Proximity Sensors

  • 8/17/2019 Pothole filler report

    14/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 14

    2.9 Sharp IR Range Sensor (GP2Y0A02YK)

    Features of GP2Y0A02YK :

      Less influence on colour of reflective objects, reflectivity.

      Detecting distance 10 to 80cm.

      Judgment distance.

      External control circuit is not needed.

      Low cost

    This is used to detect the potholes present is the arena. Sharp sensor consists of IR LED and

    CCD array boxed with precision lens mounted. These sensors have blind spot of particular range

    within which gives wrong reading. These sensors are attached to arm hence detects potholes.

      Blind spot: 0-10cm 

      Range: 10-80cm

    These sensors are attached to the arm hence they the detect the potholes

    Figure 2.7 SHARP IR Range Sensors

  • 8/17/2019 Pothole filler report

    15/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 15

    2.10 Position Encoders 

    Position encoders give position / velocity feedback to the robot. It is used in closed loop to

    control robot’s position and velocity. Position encoder consists of slotted disc which rotates  

     between optical encoder (optical transmitter and receiver). When slotted disc moves in betweenthe optical encoder we get square wave signal whose pulse count indicates position and time

     period / frequency indicates velocity.

    Optical encoder MOC7811 is used as position encoder on the robot. It consists of IR LEDand the photo transistor mounted in front of each other separated by a slot and encased in black

    opaque casing and facing each other through narrow window. When IR light falls on the photo

    transistor it gets in to saturation and gives logic 0 as the output. In absence of the IR light it giveslogic 1 as output. A slotted encoder disc is mounted on the wheel is placed in between the slot of

    MOC7811. When encoder disc rotates it cuts IR illumination alternately because of which photo

    transistor gives square pulse train as output. Output from the position encoder is cleaned using

    Schmitt trigger based inverter (not gate) IC CD40106.

    Figure 2.8 Position Encoders

    2.11 Liquid Crystal Display (LCD) 

    LCD used here has HD44780 dot matrix LCD controller. It is also called 16x2 Alpha Numeric

    LCD2. It can be configured to drive a dot-matrix liquid crystal display underthe control of

    ATMEGA 2560.

  • 8/17/2019 Pothole filler report

    16/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 16

    Figure 2.9 Liquid Crystal Display

    2.11.1 Operation modes of LCD:

    To reduce number of I/Os required, Fire Bird V robot uses 4 bit interfacing mode which requires

    3 control lines and 4 data lines. In this mode upper and lower nibble of the data/command byte

    needs to be sent separately. shows LCD interfacing in 4 bit mode with three control lines EN

    (Enable), RS (Register Select), and RW (Read / Write). The EN line is connected to PC2. This

    control line is used to tell the LCD that microcontroller has sent data to it or microcontroller is

    ready to receive data from LCD. This is indicated by a high-to-low transition on this line. To

    send data to the LCD, program should make sure that this line is low (0) and then set the other

    two control lines as required and put data on the data bus. When this is done, make EN high (1)

    and wait for the minimum amount of time as specified by the LCD datasheet, and end by

     bringing it to low (0) again. The RS line is connected to PC0. When RS is low (0), data is treated

    as a command or special instruction by the LCD (such as clear screen, position cursor, etc.).

    When RS is high (1), data being sent is treated as text data which should be displayed on the

    screen. The RW line is connected to PC1. When RW is low (0), the information on the data bus

    is being written to the LCD. When RW is high (1), the program is effectively querying (or

    reading from) the LCD.

    The data bus is bidirectional, 4 bit wide and is connected to PC4 to PC7 of the microcontroller.

    The MSB bit (DB7) of data bus is also used as a Busy flag. When the Busy flag is 1, the LCD is

    in internal operation mode, and the next instruction will not be accepted. When RS = 0 and R/W

    = 1, the Busy flag is output on DB7. The next instruction must be written after ensuring that the

     busy flag is 0. Refer LCD datasheet provided in documentation CD for using Busy flag.

  • 8/17/2019 Pothole filler report

    17/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 17

    Figure 2.10 LCD Timing Diagram

    LCD is interfaced to the pins 22 to 28 of the main board socket. LCD uses 5V System supply for

    its operation. For LCD backlight V Battery supply is used. Figure 8.45 shows LCD backlight

     jumper and LCD contrast control potentiometer. In order to save power LCD backlight can be

    turned off by removing LCD backlight jumper. LCD’s contrast can be adjusted by LCD contrast  

    control potentiometer.

    Figure 2.11 LCD Contrast Control

    2.12 Buzzer

    Robot has 3 KHz piezo buzzer. It can be used for debugging purpose or as attention seeker for a

     particular event. The buzzer is connected to PC3 pin of the microcontroller. Also the same

     buzzer is used in battery monitoring circuit to alert the battery low indication.

  • 8/17/2019 Pothole filler report

    18/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 18

    Figure 2.12 Buzzer 

    Buzzer is driven by BC548 transistor. Resistor 100K is used to keep transistor off, if the input

     pin is floating. Buzzer will get turned on if input voltage is greater than 0.65V.

    2.13 Servo Motor

    A servomotor is a rotary actuator that allows for precise control of angular position. It consists of

    a motor coupled to a sensor for position feedback, through a reduction gearbox. It also requires a

    relatively sophisticated controller, often a dedicated module designed specifically for use withservomotors. Servomotors are used in applications such as robotics. 

    Figure 2.13 Servo Motor

    http://en.wikipedia.org/wiki/Rotary_actuatorhttp://en.wikipedia.org/wiki/Reduction_gearboxhttp://en.wikipedia.org/wiki/Roboticshttp://en.wikipedia.org/wiki/Roboticshttp://en.wikipedia.org/wiki/Reduction_gearboxhttp://en.wikipedia.org/wiki/Rotary_actuator

  • 8/17/2019 Pothole filler report

    19/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 19

    2.13.1 Mechanism of Servo Motor

    As the name suggests, a servomotor is a servomechanism. More specifically, it is a closed-loopservomechanism that uses position feedback to control its motion and final position. The input to

    its control is some signal, either analogue or digital, representing the position commanded for the

    output shaft.

    The motor is paired with some type of  encoder to provide position and speed feedback. In

    the simplest case, only the position is measured. The measured position of the output iscompared to the command position, the external input to the controller. If the output position

    differs from that required, an error signal is generated which then causes the motor to rotate in

    either direction, as needed to bring the output shaft to the appropriate position. As the positionsapproach, the error signal reduces to zero and the motor stops.

    The very simplest servomotors use position-only sensing via a potentiometer. The motoralways rotates at full speed (or is stopped). This type of servomotor is not widely used in

    industrial motion control, but they form the basis of the simple and cheap servos used for  radio-controlled models. 

    More sophisticated servomotors measure both the position and also the speed of the

    output shaft. They may also control the speed of their motor, rather than always running at fullspeed. Both of these enhancements, usually in combination with a PID control algorithm, allowthe servomotor to be brought to its commanded position more quickly and more precisely, with

    less overshooting. 

    2.14 Stepper Motor 

    Stepper motor is an electric motor which is used in control system for the precise rotation bysome predefined angle. The Bipolar Stepper motor is very similar to the unipolar Stepper except

    that the motor coils lack center taps. Because of this, the bipolar motor requires a different type

    of controller, one that reverses the current flow through the coils by alternating polarity of the

    terminals, giving us the name - Bipolar. A Bipolar motor is capable of higher torque since entire

    coil(s) may be energized, not just half-coils. Where 4-wire steppers are strictly 'Bipolar'.

    The Bipolar Stepper motor has 2 coils. The coils are identical and are not electricallyconnected. You can identify the separate coils by touching the terminal wires together-- If theterminals of a coil are connected, the shaft becomes harder to turn.

    The Bipolar Controller must be able to reverse the polarity of the voltage across eithercoil, so current can flow in both directions. And, it must be able to energize these coils in

    sequence. Let us look at the mechanism for reversing the voltage across one of the coils...

    http://en.wikipedia.org/wiki/Servomechanismhttp://en.wikipedia.org/wiki/Closed-loop_controllerhttp://en.wikipedia.org/wiki/Encoderhttp://en.wikipedia.org/w/index.php?title=Error_signal&action=edit&redlink=1http://en.wikipedia.org/wiki/Potentiometerhttp://en.wikipedia.org/wiki/Motion_controlhttp://en.wikipedia.org/wiki/Servo_(radio_control)http://en.wikipedia.org/wiki/Radio-controlled_modelhttp://en.wikipedia.org/wiki/Radio-controlled_modelhttp://en.wikipedia.org/wiki/PID_controllerhttp://en.wikipedia.org/wiki/Overshoot_(signal)http://en.wikipedia.org/wiki/Overshoot_(signal)http://en.wikipedia.org/wiki/PID_controllerhttp://en.wikipedia.org/wiki/Radio-controlled_modelhttp://en.wikipedia.org/wiki/Radio-controlled_modelhttp://en.wikipedia.org/wiki/Servo_(radio_control)http://en.wikipedia.org/wiki/Motion_controlhttp://en.wikipedia.org/wiki/Potentiometerhttp://en.wikipedia.org/w/index.php?title=Error_signal&action=edit&redlink=1http://en.wikipedia.org/wiki/Encoderhttp://en.wikipedia.org/wiki/Closed-loop_controllerhttp://en.wikipedia.org/wiki/Servomechanism

  • 8/17/2019 Pothole filler report

    20/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 20

    Figure 2.14 H-Bridge for driving Stepper Motor

    This circuit is called an H-Bridge, because it resembles a letter "H". The current can be

    reversed through the coil by closing the appropriate switches - AD to flow one direction then BCto flow the opposite.

    Another way of depicting the H-Bridge... Since each half of the bridge can both sink and

    source current, it qualifies as a push-pull type amplifier, and can be drawn with the symbol for

    the amplifier.

    H-bridges are applicable not only to the control of stepping motors, but also to the control

    of DC motors, solenoids and many other applications, where polarity reversal is needed. Diodes protect the switches from the kickback of inductive type loads, such as the coils of a stepper.

    Two such circuits are needed to drive both coils of the bipolar stepper, and are commonlycalled a" Dual H-Bridge."

  • 8/17/2019 Pothole filler report

    21/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 21

    2.14.1 Conceptual Model of Bipolar Stepper Motor 

    Figure 2.15 Conceptual Model of Bipolar Stepper Motor

    The coils are activated, in sequence, to attract the rotor, which is indicated by the arrow in the

     picture. (Remember that a current through a coil produces a magnetic field.) This conceptualdiagram depicts a 90 degree step per phase. Assuming Terminal 1a is positive and 1b is

    negative, the rotor points to the East in this diagram. If these two terminals were reversed in

     polarity the rotor would point to the West. Coil 2 is entirely de-activated in the diagram.

    In a basic "Wave Drive" clockwise sequence, winding 1 is de-activated and winding 2

    activated to advance to the next phase. The rotor is guided in this manner from one winding to

    the next, producing a continuous cycle. Note that if two adjacent windings are activated, therotor is attracted mid-way between the two windings.

  • 8/17/2019 Pothole filler report

    22/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 22

    CHAPTER 3

    DESIGN AND IMPLEMENTATION

    This chapter discusses the algorithm, basic design and implementation of the different analog

    and digital circuit components employed in the project.

    3.1 Flowchart of the Project

    Figure 3.1 Flowchart of the overall project

    Start

    Divider detected

    to CenterIR range

    sensor?

    Finish

    U – Turn Interrupt

    White line following & pothole detection &

    filling with continuous divider sensing

    White line searching algorithm

    White

    line

    found?

    Y

    N

     

    Y

    N

  • 8/17/2019 Pothole filler report

    23/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 23

    Start

    Configure motion ports to adjust

    speed of robot

    Define motion sets for robot

    LCD Port Configure

    ADC Port Configure

    Left, Center, Right White line sensor and

    Center, Right, Left Sharp IR Range sensors

    ADC Conversion 

    Buzzer Initialization

    1

  • 8/17/2019 Pothole filler report

    24/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 24

    Estimation of Values for

    Range sensors in millimeter

    1

    Print Value on LCD

    Divider

    Detecte

    d?

    U-Turn

    Already

    taken ?

    Initialize Servo motor

    Scan the entire region with

    the arm mechanism

    U -Turn

    2

    N N

    Y Y

  • 8/17/2019 Pothole filler report

    25/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 25

    Figure 3.2.White line following and pothole detection algorithm

    2

     

    Pothole

    detected

    ?

    White line

    detected at

    center

    sensor?

    Print on LCD and

    Pothole filling

    al orithm

    Adjust to white line

    Move with maximum velocity

    Return

    Outside the left or right

    sensor

    Y

    Y

    N

  • 8/17/2019 Pothole filler report

    26/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 26

    Figure 3.3 U- Turn interrupt

    START

    MOVE FORWARD BY 30 CM

    TAKE RIGHT TURN BY 90

    DEGREES

    MOVE FORWARD BY 49 CM

    TAKE RIGHT TURN BY 90

    DEGREES

    RETURN

  • 8/17/2019 Pothole filler report

    27/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 27

    Figure 3.4 Pothole Filling

    CALCULATE THE MID POINT OF

    WIDTH OF THE POTHOLE

    CALCULATE THE MID POINT OF

    WIDTH OF THE POTHOLE

    TRANSFER THE POSITION

    OF THE DETECTEDPOTHOLE TO THE MAIN

    LEFT SENSOR BY

    EXTENDING THE

    DETECTION ANGLE

    RETURN 

    START

    POTHOLE

    DETECTED BY

    MAIN RIGHTOR

    LEFT SENSOR 

    IF POTHOLE

    DETECTED TOTHE RIGHT OR

    LEFT

    SECONDARY

    SENSOR 

    ROTATE STEPPER MOTOR IN

    ANTICLOCKWISE DIRECTION TILL

    FILLER REACHES CORRECT PLACE

    ROTATE STEPPER MOTOR IN

    ICLOCKWISE DIRECTION TILL FILLER

    REACHES CORRECT PLACE

    SENSE THE POTHOLE IN REAL TIME AND

    FILL TILL POT HOLE IS COMPLETELY FILLED

    SENSE THE POTHOLE IN REAL TIME AND

    FILL TILL POT HOLE IS COMPLETELY FILLED

    TRANSFER THE

    POSITION OF THEDETECTED POTHOLE TO

    THE MAIN LEFT SENSOR

    BY EXTENDING THE

    DETECTION ANGLE

    3 4

    3 4L

    R

    R

    L

  • 8/17/2019 Pothole filler report

    28/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 28

    Figure 3.1 to 3.4 depicts the flowchart of the project and its functionality. The robot continuously

    follows the white line and searches for the pothole when a pothole is found then the best point of

    filling is found out by the algorithm and then the filling takes. While filling real time scanning

    for the filled condition will takes place, when the pothole is filled the robot is again bound to

    follow the white line.

    To simulate the real scenario of the pothole filling we have designed an arena, the robot

    is supposed to travel on this arena,

    Fig 3.5 Blue Print of the arena

  • 8/17/2019 Pothole filler report

    29/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 29

    The robot is bound to complete the following tasks so as to complete the challenge of filling the

     pothole on the given scenario

    •  Traverse throughout the arena and scan the area for the potholes using arm assembly

    mounted on the robot.

    •  When Pothole is detected, automatically activate dispenser mechanism.

    •  Dispenser mechanism will fill pothole.

    •  Real Time scanning of pothole to ensure its complete filling.

    •  Make a U-turn when the other part of the lane is to be traversed.

    •  Should stop navigating when any obstacle is detected.

    •  Should indicate when the material in the source gets empty.

    The working of the complete project is divided into three kinds

    1)   Navigation

    2)  Pothole Detection

    3)  Pothole Filling

    3.2 Navigation

     Navigation consists of movement of the robot along the arena, to make this traversal possible, the following components are involved

      DC Geared Motor

      Position Encoder

      White line sensors

    3.2.1 DC Geared Motor

    Firebird V robot has two 75 RPM DC geared motors in differential drive configuration

    along with the third caster wheel for the support. Robot has top speed of about 24cm per second.

    Using this configuration, the robot can turn with zero turning radius by rotating one wheel in

    clockwise direction and other in counter clockwise direction.

  • 8/17/2019 Pothole filler report

    30/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 30

    3.2.1.1 PWM for DC Motor Speed Control

    Pulse width modulation is a process in which duty cycle of constant frequency square wave is

    modulated to control power delivered to the load i.e. motor. Duty cycle is the ratio of ‘TON/ T’.

    Where ‘TON’ is ON time and ‘T’ is the time period of the wave. Power delivered to the motor is

     proportional to the ‘TON’ time of the signal. In case of PWM the motor reacts to the time

    average of the signal.PWM is used to control total amount of power delivered to the load without

     power losses which generally occur in resistive methods of power control.

    Figure 3.6 PWM Illustration

  • 8/17/2019 Pothole filler report

    31/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 31

    Figure shows the PWM waveforms for motor velocity control. In case (A), ON time is 90%of

    time period. This wave has more average value and hence more power is delivered to the motor.

    In case (B), the motor will run slower, as the ON time is just 10% of time period.

    3.2.1.2 Logic level for the motor direction control

    Table 3.1 Microcontroller Connections for Motor 

    Table 3.2 Logic Levels for Motor control

  • 8/17/2019 Pothole filler report

    32/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 32

    3.2.2 Position Encoder: 

    Position Encoder is used for the precise movement during the U-turn of the robot to enter the

    other lane of the road

    Table 3.3 Position Encoder connections to Microcontroller

    3.2.3 White Line Sensors: 

    White line sensors are fitted to the robot so as to detect the white line in the center of the arena,

    the programming is done in such a way that the robot is brought back to white line when it goes

    off course. For white line sensors to properly work calibration must be done , the procedure is

    explained below.

    3.2.3.1 White Line sensor calibration 

    By using trimming potentiometers located on the top center of the main board, line sensors can

     be calibrated for optimal performance. Line sensors are factory calibrated for optimal

     performance. Using these potentiometers we can adjust the intensity of the red LEDs of the white

    line sensor. Sensitivity adjustment is needed, when colour contrast between the white and non-

    white surface in a white line grid is not adequate. In such cases the sensors can be tuned to give

    maximum difference between white and non-white surfaces. You can also turn on and turn off

    red LEDs and take sensor readings at the same place and nullify the effect of the ambient light.

    3.2.3.2 Effect of ambient light on the white line sensors  

    White line sensors are highly directional in nature hence they are immune to the illumination

    from tube light or CFL. Note that tube light which uses simple inductive chock actually blinks

    50times a second and this blink is captured by the white line sensors as ADC can acquire data at

    very fast rates. Hence it is recommended that use CFL lights or tube lights with electronic chock

  • 8/17/2019 Pothole filler report

    33/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 33

    or ballast. These tube lights are the one which turns on like a bulb without flickering. White line

    sensors are essentially sensitive photo transistors with precision lens assembly. All the photo

    diodes and photo transistors are many times sensitive to infrared than to red light. Hence for

    consistent result avoid room which have large windows even if they have curtains. Also avoid

    using robots in area illuminated with filament based bulbs as they have large infrared light

    radiation.

    3.3 Pothole Detection: 

    Pothole detection is done by the Sharp IR Range sensors which are facing downward to the road

    and these are fitted on the arms which are connected to the servo motor.

    3.3.1 

    Sharp IR range sensors: GP2YOA02YK IR

    The above is a precision distance sensor, which detects the potholes present in the arena. Range

    sensor basically consists of the IR (Infrared) led and linear CCD (Charged Couple Device) array

    which is fitted inside a plastic casing. When a narrow beam of IR Ray from the IR Transmitter

    incidents on any surface or objects, it reflects back to the linear CCD array. This accounts to the

    difference in angle produced due to the different distances from the object which is measured to

    get the corresponding analog output voltage from the sensor. The sensor works on Triangulation

    method and not on intensity. Thus it is immune to ambient light and can detect object of anycolour. This sensor has a blind spot of 0 to 10 cm where, sensors give erroneous readings. 

    To detect potholes present in the arena, we are using the Sharp IR Range sensor which is

    fitted on the arm mechanism with the help of moving arm we can scan entire region for detection

    of potholes. Servo motors are used to control two arm assembly. The Left arm detects the

     pothole to the left part of the road and the right arm to right side.

    The arms are placed at the height of 15 cm from the road level, on the top of the robot.

    The above mentioned sensors are attached at the far end of the arms in such a way that it faces

    downwards to measure the distance between road and sensor itself. When the arm is scanning,

    the pothole is an increase in the distance between the surfaces due to the depth of the pothole.

    This is how pothole is detected.

  • 8/17/2019 Pothole filler report

    34/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 34

    Fig 3.7 Side View of the Arm Assembly used in detecting Pothole

    Infrared Range

    Sensor for

    detection of

    pothole. 

    Servo Motor 

  • 8/17/2019 Pothole filler report

    35/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 35

    3.3.2  How Pothole is detected?

    Pothole is detected by the increase of distance; it is illustrated in the figures below,

    Fig 3.8 Illustration of Sharp sensor detection at normal surface

    Fig 3.9 Illustration of Sharp sensor detection at Pothole

    Height of Sensor from ground = x mm

    When Potholes detected = x mm + y mm = (x+y) mm

    When Potholes Filled = x mm

    So when Distance detected is x mm, it is detected that pothole is filled or there is no pothole and

    robot moves forward.

    Sharp Infrared Range

    Sensor at Pothole

    Distance > Normal

    distance 

    Sharp Infrared Range

    Sensor at Normal

    Surface.

  • 8/17/2019 Pothole filler report

    36/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 36

    3.3.3  Position of the IR Range Sensors on and around the robot

    Fig 3.10 Position of Sensors on and around the robot 

    Sharp Infrared Range

    Sensor Right- to detect

     potholes to the right of

    white line

    Sharp Infrared RangeSensor Primary Left- 

    to detect potholes to the

    left of white line

    Center Sharp Infrared

    Range Sensor - to give

     precise location to make

    a U-Turn

    Servo Motor for Arm

    Movements

    Four Dependent arms

    connected to single

    Servo Motor

    Auxiliary Arms

  • 8/17/2019 Pothole filler report

    37/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 37

    3.3.4 Construction of assembly for pothole detection

    Fig 3.11 Illustration of arm structure

    The arms are constructed with the help of the locally available material called the sun wood. This

    wood provides maximum strength and is very light weight, economical too. So this is chosen as

    the best material for the whole construction of the robot.

    Arms made

    from Fiber

    material

    (Sun wood)

  • 8/17/2019 Pothole filler report

    38/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 38

    3.3.5 Estimation of best point for filling

    The best point for filling is found out by the algorithm which finds the centroid of the whole

     pothole. Initially only a random point is detected while the robot is traversing, a when this

    algorithm is applied then the robot will find the best point by calculating the average of the

    maximum stretches of the ends of the pothole. That average will be the center of the pothole andit’ll be the best point for filling. 

    First Random point ofdetection

    Best point for Filling

    Initial pointFinal point

    First initial

    estimation for

    Fig 3.12: - Illustration of Selection of point of filling

    Angle traced by actionof servo

  • 8/17/2019 Pothole filler report

    39/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 39

    3.4 Pothole Filling: 

    3.4.1 Construction of Dispenser Mechanism

    Fig 3.13 Illustration of Dispenser Mechanism

    Container

    Sweeper

    Dispenser

    Mechanism

  • 8/17/2019 Pothole filler report

    40/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 40

    3.4.2 Stepper Motor

    Stepper motor is used here to switch left or right opening in the container which is connected to

    the primary arms

    Fig 3.14 Illustration of Gear Assembly

    Gear Assembly

  • 8/17/2019 Pothole filler report

    41/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 41

    3.4.2.1 Flow Selection using stepper motor

    Figure 3.15 Flow Selection Left

    Figure 3.16 Flow Selection Right

    Clockwise

    movement of

    stepper motor

    for right

    opening.

    Anti Clockwise

    movement of

    stepper motor

    for left

    opening.

  • 8/17/2019 Pothole filler report

    42/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 42

    3.5 Programming the AVR

    Figure 3.17 NEX Robotics ISP USB Programmer

     NEX AVR USB ISP STK500V2 is a high speed USB powered STK500V2 compatible. In-

    System USB programmer for AVR family of microcontrollers. It can be used with

    AVR Studio on Windows7 it can be used in HID mode with GUI as programming interface. Its

    adjustable clock speed allows programming of microcontrollers with lower clock speeds. The

     programmer is powered directly from a USB port which eliminates need for an external power

    supply. The programmer can also power the target board from a USB port with limited supply

    current of up to 100mA.

  • 8/17/2019 Pothole filler report

    43/77

  • 8/17/2019 Pothole filler report

    44/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 44

    3.5.3 STK500v2 GUI

    STK500V2 is a high speed USB powered STK500V2 compatible In-System USB

     programmer for AVR family of microcontrollers.STK500v2 has to be configured in HID mode

    to work with STK500v2 GUI.

    The below figure shows the STK500v2 GUI.

    Figure 3.19 ISP USB Programmer’s GUI 

  • 8/17/2019 Pothole filler report

    45/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 45

    Figure 3.20 Details of GUI

    Microcontroller: - Select micro controller from the list of microcontrollers present in the

    GUI to write file on them.

    Exit: - Exit STK500v2 GUI.

    Browse: - Browse the path of the file that you want to write on the microcontroller.

    Program: - Program/Write selected file on microcontroller.

    Erase: - Erase the file that is currently written on the microcontroller.

    Verify: - Verify the currently loaded file on the microcontroller.

    Clear: - Clear STK500v2 GUI window.

    E Fuse: - Input proper extended fuse value from Table 2 or Table 3 to write the

    microcontrollers fuse setting.

    H Fuse: - Input proper High fuse value from Table 2 or Table 3 to write the

    microcontrollers fuse setting.

    L Fuse: - Input proper Low fuse value from Table 2 or Table 3 to write the

    microcontrollers fuse setting.

    Read: - Read the microcontrollers current fuse setting.

    Write: - Write microcontrollers fuse setting.

  • 8/17/2019 Pothole filler report

    46/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 46

    3.5.4 Programming using the GUI

    To program the Target board’s Microcontroller with the GUI we need to do the following

    actions,

      Select the Proper Microcontroller

      Select the file for the burning(.hex file)

      Click on Program

    Figure 3.21 Programming using GUI

  • 8/17/2019 Pothole filler report

    47/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 47

    CHAPTER 4

    CONCLUSION AND FUTURE SCOPE

    4.1 Conclusion

    After successfully testing all different codes, the final outcome of this project is that it can be

    successfully implemented on detecting and filling pothole autonomously. The outcome of the

     project is discussed in terms of advantages and limitations in the following sections.

    4.2 Advantages

      Automatically detect and fill the potholes.

      Eliminates manual filling of potholes.

      Saves lot of time.

      Saves the funds which are to be invested on the laborers.

      Robot is highly reliable.

      Since it is completely autonomous, no human intervention is needed.

      Economical way of implementing automation in fixing a pothole.

    4.3 Limitations

      During design phase some parameters were limited to only prototype model, real life

    model is still needed to designed and fabricated.

      Line Sensors may be affected by the ambient light. Real life model should overcome this

    4.4 Future Scope

    The future scope of this project is development of a real life model which will working on fixing

    the potholes. The prototype can be modified and fabricated according to the needs.

  • 8/17/2019 Pothole filler report

    48/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 48

    REFERENCES

    [1] ACE in the Hole: Adaptive Contour Estimation Using Collaborating Mobile SensorsSumana Srinivasan, Krithi Ramamritham and Purushottam Kulkarni Department of Computer

    Science and Engineering,Indian Institute of Technology Bombay, Mumbai - 400076, INDIA.

    [2] Resource management for real-time tasks in mobile robotics Huan Li , Krithi RamamrithamPrashant Shenoy , Roderic A. Grupen ,John D. Sweeney

    [3] Fire Bird V ATMEGA2560 Hardware Manual

    [4] Fire Bird V ATMEGA2560 Software Manual

    [5] AVR Studio 4 Tutorail

    [6] USB ISP Programmer Manual

    [7] www.stepperworld.com/Tutorials/pgBipolarTutorial.htm

    [8] www.edaboard.com

  • 8/17/2019 Pothole filler report

    49/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 49

    APPENDIX A

    Source Code

    #include

    #include

    #include

    #include

    #include "lcd.c"

    voidport_init();

    void timer5_init();

    void velocity(unsigned char, unsigned char);

    unsigned char ADC_Conversion(unsigned char);

    unsigned char ADC_Value;

    unsigned char sharp_center;unsigned char sharp_left;

    unsigned char sharp_right;

    unsigned char sharp_aux_left;

    unsigned char sharp_aux_right;

    unsigned char flag1 = 0;

    unsigned char flag2 = 0;

    unsigned char flag3 = 0;

    unsigned char flag4 = 0;

    unsigned char flag5 = 0;

    unsigned char Left_white_line = 0;unsigned char Center_white_line = 0;

    unsigned char Right_white_line = 0;

    unsigned int value_center,value_left,value_right,value_aux_left,value_aux_right;

    unsigned long intShaftCountLeft = 0; //to keep track of left position encoder

    unsigned long intShaftCountRight = 0; //to keep track of right position encoder

    unsigned long int ShaftCountLeft1 = 0; //to keep track of left position encoder

    unsigned long int ShaftCountRight1 = 0; //to keep track of right position encoder

    unsigned int Degrees,degrees1; //to accept angle in degrees for turning

    unsigned int count=0;

    int motor_pattern[4]= {0x10,0x80,0x20,0x40};

    int servo_pattern[6]={15,20,25,30,25,20};

    int steps,l=0;

    int v=0,p=0,k=0,z=0,x=0,u=0,w=0;

    unsigned int index1=0,index2=0,y=0;

  • 8/17/2019 Pothole filler report

    50/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 50

    //Configure PORTB 5 pin for servo motor 1 operation

    void servo1_pin_config (void)

    {

    DDRB = DDRB | 0x20; //making PORTB 5 pin output

    PORTB = PORTB | 0x20; //setting PORTB 5 pin to logic 1

    }

    //TIMER1 initialization in 10 bit fast PWM mode

    //prescale:256

    // WGM: 7) PWM 10bit fast, TOP=0x03FF

    // actual value: 52.25Hz.

    void timer1_init(void)

    {TCCR1B = 0x00; //stop

    TCNT1H = 0xFC; //Counter high value to which OCR1xH value is to be compared with

    TCNT1L = 0x01; //Counter low value to which OCR1xH value is to be compared with

    OCR1AH = 0x03; //Output compare Register high value for servo 1

    OCR1AL = 0xFF; //Output Compare Register low Value For servo 1

    ICR1H = 0x03;

    ICR1L = 0xFF;

    TCCR1A = 0xAB; /*{COM1A1=1, COM1A0=0; COM1B1=1, COM1B0=0;

    COM1C1=1 COM1C0=0}

    For Overriding normal port functionality to OCRnA outputs.{WGM11=1, WGM10=1} Along With WGM12 in TCCR1B for

    Selecting FAST PWM Mode*/

    TCCR1C = 0x00;

    TCCR1B = 0x0C; //WGM12=1; CS12=1, CS11=0, CS10=0 (Prescaler=256)

    }

    //Function to rotate Servo 1 by a specified angle in the multiples of 1.86 degrees

    void servo_1(unsigned char degrees)

    {

    floatPositionPanServo = 0;

    PositionPanServo = ((float)degrees / 1.86) + 35.0;

    OCR1AH = 0x00;

    OCR1AL = (unsigned char) PositionPanServo;

    }

  • 8/17/2019 Pothole filler report

    51/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 51

    //servo_free functions unlocks the servo motors from the any angle

    //and make them free by giving 100% duty cycle at the PWM. This function can be used to

    //reduce the power consumption of the motor if it is holding load against the gravity.

    void servo_1_free (void) //makes servo 1 free rotating

    {

    OCR1AH = 0x03;

    OCR1AL = 0xFF; //Servo 1 off

    }

    //Function to configure ports to enable robot's motion

    void motion_pin_config (void)

    {

    DDRA = DDRA | 0x0F;

    PORTA = PORTA & 0xF0;DDRL = DDRL | 0x18; //Setting PL3 and PL4 pins as output for PWM generation

    PORTL = PORTL | 0x18; //PL3 and PL4 pins are for velocity control using PWM.

    }

    //Function to configure INT4 (PORTE 4) pin as input for the left position encoder

    void left_encoder_pin_config (void)

    {

    DDRE = DDRE & 0xEF; //Set the direction of the PORTE 4 pin as input

    PORTE = PORTE | 0x10; //Enable internal pull-up for PORTE 4 pin

    }

    //Function to configure INT5 (PORTE 5) pin as input for the right position encoder

    void right_encoder_pin_config (void)

    {

    DDRE = DDRE & 0xDF; //Set the direction of the PORTE 4 pin as input

    PORTE = PORTE | 0x20; //Enable internal pull-up for PORTE 4 pin

    }

    void left_position_encoder_interrupt_init (void) //Interrupt 4 enable

    {

    cli(); //Clears the global interrupt

    EICRB = EICRB | 0x02; // INT4 is set to trigger with falling edge

    EIMSK = EIMSK | 0x10; // Enable Interrupt INT4 for left position encoder

    sei(); // Enables the global interrupt

    }

  • 8/17/2019 Pothole filler report

    52/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 52

    void right_position_encoder_interrupt_init (void) //Interrupt 5 enable

    {

    cli(); //Clears the global interrupt

    EICRB = EICRB | 0x08; // INT5 is set to trigger with falling edge

    EIMSK = EIMSK | 0x20; // Enable Interrupt INT5 for right position encoder

    sei(); // Enables the global interrupt

    }

    //ISR for right position encoder

    ISR(INT5_vect)

    {

    ShaftCountRight++; //increment right shaft position count

    ShaftCountRight1++;

    }

    //ISR for left position encoder

    ISR (INT4_vect)

    {

    ShaftCountLeft++; //increment left shaft position count

    ShaftCountLeft1++;

    }

    //Function used for setting motor's directionvoid motion_set (unsigned char Direction)

    {

    unsigned char PortARestore = 0;

    Direction &= 0x0F; // removing upper nibbel for the protection

    PortARestore = PORTA; // reading the PORTA original status

    PortARestore&= 0xF0; // making lower direction nibbel to 0

    PortARestore |= Direction; // adding lower nibbel for forward command and restoring the

    PORTA status

    PORTA = PortARestore; // executing the command

    }

    void forward (void) //both wheels forward

    {

    motion_set(0x06);

    }

  • 8/17/2019 Pothole filler report

    53/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 53

    void back (void) //both wheels backward

    {

    motion_set(0x09);

    }

    void left (void) //Left wheel backward, Right wheel forward

    {

    motion_set(0x05);

    }

    void right (void) //Left wheel forward, Right wheel backward

    {

    motion_set(0x0A);

    }

    void stop (void)

    {

    motion_set(0x00);

    }

    //Function used for turning robot by specified degrees

    void angle_rotate(unsigned int Degrees)

    {

    floatReqdShaftCount = 0;unsigned long intReqdShaftCountInt = 0;

    ReqdShaftCount = (float) Degrees/ 4.090; // division by resolution to get shaft count

    ReqdShaftCountInt = (unsigned int) ReqdShaftCount;

    ShaftCountRight = 0;

    ShaftCountLeft = 0;

    while (1)

    {

    if((ShaftCountRight>= ReqdShaftCountInt) | (ShaftCountLeft>=

    ReqdShaftCountInt))

     break;

    }

    stop(); //Stop robot

    }

  • 8/17/2019 Pothole filler report

    54/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 54

    //Function used for moving robot forward by specified distance

    void linear_distance_mm(unsigned intDistanceInMM)

    {

    floatReqdShaftCount = 0;

    unsigned long intReqdShaftCountInt = 0;

    ReqdShaftCount = DistanceInMM / 5.338; // division by resolution to get shaft count

    ReqdShaftCountInt = (unsigned long int) ReqdShaftCount;

    ShaftCountRight = 0;

    ShaftCountLeft =0;

    while(1)

    {

    if((ShaftCountRight>ReqdShaftCountInt ) &&

    (ShaftCountLeft>ReqdShaftCountInt ))

    { break;

    }

    }

    stop(); //Stop robot

    }

    void left_degrees(unsigned int Degrees)

    {// 88 pulses for 360 degrees rotation 4.090 degrees per count

    left(); //Turn left

    angle_rotate(Degrees);

    }

    voidright_degrees(unsigned int Degrees)

    {

    // 88 pulses for 360 degrees rotation 4.090 degrees per count

    right(); //Turn right

    angle_rotate(Degrees);

    }

  • 8/17/2019 Pothole filler report

    55/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 55

    //Function to configure LCD port

    void lcd_port_config (void)

    {

    DDRC = DDRC | 0xF7; //all the LCD pin's direction set as output

    PORTC = PORTC & 0x80; // all the LCD pins are set to logic 0 except PORTC 7

    }

    //ADC pin configuration

    void adc_pin_config (void)

    {

    DDRF = 0x00;

    PORTF = 0x00;

    DDRK = 0x00;

    PORTK = 0x00;

    }

    //Function to initialize Buzzer

    void buzzer_pin_config (void)

    {

    DDRC = DDRC | 0x08; //Setting PORTC 3 as outpt

    PORTC = PORTC & 0xF7; //Setting PORTC 3 logic low to turnoff buzzer

    }

    void MOSFET_switch_config (void)

    {DDRH = DDRH | 0x0C; //make PORTH 3 and PORTH 1 pins as output

    PORTH = PORTH & 0xF3; //set PORTH 3 and PORTH 1 pins to 0

    DDRG = DDRG | 0x04; //make PORTG 2 pin as output

    PORTG = PORTG & 0xFB; //set PORTG 2 pin to 0

    }

    void turn_off_ir_proxi_sensors (void) //turn off IR Proximity sensors

    {

    PORTH = PORTH | 0x08;

    }

    void turn_on_sharp15 (void) //turn on Sharp IR range sensors 1,5

    {

    PORTH = PORTH & 0xFB;

    }

  • 8/17/2019 Pothole filler report

    56/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 56

    //Function to Initialize PORTS

    void port_init()

    {

    lcd_port_config();

    adc_pin_config();

    motion_pin_config();

     buzzer_pin_config();

    motion_pin_config(); //robot motion pins config

    left_encoder_pin_config(); //left encoder pin config

    right_encoder_pin_config(); //right encoder pin config

    servo1_pin_config(); //Configure PORTB 5 pin for servo motor 1 operation

    MOSFET_switch_config();

    }

    // Timer 5 initialized in PWM mode for velocity control

    // Prescale:256

    // PWM 8bit fast, TOP=0x00FF

    // Timer Frequency:225.000Hz

    void timer5_init()

    {

    TCCR5B = 0x00; //Stop

    TCNT5H = 0xFF; //Counter higher 8-bit value to which OCR5xH value is comparedwith

    TCNT5L = 0x01; //Counter lower 8-bit value to which OCR5xH value is compared

    with

    OCR5AH = 0x00; //Output compare register high value for Left Motor

    OCR5AL = 0xFF; //Output compare register low value for Left Motor

    OCR5BH = 0x00; //Output compare register high value for Right Motor

    OCR5BL = 0xFF; //Output compare register low value for Right Motor

    OCR5CH = 0x00; //Output compare register high value for Motor C1

    OCR5CL = 0xFF; //Output compare register low value for Motor C1

    TCCR5A = 0xA9; /*{COM5A1=1, COM5A0=0; COM5B1=1, COM5B0=0;

    COM5C1=1 COM5C0=0}

    For Overriding normal port functionality to OCRnA

    outputs.

    {WGM51=0, WGM50=1} Along With WGM52 in

    TCCR5B for Selecting FAST PWM 8-bit Mode*/

  • 8/17/2019 Pothole filler report

    57/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 57

    TCCR5B = 0x0B; //WGM12=1; CS12=0, CS11=1, CS10=1 (Prescaler=64)

    }

    void buzzer_on (void)

    {

    unsigned char port_restore = 0;

     port_restore = PINC;

     port_restore = port_restore | 0x08;

    PORTC = port_restore;

    }

    void buzzer_off (void)

    {

    unsigned char port_restore = 0; port_restore = PINC;

     port_restore = port_restore& 0xF7;

    PORTC = port_restore;

    }

    void adc_init()

    {

    ADCSRA = 0x00;

    ADCSRB = 0x00; //MUX5 = 0

    ADMUX = 0x20; //Vref=5V external --- ADLAR=1 --- MUX4:0 = 0000ACSR = 0x80;

    ADCSRA = 0x86; //ADEN=1 --- ADIE=1 --- ADPS2:0 = 1 1 0

    }

    //Function For ADC Conversion

    unsigned char ADC_Conversion(unsigned char Ch)

    {

    unsigned char a;

    if(Ch>7)

    {

    ADCSRB = 0x08;

    }

    Ch = Ch& 0x07;

    ADMUX= 0x20| Ch;

    ADCSRA = ADCSRA | 0x40; //Set start conversion bit

  • 8/17/2019 Pothole filler report

    58/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 58

    while((ADCSRA&0x10)==0); //Wait for conversion to complete

    a=ADCH;

    ADCSRA = ADCSRA|0x10; //clear ADIF (ADC Interrupt Flag) by writing 1 to it

    ADCSRB = 0x00;

    return a;

    }

    // This Function calculates the actual distance in millimeters(mm) from the input

    // analog value of Sharp Sensor.

    unsigned int Sharp_GP2D12_estimation(unsigned char adc_reading)

    {

    float distance;

    unsigned int distanceInt;

    distance = (int)(10.00*(2799.6*(1.00/(pow(adc_reading,1.1546)))));

    distance Int = (int)distance;if(distance Int>800)

    {

    distance Int=800;

    }

    return distance Int;

    }

    //Function for velocity control

    void velocity (unsigned char left_motor, unsigned char right_motor)

    {OCR5AL = (unsigned char)left_motor;

    OCR5BL = (unsigned char)right_motor;

    }

    void init_devices (void)

    {

    cli(); //Clears the global interrupts

     port_init();

    adc_init();

    timer5_init();

    left_position_encoder_interrupt_init();

    right_position_encoder_interrupt_init();

    timer1_init();

    sei(); //Enables the global interrupts

    }

  • 8/17/2019 Pothole filler report

    59/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 59

    void print_sensor(char row, char coloumn,unsigned char channel)

    {

    ADC_Value = ADC_Conversion(channel);

    lcd_print(row, coloumn, ADC_Value, 3);

    }

    void arm_update(void)

    {

    sharp_left = ADC_Conversion(10);

    sharp_right = ADC_Conversion(12);

    value_left=Sharp_GP2D12_estimation(sharp_left);

    value_right=Sharp_GP2D12_estimation(sharp_right);

    sharp_aux_left = ADC_Conversion (9);

    value_aux_left=Sharp_GP2D12_estimation(sharp_aux_left);sharp_aux_right = ADC_Conversion (11);

    value_aux_right=Sharp_GP2D12_estimation(sharp_aux_right);

    }

    void white_update(void)

    {

    Left_white_line = ADC_Conversion(3); //Getting data of Left WL Sensor

    Center_white_line = ADC_Conversion(2); //Getting data of Center WL Sensor

    Right_white_line = ADC_Conversion(1); //Getting data of Right WL Sensor

    }

    void center_update(void)

    {

    sharp_center = ADC_Conversion(13); //Stores the Analog value of front sharp

    connected to ADC channel 13 into variable "sharp"

    value_center = Sharp_GP2D12_estimation(sharp_center);

    }

  • 8/17/2019 Pothole filler report

    60/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 60

    void stepper_cw(unsigned int degrees1)

    {

    unsignedint index=0;

    DDRA= 0xFF;

    steps=(int)degrees1/1.8;

    for(l=0;l

  • 8/17/2019 Pothole filler report

    61/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 61

    }

    if((Left_white_line>0x28) && (flag1==0))

    {

    flag1=1;

    forward();

    velocity(225,137);

    }

    }

    void whiteline_backward(void)

    {

    int flag1=0;

    white_update();_delay_ms(10);

    if(Center_white_line0x28) && (flag1==0))

    {

    flag1=1;

     back();

    velocity(137,225);

    }if((Right_white_line>0x28) && (flag1==0))

    {

    flag1=1;

     back();

    velocity(225,137);

    }

    }

    void servo_rotate1(void)

    {

    whiteline_forward();

    white_update();

    if((Center_white_line

  • 8/17/2019 Pothole filler report

    62/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 62

    servo_1(i);_delay_ms(10);

    index1=index1%6;

    }

    }

    void servo_rotate(void)

    {

    whiteline_forward();

    i=servo_pattern[index1++];

    servo_1(i);_delay_ms(10);

    index1=index1%6;

    }

    void forward_mm(unsigned intDistanceInMM){

    velocity(255,255);

    forward();

    linear_distance_mm(DistanceInMM);

    }

    void back_mm(unsigned intDistanceInMM)

    {

    velocity(255,255);

     back();linear_distance_mm(DistanceInMM);

    }

    void u_turn(void)

    {

    velocity(255,255);

    forward_mm(220); //Moves robot forward 100mm

    stop();

     _delay_ms(500);

    right_degrees(90); //Rotate robot right by 90 degrees

    stop();

     _delay_ms(500);

    forward_mm(490); //Moves robot forward 100mm

    stop();

     _delay_ms(500);

  • 8/17/2019 Pothole filler report

    63/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 63

    right_degrees(90); //Rotate robot right by 90 degrees

    stop();

     _delay_ms(500);

    }

    void left_open(void)

    {

    stop();stepper_cw(65);

    while(1)

    {arm_update();_delay_ms(5);

    if(value_left

  • 8/17/2019 Pothole filler report

    64/77

  • 8/17/2019 Pothole filler report

    65/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 65

    }

    y=k-p;

    if(y

  • 8/17/2019 Pothole filler report

    66/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 66

    stop();_delay_ms(50);forward_mm(65);break;

    }

    }

    arm_update();_delay_ms(10);

    if(value_left>180)

    {

    left_open();

     back_mm(40);stop();_delay_ms(50);

    }

    else

    {

     back_mm(50);_delay_ms(50);arm_update();_delay_ms(10);

    if(value_left>180)

    {

    left_open();}

    else

    {

     back_mm(35);_delay_ms(50);

    left_open();

    }

    }

    }

    if(p

  • 8/17/2019 Pothole filler report

    67/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 67

    servo_1(i);_delay_ms(100);

    i++;arm_update();_delay_ms(10);

    if (value_right=35){k=i; break;} // K is higher ,so k-p

    }

    i=x;

    y=k-p;

    if(y5 && k180)

    {for(v=0;v

  • 8/17/2019 Pothole filler report

    68/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 68

    right_open();

    }

    }

    if(p

  • 8/17/2019 Pothole filler report

    69/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 69

    right_open();back_mm(40);stop();_delay_ms(50);

    }

    else

    {

     back_mm(50);_delay_ms(50);arm_update();_delay_ms(10);

    if(value_right>180)

    {

    right_open();back_mm(40);stop();_delay_ms(50);

    }

    else

    {

     back_mm(35);_delay_ms(50);

    right_open();back_mm(40);stop();_delay_ms(50)

    }

    }if(p

  • 8/17/2019 Pothole filler report

    70/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 70

    }

    }

    //Main Function

    int main()

    {

    init_devices();// initializing ports

    lcd_set_4bit();

    lcd_init();// initialisinglcd.

    turn_off_ir_proxi_sensors();

    turn_on_sharp15 ();

    while(1)

    {

    flag1=0;arm_update();

    center_update();

    white_update();

    if((Center_white_line

  • 8/17/2019 Pothole filler report

    71/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 71

    if((Center_white_line>0x28) && (Left_white_line>0x28) &&

    (Right_white_line>0x28)&& flag2==1 )

    {

    while(1)

    {

    forward();

    velocity(225,50);

    white_update();_delay_ms(20);

    if(Center_white_line=180 || value_right>=180 || value_aux_left>=180 ||

    value_aux_right>=180))

    {

    while(1)

    {

    servo_1(i);_delay_ms(100);

    stop();

    if(value_left>=180)

    {

    left_fill(); break;}

    if(value_right>=180)

    {

    right_fill(); break;

    }

    if(value_aux_left>=180)

    {

    fill_aux_left();break;

    }

    if(value_aux_right>=180)

    {

    fill_aux_right();break;

    }

    else{break;}

    }

  • 8/17/2019 Pothole filler report

    72/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 72

    }

    if(value_center>=650 && flag2==0 && ShaftCountRight1>28 &&

    ShaftCountLeft1>28)

    {

    u_turn();flag2=1;flag3=1;

    }

    }

    }

  • 8/17/2019 Pothole filler report

    73/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 73

    APPENDIX- B

     

  • 8/17/2019 Pothole filler report

    74/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 74

  • 8/17/2019 Pothole filler report

    75/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 75

  • 8/17/2019 Pothole filler report

    76/77

    Autonomous Pothole filler Robot

    Dept. of TCE, JNNCE, Shimoga Page 76

  • 8/17/2019 Pothole filler report

    77/77

    Autonomous Pothole filler Robot