Connect with us

Analog Voltage recognition by Microcontroller ADC

Discussion in 'Microcontrollers, Programming and IoT' started by Surjitsinh, Apr 23, 2017.

Scroll to continue with content
  1. Surjitsinh

    Surjitsinh

    17
    0
    Jan 1, 2015
    Hi,

    I have a voltage divider circuit as Shown in Image 1, To get different voltage drop based on closed switch and it is recognised by the ADC of a micro controller. Now if I am generating analog voltage from PWM signal as shown in Image 2 but ADC does not recognised the change?

    I get the exact analog value at input pin of ADC based on the duty cycle.

    Please give your views.
     

    Attached Files:

  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,271
    2,718
    Jan 21, 2010
    Depending on the value of the R and C in the input low pass filter, it may take some time for the voltage to settle at the final value, or it may have some ripple left on it.

    Are you looking for a specific value from the adc, or a value in a small range?

    What value are you expecting and what are you getting?

    The resistors on the output of the op-amp are not necessary.
     
  3. Bluejets

    Bluejets

    3,688
    760
    Oct 5, 2014
    If the resistors in fig 1 are appropriate levels and you wrote the program correctly, it should work ok.
     
  4. Surjitsinh

    Surjitsinh

    17
    0
    Jan 1, 2015
    Hi

    Thank you for your reply. I want to have 0-2V output but in Steps e.g 0V, 0.5 V, 1V, 1.5V and 2V. As shown in the Image 1 if I use simple voltage divider ADC recognised the Voltage. But when I connect it with Voltage follower output. ADC does not recognise the change. R = 10K and C = 10uF, PWM freq = 5khz
     
  5. Surjitsinh

    Surjitsinh

    17
    0
    Jan 1, 2015
    Hi,

    I want to replace Image 1 with Image 2 circuit. Generating analog voltage from PWM.
     
  6. Bluejets

    Bluejets

    3,688
    760
    Oct 5, 2014
    In that case would it not be better to count the frequency pulses ?
     
  7. Surjitsinh

    Surjitsinh

    17
    0
    Jan 1, 2015
    Not possible because MCU is fixed and need Analog voltage from 0-2V. I have a PWM source so I thought to use it to generate analog voltage than using resistor divider circuit. So I could control the voltage with Duty cycle.
     
  8. Surjitsinh

    Surjitsinh

    17
    0
    Jan 1, 2015
    Hi,

    I have connected the circuit as shown in Image 2 it works fine only issue I face now is there is too much current out of Op-Amp output. if I use a resistor I will drop some voltage. Please suggest a way out.
     
  9. BobK

    BobK

    7,671
    1,681
    Jan 5, 2010
    Yes, get rid of the superfluous resistors at the output.

    Bob
     
  10. Surjitsinh

    Surjitsinh

    17
    0
    Jan 1, 2015
    HI Bob,

    Yes I have removed those resistors and used a series resistor to limit the current. Flowing inside The Microcontroller.
     
  11. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,271
    2,718
    Jan 21, 2010
    That will make the voltage inaccurate.

    Why is there any significant current? Does the output of the op amp exceed the supply rails of the microcontroller? Have you mistakenly set the pin as an output instead of an input?
     
  12. BobK

    BobK

    7,671
    1,681
    Jan 5, 2010
    Yes, the input should draw negligible current.
    How do you know there is a lot of current drawn from the output?

    Bob
     
  13. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,271
    2,718
    Jan 21, 2010
    Also, please see post #2. There are some important unanswered questions.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-