Connect with us

y = mx + b configuration op-amp

Discussion in 'General Electronics Discussion' started by hotshot_amer, Nov 14, 2011.

Scroll to continue with content
  1. hotshot_amer


    Nov 14, 2011
    What I'm trying to pursue here is a Digital Voltmeter implemented in C using a freescale HCS12 micro-controller. I'm going to be using the embedded analog2digital(ATD) converter as an input from a power supply.


    My constraint here is that the voltage going into the ATD must be between 0V & 5V. So, basically I have a range of voltages from the power supply (ranging from -10V to +10V) that needs to be measured but stepped down on a linear scale before it goes into the micro-controller. The Vout vs. Vin (y-axis/x-axis respectively) equation is:

    y = (1/4)x + 2.5

    So far, I followed the procedure to design an opamp based on the line equation from my book (Op-amps for everyone), got the resistances for R1 and R2 with the following equation:

    R2 = [ m/(b/Vref) ] * R1
    Chose standard values: R1 -> 9.8 Kohm R2-> 4.9 Kohm
    When I proceeded to calculate values for Rf, I ended up with the following equation in terms of Rf and Rg.

    Rf = -0.248986 * Rg

    Asked my professor about this and he told me use a two stage op-amp configuration. Can somebody help me design this?
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    Nov 17, 2011
    I assume that yout ADC(µC) and your power supply have the same GND? If so, try this:
    1) scale down the input from +-10 V to +-2.5V using a resistive divider (1/4).
    2) build a differential amplifier (op amps for everyone chapter 3.5). Make V1=2.5V (via resistive divider from Vcc=5V or use a reference voltage source). Make V2=your scaled input Vin/4. With R3=R4 (see book) the output will be Vout=V1-V2=2.5V-Vin/4 which is in the range 0...5 V. Note that your ADC will see the inverse of Vin, since with e.g. Vin=-10V -> V2=-2.5V -> Vadc=5V. And Vin=+10V makes Vadc=0V. Also Vin=0V will result in Vadc=2.5 V and the ADC reading will be 1/2 full scale. You have to accommodate for scaling, zero point etc. in software
    3) I suggest making the input divider slightly more than 1/4, e.g. 1/4.2 to give some headroom for the ADC input to account for tolerances, temperature variations etc.

    Alternatively, if your ADC and your power supply have no common GND, you may just:
    1) scale down Vin by 4.2 (see note above)
    2) generate 2.5V via a resistive divider (possibly stabilize this voltage with a 100nF capacitor)
    3) connect GND of the power supply to 2.5V. Thus the other End of the divider from step 1 will swing between 0...5 V.
    Note that with this circuit, though much simpler, any connection between GND of your power supply and GND of your ADC will short circuit the 2.v% voltage and possibly destroy the ADC and maybe more.


    Last edited: Nov 18, 2011
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