Connect with us

PIC - voltage sense

Discussion in 'Electronic Design' started by James A, Sep 16, 2003.

Scroll to continue with content
  1. James A

    James A Guest

    I'm using a DC-DC converter to step down (4-4.8V) downto 3.5V to drive
    a number of Lumileds. The voltage source is a battery. (4.8V -> 4V)

    On the output I want to sense the voltage to be able to control the
    duty cycle. I'm using a PIC to monitor it as I also want to record
    some of the voltages.

    To sense the voltage I decided to use an Op-amp. I hooked it up in a
    Voltage follower configuration. I figured the low output impedance
    would result in a shorter aquisition time for the a/d converter.

    I thought that the gain would be slightly less than one, boy was I

    I tried a number of different voltages and received the following

    Input | Output
    4v - 2.91
    5V - 3.83
    10V - 8.93
    20V - 18.88
    30V - 28.8

    As the supply voltage increased the gain got closer to unity. This is
    of no use to me given that i will be operating at sub 5V levels.

    Also, why is the difference always about ~1.15

    The Op-amp used: LM358


    - No need for dual power supply
    - Drain suitable for battery powered operation

    I also then went on and tried the LM324 and received almost identical

    I'm certain someone can suggest a cheap method of monitoring the
    voltage, is the op-amp the way to go?

    If so, what specs should i be looking for?


    James A
  2. mike

    mike Guest

    Lose the op amp. There's a big resistor inside the pic anyway.
    You don't say which pic, but many use the power supply as the
    A/D reference. Not good if it's changing.

    Aren't you more interested in the led current than the voltage??

    Bunch of stuff For Sale and Wanted at the link below.
    laptops and parts Test Equipment
    4in/400Wout ham linear amp.
    Honda CB-125S
    400cc Dirt Bike 2003 miles $550
    Police Scanner, Color LCD overhead projector
    Tek 2465 $800, ham radio, 30pS pulser
    Tektronix Concept Books, spot welding head...
  3. Read the datasheet. The LM358 can't swing all the way to the positive rail;
    it can only get within 1.5V of it, according to

    Use a rail to rail opamp, or a higher voltage supply on the opamp. The LM324
    also can't swing to the positive rail.

    the maximum recommended source impedance for the A/D on the PIC12F675 is
    10k. If you are lower than that, you'll be fine without the voltage

    Bob Monsen
  4. What the other guy said about rail-to-rail output (and input). And, what
    the other guy said about not needing the op in the first place.

    But also: what's the efficiency of that converter? If you're just going
    from 4-4.8v down to 3.5v, it's unlikely that you're saving enough juice to
    make up for what the converter is wasting unless it's quite efficient. You
    might be better off with a plain old linear LDO regulator.
  5. Michael

    Michael Guest

    Providing you have a long enough acquisition time, I don't see why
    you should need an opamp to buffer the voltage into the PIC.
    Q. If you put 30V into the input, what supply did you have on the
    opamp? The max supply for the LM358 is 32V.
    The voltage gain of the voltage follower should be extremely close to
    1, it sounds like something else is upsetting your opamp.
    If you are not using the second opamp, ground its inputs, also make
    sure you use a supply-decoupling cap close to the chip. Opamps also
    tend to be unstable with capacitive loads, if you need to drive a
    capacitive load add a 1k in series with the opamps output.
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