car automation system (adaptive lighting system)

Embed Size (px)

Citation preview

  • 7/30/2019 car automation system (adaptive lighting system)

    1/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 1

    CHAPTER 1

    INTRODUCTION

    The basic idea behind this work is to perform a cheap and efficient adaptive

    lighting system for cars. For this to exist in physical form we are using ATMEL

    ATmeg8 Microcontroller and the AVR Studio 4.18.As we use a LDR as the

    indicator whose resistance decreases with increasing incident light intensity the

    headlights of the car automatically reduce their intensity with the help of

    ATmega8.The ATmega8 controller is programmed such that the headlights show

    adaptivity when any vehicle is approached towards the car. The commands are

    dumped into the microcontroller with the help of AVR Studio 4.18

    1.1 OVERVIEW OF THE PROJECT:

    Adaptive Lighting System for Automobiles needs no manual operation for

    switching ON and OFF headlight/downlight when there is vehicle coming from front

    at night. It detects itself whether there is light from front coming vehicle or not. When

    there is light from front coming vehicle it automatically switches to the down light

    and when the vehicle passes it automatically switch back to head light. The

    sensitiveness of the Adaptive Lighting System for Automobiles can be adjusted. Inour project we have used four L.E.D for indication of headlight/downlight but for

    high power lamp switching one can connect Relay (electromagnetic switch) at the

    output of pin 1 of ATMEGA 8 then it will be possible to turn ON/OFF high power

    headlight/downlight of the vehicle.

    1.1.1 Existing System:

    The sensors in an adaptive headlights system prevent the lights from turning

    when they don't need to. If the car isn't moving or is moving in reverse, the adaptive

    headlights won't activate. This helps keep the lights from inadvertently blinding other

    drivers.

    1.1.2 Limitation of the System:

    Standard headlights shine straight ahead, no matter what direction the car is

    moving. When going around curves, they illuminate the side of the road more than the

    road itself.

    http://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Electrical_resistance
  • 7/30/2019 car automation system (adaptive lighting system)

    2/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 2

    1.1.3 Improvement:

    Adaptive headlights react to the steering, speed and elevation of the car and

    automatically adjust to illuminate the road ahead. When the car turns right, the

    headlights angle to the right. Turn the car left, the headlights angle to the left. This is

    important not only for the driver of the car with adaptive headlights, but for other

    drivers on the road as well. The glare of oncoming headlights can cause serious

    visibility problems. Since adaptive headlights are directed at the road, the incidence of

    glare is reduced.1.2 PROJECT REPORT ORGANISATION:

    This chapter presents brief overview of title CAR AUTOMATION SYSTEM using

    microcontroller ATmega8.

    Chapter 2 Provides the concepts of block diagram of the work and its functioning.

    Chapter 3 Provides the hardware details and brief description of each and every

    component.

    Chapter 4 Provides the software implementation in AVR Studio 4.18.

    Chapter 5 Provides the application of the work, result and future scope.

    Appendix A provides the program of the microcontroller code.

    Appendix B provides the specifications of the diode and transistor used

    References provide the data from where the work is coagulated.

  • 7/30/2019 car automation system (adaptive lighting system)

    3/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 3

    CHAPTER 2

    CIRCUIT DESCRPITION

    2.1 BLOCK DIAGRAM:

    The following figure shows the block diagram using the Microcontroller

    2.1.1 Block diagram Explanation:

    From the block diagram the Microcontroller is the main block. This block

    diagram includes the basic block of the crystal oscillator (XTAL). This block

    provides the clock to the Microcontroller. When the Microcontroller gives dc voltage

    to this block, it will have a crystal that gives the clock to the Microcontroller. The

    next block is reset logic. This block produces high signal for two machines for

    protection of the internal program to the Microcontroller from power spikes. Relays

    are used to control the AC signal with 9V DC adaptor. Power supply block is used to

    convert the AC voltage coming from the line in to 9V DC and 5V DC for the power

    supply requirement to the electronic components.

    The power supply block contains the DC adaptor for conversion of AC to DC voltage.

    It provides 9V DC and is passed over the LM7805 regulator for the sake of 5V

    supply.

  • 7/30/2019 car automation system (adaptive lighting system)

    4/41

  • 7/30/2019 car automation system (adaptive lighting system)

    5/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 5

    XTAL1 and XTAL2 are the input and output pins, respectively. Either a quartz

    crystal or ceramic resonator may be used. To drive the device from an external clock

    source, XTAL2 should be left unconnected while XTAL1 is driven. There are no

    requirements on the duty cycle of the external clock signal, since the input to the

    internal clocking circuitry is through a divide-by-two flip-flop, but minimum and

    maximum voltage high and low time specifications must be observed.

    The driver circuit is generally made by using one transistor and one relay. The

    driver circuit is mainly operated by the Microcontroller. The Microcontroller changes

    the state of the output pin from the low to high i.e., from 0 level to 1 level. By

    using the sequence we can control the base of the transistor. The transistor will act an

    ON/OFF switch corresponding to the input of the base. If the base current of the

    transistor is high the transistor is under ON condition else it is in the OFF state. These

    conditions will be used to control the relay.

    2.3 FUNCTIONING OF THE PROJECT:

    There is a need of an external AC Power supplies i.e. 230V, 50Hz signal. In order to reduce the received voltage supply to make it suitable for the

    Microcontroller operation, we use a DC adaptor which gives an output voltageof 9V.

    Here, in this project we require an input voltage 5V for the microcontrollerATmega8. The 12V produced by the DC Adaptor is related up to 5V with the

    help of Voltage Regulator 7805 up to 5V. The 5V signal thus produced serves

    as input for the microcontroller.

    The microcontroller ATmega8 is provided with an external frequency signalof 11.05MHz. This is produced by the Crystal Oscillator that is connected tothe XTAL1 and XTAL2 pins of the microcontroller.

    As the microcontroller is designed as per our requirement, the code is dumpedinto the microcontroller before hand, with the help of AVR Studio 4.18.

    Once the power supply of 5V is given to the circuit, the circuit starts working,when the LDR is transverse through the dark the headlights glow.

    In our circuit the headlights are indicated with the LED, once the lightingintensity of the outer environment increases, the intensity of the LEDs

    decrease. The LDR exhibits photo conductivity.

  • 7/30/2019 car automation system (adaptive lighting system)

    6/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 6

    The other set of LEDs indicate the position of the door. The LEDs glowautomatically if the door is open.

    This circuit is to be connected to the base of the windshield under the defoggergrill through relay driver circuits.

  • 7/30/2019 car automation system (adaptive lighting system)

    7/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 7

    CHAPTER 3

    HARDWARE EQUIPMENT

    The various Hardware equipments used in the project are:

    1. Microcontroller ATMEGA8L.2. Regulator LM7805.3. Relays.4. Transistors5. Diode IN4007.6. Variable resistor7. Switches.8. Light detecting resistor (LDR).9. Light emitting diode (LED

    3.1 MICROCONTROLLER ATMEGA8-L:

    Microcontroller is the basic and most important component in this project.

    The particular instruction will be given to the microcontroller which helps in

    performing the required task. So the microcontroller can be coined as the heart of this

    project.

    3.1.1 Introduction to Embedded Design:

    A microcontroller can be considered a self-contained system with a processor,

    memory and peripherals and can be used as an embedded system. The majority of

    microcontrollers in use today are embedded in other machinery, such as automobiles,

    telephones, appliances, and peripherals for computer systems. While some embeddedsystems are very sophisticated, many have minimal requirements for memory and

    program length, with no operating system, and low software complexity. Typical

    input and output devices include switches, relays, solenoids, LEDs, small or

    custom LCD displays, radio frequency devices, and sensors for data such as

    temperature, humidity, light level etc. Embedded systems usually have no keyboard,

    screen, disks, printers, or other recognizable I/O devices of a personal computer, and

    may lack human interaction devices of any kind.

    http://en.wikipedia.org/wiki/Relayhttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/LEDhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/LEDhttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Relay
  • 7/30/2019 car automation system (adaptive lighting system)

    8/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 8

    3.1.2 Interrupts:

    Microcontrollers must provide real time (predictable, though not necessarily

    fast) response to events in the embedded system they are controlling. When certain

    events occur, an interrupt system can signal the processor to suspend processing the

    current instruction sequence and to begin an interrupt service routine (ISR, or

    "interrupt handler"). The ISR will perform any processing required based on the

    source of the interrupt before returning to the original instruction sequence. Possible

    interrupt sources are device dependent, and often include events such as an internal

    timer overflow, completing an analog to digital conversion, a logic level change on an

    input such as from a button being pressed, and data received on a communication link.

    Where power consumption is important as in battery operated devices, interrupts mayalso wake a microcontroller from a low power sleep state where the processor is

    halted until required to do something by a peripheral event

    3.1.3 Programs:

    Typically microcontroller programs must fit in the available on-chip program

    memory, since it would be costly to provide a system with external, expandable,

    memory. Compilers and assemblers are used to convert high-level language andassembler language codes into a compact machine code for storage in the

    microcontroller's memory. Depending on the device, the program memory may be

    permanent, read-only memory that can only be programmed at the factory, or program

    memory may be field-alterable flash or erasable read-only memory.

    3.1.4 Other microcontroller features:

    Microcontrollers usually contain from several to dozens of general purpose

    input/output pins (GPIO). GPIO pins are software configurable to either an input or an

    output state. When GPIO pins are configured to an input state, they are often used to

    read sensors or external signals. Configured to the output state, GPIO pins can drive

    external devices such as LEDs or motors.

    http://en.wikipedia.org/wiki/Real-time_computinghttp://en.wikipedia.org/wiki/Interrupthttp://en.wikipedia.org/wiki/Interrupt_service_routinehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Machine_codehttp://en.wikipedia.org/wiki/Interrupt_service_routinehttp://en.wikipedia.org/wiki/Interrupthttp://en.wikipedia.org/wiki/Real-time_computing
  • 7/30/2019 car automation system (adaptive lighting system)

    9/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 9

    Many embedded systems need to read sensors that produce analog signals.

    This is the purpose of the analog-to-digital converter (ADC). Since processors are

    built to interpret and process digital data, i.e. 1s and 0s, they are not able to do

    anything with the analog signals that may be sent to it by a device. So the analog to

    digital converter is used to convert the incoming data into a form that the processor

    can recognize. A less common feature on some microcontrollers is a digital-to-analog

    converter (DAC) that allows the processor to output analog signals or voltage levels.

    In addition to the converters, many embedded microprocessors include a

    variety of timers as well. One of the most common types of timers is

    the Programmable Interval Timer (PIT). A PIT may either count down from some

    value to zero, or up to the capacity of the count register, overflowing to zero. Once it

    reaches zero, it sends an interrupt to the processor indicating that it has finished

    counting. This is useful for devices such as thermostats, which periodically test the

    temperature around them to see if they need to turn the air conditioner on, the heater

    on, etc.

    A dedicated Pulse Width Modulation (PWM) block makes it possible for the

    CPU to control power converters, resistive loads, motors, etc., without using lots of

    CPU resources in tight timer loops.

    Universal Asynchronous Receiver/Transmitter (UART) block makes it

    possible to receive and transmit data over a serial line with very little load on the

    CPU. Dedicated on-chip hardware also often includes capabilities to communicate

    with other devices (chips) in digital formats such as IC and Serial Peripheral

    Interface (SPI).

    Fig 3.1 ATMega8 microcontroller

    http://en.wikipedia.org/wiki/Analog-to-digital_converterhttp://en.wikipedia.org/wiki/Digital-to-analog_converterhttp://en.wikipedia.org/wiki/Digital-to-analog_converterhttp://en.wikipedia.org/wiki/Programmable_Interval_Timerhttp://en.wikipedia.org/wiki/Pulse-width_modulationhttp://en.wikipedia.org/wiki/Switched-mode_power_supplyhttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Control_flow#Loopshttp://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitterhttp://en.wikipedia.org/wiki/I%C2%B2Chttp://en.wikipedia.org/wiki/Serial_Peripheral_Interfacehttp://en.wikipedia.org/wiki/Serial_Peripheral_Interfacehttp://en.wikipedia.org/wiki/Serial_Peripheral_Interfacehttp://en.wikipedia.org/wiki/Serial_Peripheral_Interfacehttp://en.wikipedia.org/wiki/I%C2%B2Chttp://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitterhttp://en.wikipedia.org/wiki/Control_flow#Loopshttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Switched-mode_power_supplyhttp://en.wikipedia.org/wiki/Pulse-width_modulationhttp://en.wikipedia.org/wiki/Programmable_Interval_Timerhttp://en.wikipedia.org/wiki/Digital-to-analog_converterhttp://en.wikipedia.org/wiki/Digital-to-analog_converterhttp://en.wikipedia.org/wiki/Analog-to-digital_converter
  • 7/30/2019 car automation system (adaptive lighting system)

    10/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 10

    3.1.5 Higher Integration:

    In contrast to general-purpose CPUs, micro-controllers may not implement an

    external address or data bus as they integrate RAM and non-volatile memory on the

    same chip as the CPU. Using fewer pins, the chip can be placed in a much smaller,

    cheaper package.

    Integrating the memory and other peripherals on a single chip and testing

    them as a unit increases the cost of that chip, but often results in decreased net cost of

    the embedded system as a whole. Even if the cost of a CPU that has integrated

    peripherals is slightly more than the cost of a CPU and external peripherals, having

    fewer chips typically allows a smaller and cheaper circuit board, and reduces the

    labour required to assemble and test the circuit board.A micro-controller is a single integrated circuit, commonly with the following

    features:

    central processing unit - ranging from small and simple 4-bit processors tocomplex 32- or 64-bit processors

    volatile memory (RAM) for data storage ROM, EPROM, EEPROM or Flash memory for program and operating

    parameter storage

    discrete input and output bits, allowing control or detection of the logic stateof an individual package pin

    serial input/output such as serial ports (UARTs) other serial communications interfaces like IC, Serial eripheral and Controller

    Area Networkfor system interconnect

    peripherals such as timers, event counters, PWM generators, and watchdog clock generator - often an oscillator for a quartz timing crystal, resonator

    or RC circuit

    many include analog-to-digital converters, some include digital-to-analogconverters

    Some microcontrollers use Harvard architecture: separate memory buses for

    instructions and data, allowing accesses to take place concurrently. Where Harvard

    architecture is used, instruction words for the processor may be a different bit size

    http://en.wikipedia.org/wiki/Integrated_circuithttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/Bithttp://en.wikipedia.org/wiki/RAMhttp://en.wikipedia.org/wiki/Read-only_memoryhttp://en.wikipedia.org/wiki/EPROMhttp://en.wikipedia.org/wiki/EEPROMhttp://en.wikipedia.org/wiki/Flash_memoryhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Serial_porthttp://en.wikipedia.org/wiki/UARThttp://en.wikipedia.org/wiki/Serial_communicationshttp://en.wikipedia.org/wiki/Network_interfacehttp://en.wikipedia.org/wiki/I%C2%B2Chttp://en.wikipedia.org/wiki/Controller_Area_Networkhttp://en.wikipedia.org/wiki/Controller_Area_Networkhttp://en.wikipedia.org/wiki/Peripheralhttp://en.wikipedia.org/wiki/Timerhttp://en.wikipedia.org/wiki/Pulse-width_modulationhttp://en.wikipedia.org/wiki/Watchdog_timerhttp://en.wikipedia.org/wiki/Clock_generatorhttp://en.wikipedia.org/wiki/RC_circuithttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/RC_circuithttp://en.wikipedia.org/wiki/Clock_generatorhttp://en.wikipedia.org/wiki/Watchdog_timerhttp://en.wikipedia.org/wiki/Pulse-width_modulationhttp://en.wikipedia.org/wiki/Timerhttp://en.wikipedia.org/wiki/Peripheralhttp://en.wikipedia.org/wiki/Controller_Area_Networkhttp://en.wikipedia.org/wiki/Controller_Area_Networkhttp://en.wikipedia.org/wiki/I%C2%B2Chttp://en.wikipedia.org/wiki/Network_interfacehttp://en.wikipedia.org/wiki/Serial_communicationshttp://en.wikipedia.org/wiki/UARThttp://en.wikipedia.org/wiki/Serial_porthttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Flash_memoryhttp://en.wikipedia.org/wiki/EEPROMhttp://en.wikipedia.org/wiki/EPROMhttp://en.wikipedia.org/wiki/Read-only_memoryhttp://en.wikipedia.org/wiki/RAMhttp://en.wikipedia.org/wiki/Bithttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/Integrated_circuit
  • 7/30/2019 car automation system (adaptive lighting system)

    11/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 11

    than the length of internal memory and registers; for example: 12-bit instructions used

    with 8-bit data registers.

    The decision of which peripheral to integrate is often difficult. The

    microcontroller vendors often trade operating frequencies and system design

    flexibility against time-to-market requirements from their customers and overall lower

    system cost. Manufacturers have to balance the need to minimize the chip size against

    additional functionality.

    Microcontroller architectures vary widely. Some designs include general-

    purpose microprocessor cores, with one or more ROM, RAM, or I/O functions

    integrated onto the package. Other designs are purpose built for control applications.

    A micro-controller instruction set usually has many instructions intended for bit-wise

    operations to make control programs more compact. For example, a general purpose

    processor might require several instructions to test a bit in a register and branch if the

    bit is set, where a micro-controller could have a single instruction to provide that

    commonly required function. Microcontrollers typically do not have a math

    coprocessor, so floating point arithmetic is performed by software.

    3.2 CHARACTERISTICS OF MICROCONTROLLER:

    1. Cost: microcontrollers are usually very cheap2. Speed:The frequency of the system clock stated in megahertz (MHz) or gigahertz

    (GHz). Microcontrollers are typically slow, less than 200MHz.

    3. Power: The power dissipation of a system, measured in Watts. Microcontrollersare almost always low power.

    4. Bits: This is usually means the number of bits that can be processed at one timeby each instruction. Microcontrollers almost always are 8-bit or maybe 16-bit

    devices

    5. Memory: Most processors have some amount of storage on the device for dataand program instructions. In computing systems, memory is often hierarchical, so

    on chip memory can serve different purposes. Microcontrollers typically have a

    limited amount of memory, less than 1MByte total.

    6. Input/output (I/O): All processors have some means of getting data in and outof the chip which are used to connect to other circuitry in the system.

    http://en.wikipedia.org/wiki/Math_coprocessorhttp://en.wikipedia.org/wiki/Math_coprocessorhttp://en.wikipedia.org/wiki/Floating_pointhttp://en.wikipedia.org/wiki/Floating_pointhttp://en.wikipedia.org/wiki/Math_coprocessorhttp://en.wikipedia.org/wiki/Math_coprocessor
  • 7/30/2019 car automation system (adaptive lighting system)

    12/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 12

    Microcontroller usually have just a few I/O pins, as few as 8 or as many as 100.

    Larger processors such as the ones found in a typical PC, will typically have 100s

    of pins.

    3.3 DESCRIPTION OF ATMEGA8-L:

    The ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR

    RISC architecture. By executing powerful instructions in a single clock cycle, the

    ATmega8 achieves throughputs approaching 1 MIPS per MHz, allowing the system

    designer to optimize power consumption versus processing speed. The AVR core

    combines a rich instruction set with 32 general purpose working registers. All the 32

    registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two

    independent registers to be accessed in one single instruction executed in one clock

    cycle. The resulting architecture is more code efficient while achieving throughputs

    up to ten times faster than conventional CISC microcontrollers. The ATmega8

    provides the following features: 8 Kbytes of In-System Programmable Flash with

    Read-While-Write capabilities, 512 bytes of EEPROM, 1 Kbyte of SRAM, 23 general

    purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters

    with compare modes, internal and external interrupts, a serial programmable USART,

    a byte oriented Two wire Serial Interface, a 6-channel ADC (eight channels in TQFP

    and QFN/MLF packages) with 10-bit accuracy, a programmable Watchdog Timer

    with Internal Oscillator, an SPI serial port, and five software selectable power saving

    modes. The Idle mode stops the CPU while allowing the SRAM; Timer/Counters, SPI

    port, and interrupt system to continue functioning.

    The Power down mode saves the register contents but freezes the Oscillator,

    disabling all other chip functions until the next Interrupt or Hardware Reset. In

    Power-save mode, the asynchronous timer continues to run, allowing the user to

    maintain a timer base while the rest of the device is sleeping.

    The ADC Noise Reduction mode stops the CPU and all I/O modules except

    asynchronous timer and ADC, to minimize switching noise during ADC conversions.

    In Standby mode, the crystal/resonator Oscillator is running while the rest of the

    device is sleeping. This allows very fast start-up combined with low-power

    consumption. The device is manufactured using Atmels high density non-volatilememory technology. The Flash Program memory can be reprogrammed In-System

  • 7/30/2019 car automation system (adaptive lighting system)

    13/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 13

    through an SPI serial interface, by a conventional non-volatile memory programmer,

    or by an On-chip boot program running on the AVR core.

    3.4 Features:

    High-performance, Low-power Atmel AVR 8-bit Microcontroller Advanced RISC Architecture

    130 Powerful InstructionsMost Single-clock Cycle Execution 32 8 General Purpose Working Registers

    Fully Static Operation High Endurance Non-volatile Memory segments

    8Kbytes of In-System Self-programmable Flash program memory 512Bytes EEPROM 1Kbyte Internal SRAM Programming Lock for Software Security

    Peripheral Features Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and

    Capture mode

    Real Time Counter with Separate Oscillator Three PWM Channels Programmable Serial USART Programmable Watchdog Timer with Separate On-chip Oscillator Special Microcontroller Features Power-on Reset and Programmable Brown-out Detection Internal Calibrated RC Oscillator External and Internal Interrupt Sources Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, and Standby I/O and Packages

    23 Programmable I/O Lines 28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF

  • 7/30/2019 car automation system (adaptive lighting system)

    14/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 14

    Operating Voltages 2.7V - 5.5V (ATmega8L) 4.5V - 5.5V (ATmega8)

    Speed Grades

    0 - 8MHz (ATmega8L) 0 - 16MHz (ATmega8)

    Power Consumption at 4Mhz, 3V, 25C Active: 3.6mA Idle Mode: 1.0mA Power-down Mode: 0.5A

  • 7/30/2019 car automation system (adaptive lighting system)

    15/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 15

    3.5 Pin Diagram:

    The pin diagram of the microcontroller AT mega8 is given below:

    (RESET)PC6 PC5 (ADC5/ SCL)

    (RXD)PD0 PC4 (ADC4/SDA)

    (TXD)PD1 PC3 (ADC3)

    (INT0)PD2 PC2 (ADC2)

    (INT1)PD3 PC1 (ADC1)

    (XCK/T0)PD4 PC0 (ADC0)

    VCC GND

    GND AREF

    (XTAL1/TOSC1)PB6 AVCC

    (XTAL2/TOSC2)PB7 PB5 (SCK)

    (T1)PD5 PB4 (MISO)

    (AIN0)PD6 PB3 (MOS1/OC2)

    (AIN1)PD7 PB2 (SS/OC1B)

    (1CP1)PB0 PB1 (OC1A)

    Fig 3.2 Pin Diagram of ATMEGA8

    1 28

    2 27

    3 26

    4 25

    5 24

    6 23

    7 22

    8 21

    9 20

    10 19

    11 18

    12 17

    13 16

    14 15

    A

    T

    M

    E

    G

    A

    8

  • 7/30/2019 car automation system (adaptive lighting system)

    16/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 16

    3.5.1 Pin Description:

    VCC: Digital supply voltage.

    GND: Ground.

    Port B (PB7...PB0) XTAL1/XTAL2/TOSC1/ TOSC2: Port B is an 8-bit bi-

    directional I/O port with internal pull-up resistors (selected for each bit). ThePort B

    output buffers have symmetrical drive characteristics with both high sink and source

    capability. As inputs, Port B pins that are externally pulled low will source current if

    the pull-up resistors are activated. The Port B pins are tri-stated when a reset

    condition becomes active, even if the clock is not running. Depending on the clock

    selection fuse settings, PB6 can be used as input to the inverting Oscillator amplifier

    and input to the internal clock operating circuit.

    Depending on the clock selection fuse settings, PB7 can be used as output from the

    inverting Oscillator amplifier. If the Internal Calibrated RC Oscillator is used as chip

    clock source, PB7...6 is used as TOSC2...1input for the Asynchronous

    Timer/Counter2 if the AS2 bit in ASSR is set.

    Port C (PC5...PC0): Port C is a 7-bit bi-directional I/O port with internal pull-up

    resistors (selected for each bit). The Port C output buffers have symmetrical drive

    characteristics with both high sink and source capability. As inputs, Port C pins that

    are externally pulled low will source current if the pull-up resistors are activated. The

    Port C pins are tri-stated when a reset condition becomes active, even if the clock is

    not running.

    PC6/RESET: If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note

    that the electrical characteristics of PC6 differ from those of the other pins of Port C.

    If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level

    on this pin for longer than the minimum pulse length will generate a Reset, even if the

    clock is not running. Shorter pulses are not guaranteed to generate a Reset.

  • 7/30/2019 car automation system (adaptive lighting system)

    17/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 17

    Port D (PD7...PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up

    resistors (selected for each bit). The Port D output buffers have symmetrical drive

    characteristics with both high sink and source capability. As inputs, Port D pins that

    are externally pulled low will source current if the pull-up resistors are activated. The

    Port D pins are tri-stated when a reset condition becomes active, even if the clock is

    not running. Port D also serves the functions of various special features of the

    ATmega8

    RESET: Reset input. A low level on this pin for longer than the minimum pulse

    length will generate are set, even if the clock is not running. Shorter pulses are not

    guaranteed to generate a reset.

    AVCC: AVCC is the supply voltage pin for the A/D Converter, Port C (3...0), and

    ADC (7...6). It should be externally connected to VCC, even if the ADC is not used.

    If the ADC is used, it should be connected to VCC through a low-pass filter. Note that

    Port C (5...4) use digital supply voltage, VCC.

    AREF: AREF is the analog reference pin for the A/D Converter.

    ADC7...6 (TQFP and QFN/MLF Package Only):

    In the TQFP and QFN/MLF package, ADC (7...6) serve as analog inputs to the A/D

    converter. These pins are powered from the analog supply and serve as 10-bit ADC

    channels

  • 7/30/2019 car automation system (adaptive lighting system)

    18/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 18

    3.6 LDR:

    A Photoresistor or LightDependentResistor(LDR) is resistor whose resistance

    decreases with increasing incident light intensity; in other words, it

    exhibits photoconductivity.

    A Photo resistor is made of a high resistance semiconductor. If light falling on

    the device is of high enough frequency, photons absorbed by the semiconductor give

    bound electrons enough energy to jump into the conduction band. The resulting free

    electron (and its hole partner) conduct electricity, thereby lowering resistance.

    Photo resistors come in many different types. Inexpensive cadmium

    sulphide cells can be found in many consumer items such as camera light meters,

    street lights, clock radios, alarm devices, outdoor clocks, solar street lamps and solar

    road studs etc.

    They are also used in some dynamic compressors together with a

    small incandescent lamp or light emitting diode to control gain reduction and are also

    used in bed lamps etc.

    Lead sulphide (PbS ) and indium antimonide (InSb) LDRs (light dependent

    resistor) are used for the mid infrared spectral region. Ge: Cu photoconductors are

    among the best far-infrared detectors available, and are used for infrared

    astronomy and infrared spectroscopy.

    3.7 REGULATOR LM7805:

    A variable regulated power supply, also called a variable bench power supply,

    is one where you can continuously adjust the output voltage to your requirements.

    Varying the output of the power supply is the recommended way to test a project after

    having doubled checked parts placement guide.

    Features:

    Output Current up to 1A. Output voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V. Thermal overload protection. Short circuit protection. Output transistor safe operating area protection.

    http://en.wikipedia.org/wiki/Resistorhttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Photoconductivityhttp://en.wikipedia.org/wiki/Semiconductorhttp://en.wikipedia.org/wiki/Frequencyhttp://en.wikipedia.org/wiki/Photonhttp://en.wikipedia.org/wiki/Electronhttp://en.wikipedia.org/wiki/Conduction_bandhttp://en.wikipedia.org/wiki/Electron_holehttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Cadmium_sulphidehttp://en.wikipedia.org/wiki/Cadmium_sulphidehttp://en.wikipedia.org/wiki/Alarm_deviceshttp://en.wikipedia.org/wiki/Dynamic_range_compressionhttp://en.wikipedia.org/wiki/Incandescent_lamphttp://en.wikipedia.org/wiki/Light_emitting_diodehttp://en.wikipedia.org/wiki/Lead_sulfidehttp://en.wikipedia.org/wiki/Indium_antimonidehttp://en.wikipedia.org/wiki/Germaniumhttp://en.wikipedia.org/wiki/Copperhttp://en.wikipedia.org/wiki/Infraredhttp://en.wikipedia.org/wiki/Infrared_astronomyhttp://en.wikipedia.org/wiki/Infrared_astronomyhttp://en.wikipedia.org/wiki/Infrared_spectroscopyhttp://en.wikipedia.org/wiki/Infrared_spectroscopyhttp://en.wikipedia.org/wiki/Infrared_astronomyhttp://en.wikipedia.org/wiki/Infrared_astronomyhttp://en.wikipedia.org/wiki/Infraredhttp://en.wikipedia.org/wiki/Copperhttp://en.wikipedia.org/wiki/Germaniumhttp://en.wikipedia.org/wiki/Indium_antimonidehttp://en.wikipedia.org/wiki/Lead_sulfidehttp://en.wikipedia.org/wiki/Light_emitting_diodehttp://en.wikipedia.org/wiki/Incandescent_lamphttp://en.wikipedia.org/wiki/Dynamic_range_compressionhttp://en.wikipedia.org/wiki/Alarm_deviceshttp://en.wikipedia.org/wiki/Cadmium_sulphidehttp://en.wikipedia.org/wiki/Cadmium_sulphidehttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Electron_holehttp://en.wikipedia.org/wiki/Conduction_bandhttp://en.wikipedia.org/wiki/Electronhttp://en.wikipedia.org/wiki/Photonhttp://en.wikipedia.org/wiki/Frequencyhttp://en.wikipedia.org/wiki/Semiconductorhttp://en.wikipedia.org/wiki/Photoconductivityhttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Resistor
  • 7/30/2019 car automation system (adaptive lighting system)

    19/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 19

    The LM7805 is simple to use. Connect the positive lead of your unregulated

    DC power supply to the input pin, connect the negative lead to the common pin and

    then when you turn on the power, you get a 5 volt supply from the output pin.

    3.8 RELAY:

    A relay is an electrically operated switch. Many relays use an electromagnet to

    operate a switching mechanism mechanically, but other operating principles are also

    used. Relays are used where it is necessary to control a circuit by a low-power signal

    (with complete electrical isolation between control and controlled circuits), or where

    several circuits must be controlled by one signal. The first relays were used in long

    distance telegraph circuits, repeating the signal coming in from one circuit and re-

    transmitting it to another. Relays were used extensively in telephone exchanges and

    early computers to perform logical operations.

    Fig 3.3 Relay Circuit

    http://en.wikipedia.org/wiki/Electrichttp://en.wikipedia.org/wiki/Switchhttp://en.wikipedia.org/wiki/Electromagnethttp://en.wikipedia.org/wiki/Electromagnethttp://en.wikipedia.org/wiki/Switchhttp://en.wikipedia.org/wiki/Electric
  • 7/30/2019 car automation system (adaptive lighting system)

    20/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 20

    3.8.1 Advantages of Relays:

    Relays can switch AC and DC, transistors can only switch DC. Relays can switch higher voltages than standard transistors. Relays are often a better choice for switching large currents (> 5A). Relays can switch many contacts at once.3.8.2 Disadvantages of relays:

    Relays are bulkier than transistors for switching small currents. Relays cannot switch rapidly (except reed relays), transistors can switch many

    times per second.

    3.9 LED:

    Light-emitting diode (LED) is a semiconductor light source. This is one of the

    most important components of this project. It is used to indicate the headlights of a car

    3.10 POWER SUPPLY:

    A power supply is a device that supplies electric power to an electrical load.

    The term is most commonly applied to electric power converters that convert one

    form of electrical energy to another, though it may also refer to devices that convert

    another form of energy (mechanical, chemical, solar) to electrical energy. A regulated

    power supply is one that controls the output voltage or current to a specific value; the

    controlled value is held nearly constant despite variations in either load current or the

    voltage supplied by the power supply's energy source.

    Every power supply must obtain the energy it supplies to its load, as well as

    any energy it consumes while performing that task, from an energy source.

    http://en.wikipedia.org/wiki/Electric_powerhttp://en.wikipedia.org/wiki/Electrical_loadhttp://en.wikipedia.org/wiki/Electric_power_converterhttp://en.wikipedia.org/wiki/Regulated_power_supplyhttp://en.wikipedia.org/wiki/Regulated_power_supplyhttp://en.wikipedia.org/wiki/Regulated_power_supplyhttp://en.wikipedia.org/wiki/Regulated_power_supplyhttp://en.wikipedia.org/wiki/Electric_power_converterhttp://en.wikipedia.org/wiki/Electrical_loadhttp://en.wikipedia.org/wiki/Electric_power
  • 7/30/2019 car automation system (adaptive lighting system)

    21/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 21

    CHAPTER-4

    SOFTWARE IMPLEMENTATION

    4.1INTRODUCTION TO AVR STUDIO SOFTWARE:AVR Studio is an Integrated Development Environment (IDE) for writing and

    debugging AVR applications in Windows 9x/ME/NT/2000/XP/VISTA environments.

    AVR Studio provides a project management tool, source file editor, simulator,

    assembler and front-end for C/C++, programming, emulation and on-chip debugging.

    Step 1:

    Click on new project

    Fig 4.1: window showing the new project box

  • 7/30/2019 car automation system (adaptive lighting system)

    22/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 22

    Step 2:

    Click on AVR GCC Write the project name Select your project location. Click on Next>>

    Fig 4.2: Project name selection window

  • 7/30/2019 car automation system (adaptive lighting system)

    23/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 23

    Step 3:

    Click on AVR Simulator in left block and then select your controller (e.g.:Atmega8).

    Click on finish button

    Fig 4.3: Debug platform selection window

  • 7/30/2019 car automation system (adaptive lighting system)

    24/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 24

    Step 4:

    Write the code in main body area. Save the project file.

    Fig 4.4: Main body window

    AVR Studio supports the complete range of ATMEL AVR tools and each release will

    always contain the latest updates for both the tools and support of new AVR devices.

    AVR Studio 4 has a modular architecture which allows even more interaction with

    3rd party software vendors. GUI plug-ins and other modules can be written and hooked to

    the system.

    Using AVR Studio as an IDE gives you 2 main advantages:

    1. Edit and debug in the same application windows. Faster error tracking.2. Breakpoints are saved and restored between sessions, even if code is edited.

  • 7/30/2019 car automation system (adaptive lighting system)

    25/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 25

    4.1.1 save and open the project:

    All projects are saved with your selected name with the endingAPS. When the

    user wants to reopen a project, this can be done under the file menu and the recently

    used file list, or under the project menu, open project.

    4.1.2 Project output view:

    After building, assembling or compiling the project, the build output window

    prompts with messages. If any errors occur, the user can double-click on the message,

    and the marker will show correct position in the source window.

    4.1.3 Object files:

    Object files can be loaded by using the menu command Open file. See the

    object files format support for more information.

    If the project is moved from the original location where it was build, you will

    be asked to select a folder where the source files resists. The source will then be re-

    mapped and saved in the project file for use next time you load the project. The

    mapping can be cleared by deleting the project file (APS)

    The project view will display all your project files, but they will be set as read

    only.

    4.1.4 Description:

    Select Project->new project from the menu, and the dialog below will appear. The

    startup wizard will also have this option.

    4.1.5 Project types:

    Currently two project types are available listed in the project type list box.

    Atmel AVR Assembler and AVR GCC. The assembler (AVRASM2) is distributed

  • 7/30/2019 car automation system (adaptive lighting system)

    26/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 26

    with AVR Studio, but you have to download a GCC compiler to create and use an

    AVR GCC project.

    Projects can also be created by loading supported object files. File->Open file

    must be used to create a project name and a project file with in the AVR studio

    window.

    Input the project name. Default the initial file will have the same name (ASM or C)

    and will be created, but this can be changed. A folder with the project name can be

    created, but this is not default selected.

    4.1.6. Next step:

    If project name and project type are ok, press next to select platform and

    device to simulate/emulate. You can also finish now, but then the debug platform and

    device must be selected when a debug session is started.

    Fig 4.5: New Project window

  • 7/30/2019 car automation system (adaptive lighting system)

    27/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 27

    4.2 AVR STUDIO WINDOW:

    4.2.1 Description:

    When a new project is created or an old project is loaded, the project view will

    be displayed with all the project files. Files can be added, created or removed from the

    project list using the context menu.

    4.2.2. Source files:

    All the source files are listed below this item. The entry file is marked with a

    special icon, and can be changed using the context menu. Double click on any file to

    open it in the editor.

    4.2.3. Include files:

    All include files are listed here. Double click on any file to open it in the

    editor.

    4.2.4. Labels:

    All labels in your assembler program are listed her. Double click (or use

    space) on any item to show its location in the source. A blue marker will point to the

    correct line.

    4.2.5. Output:

    All output files will be displayed below this item

    4.2.6. Object-file:

    Name of the output object file

    4.3 INTRODUCTION TO EMBEDDED C:

    Looking around, we find ourselves to be surrounded by various types

    ofembedded systems. Be it a digital camera or a mobile phone or a washing machine,

    all of them has some kind of processor functioning inside it. Associated with each

    processor is the embedded software. If hardware forms the body of an embedded

    system, embedded processor acts as the brain, and embedded software forms its soul.

    It is the embedded software which primarily governs the functioning of embedded

    systems.

    During infancy years of microprocessor based systems, programs were

    developed using assemblers and fused into the EPROMs. There used to be no

    mechanism to find what the program was doing. LEDs, switches, etc. were used to

    http://www.engineersgarage.com/articles/embedded-systemshttp://www.engineersgarage.com/articles/embedded-systems
  • 7/30/2019 car automation system (adaptive lighting system)

    28/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 28

    check correct execution of the program. Some very fortunate developers had In-

    circuit Simulators (ICEs), but they were too costly and were not quite reliable as well.

    As time progressed, use of microprocessor-specific assembly-only as the

    programming language reduced and embedded systems moved onto C as

    the embedded programming language of choice. C is the most widely used

    programming language for embedded processors/controllers. Assembly is also used

    but mainly to implement those portions of the code where very high timing accuracy,

    code size efficiency, etc. are prime requirements.

    Initially C was developed by Kernighan and Ritchie to fit into the space of 8K

    and to write (portable) operating systems. Originally it was implemented on UNIX

    operating systems. As it was intended for operating systems development, it can

    manipulate memory addresses. Also, it allowed programmers to write very compact

    codes. This has given it the reputation as the language of choice for hackers too.

    As assembly language programs are specific to a processor, assembly

    language didnt offer portability across systems. To overcome this disadvantage,

    several high level languages, including C, came up. Some other languages like PLM,

    Modula-2, Pascal, etc. also came but couldnt find wide acceptance. Amongst those,

    C got wide acceptance for not only embedded systems, but also for desktop

    applications. Even though C might have lost its sheen as mainstream language for

    general purpose applications, it still is having a strong-hold in embedded

    programming. Due to the wide acceptance ofC in the embedded systems, various

    kinds of support tools like compilers & cross-compilers, ICE, etc. came up and all this

    facilitated development ofembedded systems using C

  • 7/30/2019 car automation system (adaptive lighting system)

    29/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 29

    CHAPTER-5

    RESULT

    5.1 SOFTWARE RESULT:

    The below window indicates that the program code for the car automation system was

    built successfully without errors.

    Fig 5.1: window displayed on building the code

    The below window indicates the glow of LEDs when the LDR senses the light.

    Fig 5.2: window displaying the glow of LEDs

  • 7/30/2019 car automation system (adaptive lighting system)

    30/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 30

    5.2 HARDWARE RESULT:

    The hardware setup of the project is shown below. It shows the Microcontroller

    ATMega8 with the reset circuit and supply circuit. For demo purpose the car

    headlights are indicated with LEDs.

    The figure below shows the waveforms of the power supply.

    Fig 5.3: wave showing the input to power supply

    The below wave form indicates the constant output.

    Fig 5.4: wave showing the output at microcontroller

  • 7/30/2019 car automation system (adaptive lighting system)

    31/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 31

    5.3 OBSERVATIONS:

    The observations are listed below:

    INPUT SUPPLY-5V

    Table 5.1Observations

    The minimum voltage of ATMEGA8 is 2.7v and maximum voltage is 5.5v

    .when input 5 volts is supply is given to IC, it produces voltage of 3.14v as the output.

    The Crystal Oscillator has the minimum voltage of 1.4v and maximum voltage of

    1.9v.when input 5v supply is given to the Oscillator then it produces an output of

    1.5v.The minimum voltage of LED is 0v and maximum voltage is 5v.when input

    5volts is given to LED then it starts glowing with an output voltage of 3v.

  • 7/30/2019 car automation system (adaptive lighting system)

    32/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 32

    APPLICATIONS

    Adaptive Lighting System for Automobiles is very useful for Safety of the

    vehicle owners. It automatically switch the head light to lower beam when there is a

    vehicle coming from front at night. Once the vehicle is passed it will automaticallyswitch the head light to higher beam. We can save the valuable human lives by using

    this system in the vehicles due to road accidents at night due to high flash lights. The

    adaptive lighting system can be also introduced in the highway traffic trucks and

    container carriers to reduce the probability of road accidents.

    With adaptive headlights, there's no guessing game. The lights turn their

    beams around each bend in the road, giving you a better view of what's ahead.

    Improved night driving isn't a trivial matter -- over 46 percent of fatal accidents in

    2006 occurred at night, a number much higher than the proportion of driving done at

    night. In this article, we'll look at how adaptive headlights differ from standard

    headlights and find out how they can make night time driving safer. We'll also look at

    some headlight innovations in the works.

    Standard headlights shine straight ahead, no matter what direction the car is

    moving. When going around curves, they illuminate the side of the road more than the

    road itself. Adaptive headlights react to the steering, speed and elevation of the car

    and automatically adjust to illuminate the road ahead. When the car turns right, the

    headlights angle to the right. Turn the car left, the headlights angle to the left. This is

    important not only for the driver of the car with adaptive headlights, but for other

    drivers on the road as well. The glare of oncoming headlights can cause serious

    visibility problems. Since adaptive headlights are directed at the road, the incidence of

    glare is reduced. A car with adaptive headlights uses electronic sensors to detect the

    speed of the car, how far the driver has turned the steering wheel, and the yaw of the

    car. Yaw is the rotation of the car around the vertical axis -- when a car is spinning,

    for example, its yaw is changing.

  • 7/30/2019 car automation system (adaptive lighting system)

    33/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 33

    CONCLUSION

    Thus this project is quite reliable and can be used in various applications

    where adaptive lightening plays a vital role. Implementing this project we can save a

    lot of power of the battery and this can be used even in heavy automobiles.

    Drivers visibility and comfort would greatly benefit if all of these systems

    could be made adaptive and designed into a unified system.

    However, substantial optical and technical problems that must be solved

    before such a system can be realized. This will take several decades, and it would be

    advantageous if the system could be made in such a way that it could be gradually

    improved.

  • 7/30/2019 car automation system (adaptive lighting system)

    34/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 34

    FUTURE SCOPE

    It is always difficult to predict what will happen in the future. Not knowing

    what the various adaptive systems will really look like, what they can do, how much

    they will cost, etc., does not make it easier.

    One semiautomatic (but not adaptive) system, expected to become more

    common within the next ten years, is daytime running lights in their most simple

    design. That means that the lights are turned on when the motor is started and

    switched off when the motor is stopped. This is a solution that already exists in many

    countries. It is therefore very simple to introduce.

    Another adaptive system could involve fog lamps. One reason for a possiblequick introduction could be that the adaptive functioning of these lamps is

    independent of the introduction of ITS systems. Furthermore, the sensors and the

    processing parts of the system are not too complicated. Drivers would really like to

    have something better. Demand should be there and, consequently, a commercial

    interest.

    The parts of the direct vehicle illumination system that could be during the

    next ten years appear to be the following:

    Speed sensitive light distribution Light distribution adaptive to driving in curves and turning round

    corners

    Light distribution sensitive to distance to preceding vehicle Light distribution adaptive to high probability target areas Light distribution adaptive to the reflectance properties of the road

    surface

    Illumination intensity adapting to the illumination of the oncoming car

  • 7/30/2019 car automation system (adaptive lighting system)

    35/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 35

    APPENDIXA

    SOURCE CODE

    The coding is built by using AVR Studio 4.18 for the microcontroller operation.

    #include

    #include

    #define F_CPU 1000000UL

    #define TRUE 1

    void initialise ( void);

    void ports_init( void );

    int main (void)

    {

    initialise ();

    while(TRUE)

    {

    if ( (PIND & 0x01)==0)

    {

    PORTB &= 0xFE;

    PORTB |= 0x08;

    }

    else

    {

    PORTB |= 0x01;

    PORTB &= 0xF7;

    }

    if ( (PIND & 0x02)==0)

    {

    PORTB &= 0xFB;

    }

    else

  • 7/30/2019 car automation system (adaptive lighting system)

    36/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 36

    {

    PORTB |= 0x04;

    }

    if ( (PIND & 0x04)==0)

    {

    PORTB |= 0x02;

    _delay_ms(1000);

    PORTB &= 0xFD;

    _delay_ms(2000);

    }

    else

    {

    PORTB &= 0xFD;

    }

    }

    return 0;

    }

    void initialise ( void)

    {

    ports_init( );}

    void ports_init( void )

    {

    DDRD = 0x00;

    PORTD= 0xFF;

    DDRB = 0xFF;

    PORTB= 0x00;

    DDRC = 0xFF;

    PORTC= 0x00;

    }

  • 7/30/2019 car automation system (adaptive lighting system)

    37/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 37

    APPENDIX -B

    TRANSISTOR BC547

    BC547 is an NPN bi-polar junction transistor. A transistor, stands for transferof resistance, is commonly used to amplify current. A small current at its base

    controls a larger current at collector & emitter terminals.

    BC547 is mainly used for amplification and switching purposes. It has a

    maximum current gain of 800. Its equivalent transistors are BC548 and BC549.

    The transistor terminals require a fixed DC voltage to operate in the desired

    region of its characteristic curves. This is known as the biasing. For amplification

    applications, the transistor is biased such that it is partly on for all input conditions.

    The input signal at base is amplified and taken at the emitter. BC547 is used in

    common emitter configuration for amplifiers. The voltage divider is the commonly

    used biasing mode. For switching applications, transistor is biased so that it remains

    fully on if there is a signal at its base. In the absence of base signal, it gets completely

    off.

  • 7/30/2019 car automation system (adaptive lighting system)

    38/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 38

  • 7/30/2019 car automation system (adaptive lighting system)

    39/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 39

    APPENDIX - C

    DIODE IN4007

    The diode IN4007 is used mainly to protect the relay from the high currents. It

    is connected across the relay at transmitter collector terminal. One end of the diode is

    connected to the transmitter and the other end is connected to the power supply.

  • 7/30/2019 car automation system (adaptive lighting system)

    40/41

    CAR AUTOMATION SYSTEM

    ALIET- ECE Page 40

    PICTORIAL REPRESENTATION

    The picture above shows the total setup of the project.

    1. ATMEGA8 Microcontroller2. LDR3. Relay4. Switches5. LED6. Reset7. Variable resistors8. Power supply9. Output wires

  • 7/30/2019 car automation system (adaptive lighting system)

    41/41

    CAR AUTOMATION SYSTEM

    REFERENCES

    1. Electronics devices and Circuits by Jacob Milliman and Chris Halkias 4th Edition2. Microcontrollers by RajKamal 4th Edition3. www.howstuffworks.com4. http://www.bmw.com/com/en/insights/technology/technology_guide/articles/mm_

    adaptive_headlights.html

    5. http://www.esafetychallenge.eu/en/esafety_challenge/esafety_applications/adaptive_headlights/

    6. http://www.atmel.com/images/doc2486.pdf7. http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&arnumber=4995269&contentType=J

    ournals+%26+Magazines&queryText%3Ddiode+1n4007

    8. http://electroschematics.com/tag/ldr-circuits/9. http://hyperphysics.phy-astr.gsu.edu/Hbase/electronic/rectbr.html