EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / ADC Functioning of AtMega16

ADC Functioning of AtMega16

|

Microcontroller › AVR › ADC Functioning of AtMega16

  • This topic has 3 replies, 2 voices, and was last updated 13 years, 1 month ago by AJISH ALFRED.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • June 4, 2012 at 3:40 pm #1831
    CK
    Participant

    Hello, 

    I have given 4 sensor inputs to the ADC port (Moisture Sensor, Battery Level Indicator, Rain Sensor and Water Level Indicator).

    However, i do not get the desired output, maybe due to the load on micro controller.

    The voltage level drops when displayed as output.

    How to get the actual voltage output?

    Is there a way to reduce this load on micro controller?

     

    ADC functions:

    double Read()
    {
    ADCSRA|=(1<<ADSC);
    while (ADCSRA & (1 << ADSC));
    ADCSRA|=(1<<ADSC);
    while (ADCSRA & (1 << ADSC)); 
    _delay_ms(200);
    return ADC;
    }
    ///////////////////////////////////////////////
    void InitADC(unsigned char ch)
    {
       
     
    ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1);
    ADMUX = (ADMUX & 0xF8)  | ch;
    _delay_ms(200);
    return;
    }
     

     

    June 4, 2012 at 5:49 pm #7968
    AJISH ALFRED
    Participant

     

    There are 8 adc channels for atmega16. If you connect your sensors to any 4 seperate channels, there won’t be any issues of loading. You can then switch the channels before take reading of each.

    By the way, you have’nt said anything about your expected output.

    June 5, 2012 at 8:58 am #7969
    CK
    Participant

    hello,

    The  microcontroller’s pin number 40 is connected to moisture sensor, pin number 39 is connected to battery indicator, pin number 38 is connectd to water level indicator , pin number 37 is connected to rain sensor.

    i am using 12V battery

    Excepted output : 5 , 12 , 5 , 5

    output getting :0.073 ,5.000 , 0.092 , 4.0804

    June 6, 2012 at 4:52 pm #7974
    AJISH ALFRED
    Participant

     

    Have you connected adc reference voltage pin, pin32 ADREF to 5V ?

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Fixing board, Easy question HEX SCHMITT July 9, 2025
  • Can I make two inputs from one?? July 9, 2025
  • The Analog Gods Hate Me July 9, 2025
  • How to make string LEDs? July 9, 2025
  • It's Amazing What A Buck And A Quarter.... July 8, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise