Connect with us

Op-amp as voltage sensor

Discussion in 'Sensors and Actuators' started by hca, Oct 13, 2012.

  1. hca

    hca

    15
    1
    Aug 28, 2012
    What is a good op-amp to use to sense the voltage across a 12 V battery?
     
  2. (*steve*)

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

    25,174
    2,690
    Jan 21, 2010
    Almost any op-amp could do that, but the devil is in the details.

    What exactly are you trying to do? (detect flat battery, over-voltage, etc??)
     
  3. hca

    hca

    15
    1
    Aug 28, 2012
    Hi Steve,
    The main reason is to protect the battery from overcharging.
    I want the output of the op-amp to go into a microcontroller to generate a PWM signal to drive an IGBT (part of a buck-boost converter). So when the sensed voltage > 13.2 V, the duty ratio will become zero and the battery will essentially be disconnected.
     
  4. (*steve*)

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

    25,174
    2,690
    Jan 21, 2010
    If your logic runs from a regulated 5V rail, then all you need is a comparator capable of driving its output close enough to the supply rails to be seen as an unambiguous high or low logic signal.

    Using it as a comparator, you can compare 1/2 of the logic supply rail (use a voltage divider) with about 19% of the battery voltage (assuming they have a common ground).

    Practically, you may wish yo have a trimpot on one of the voltage dividers so that you can set the trigger point accurately.

    The signal will switch quite rapidly as the battery voltage reaches the trigger point so you may wish to introduce some hysteresis unless you're going to handle that in the program code.
     
  5. BobK

    BobK

    7,599
    1,641
    Jan 5, 2010
    Use a microcontroller with a built in comparator or ADC and you don't need a separate opamp.

    Bob
     
  6. hca

    hca

    15
    1
    Aug 28, 2012
    Thanks Steve and Bob.
    I am thinking of using a 7805 voltage regulator powered from the battery, to provide the 5V to the comparator, could that be an issue? In terms of physical connections, you would have the positive terminal of the battery connected to a resistive voltage divider (such that R2/(R1+R2) = 0.19) which would be connected to the non-inverting input of the comparator. On the inverting input you would have the 5V connected to a voltage divider of equal resistances.

    Now, the trimpot can go on either of these voltage dividers?
    I was thinking of using an LMV7219 comparator, as this has internal hysteresis.
     
  7. hca

    hca

    15
    1
    Aug 28, 2012
    Now, the second option of using a micro controller with "in built" comparators is a possibility. Would the external wiring to the micro controller essentially be the same as the op-amp option (prev. post). The MB95430H micro controllers have 4 "in built" comparators (pin 24 is the positive input, pin 25 is negative input and pin 23 is output).

    Now, would there be a benefit (or disadvantage) in using a voltage transducer instead of a comparator (whether separate or built in to a microcontroller)
    Thanks
     
  8. (*steve*)

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

    25,174
    2,690
    Jan 21, 2010
    No, that's a very common and perfectly acceptible way to go. It ensures a common ground with your battery which is a prerequisite for many of the voltage measurement tasks you need to do.

    That is correct.

    Yes, either one can.

    One divider needs to be variable. You could, for example make one of them using a 47k and a 10k resistor, with a 5k trimpot between them (and the tap taken from the wiper). This would allow adjustment from a ratio of 0.16 to 0.24 (which would correspond to a trigger point between 15.625V and 10.4V.

    Remembering that the 5V regulator may be a few percent off, and that the resistors themselves are not completely accurate either, this will provide you with plenty of range for adjustment without being too sensitive.

    Yeah, that seems to be a reasonable choice. The built-in hysteresis is small, but probably useful. It will correspond to about 0.04V at the battery terminal.

    I've not looked at one of these previously, but it seems you are right. Note that the output can be read from the chip, so you don't actually need to connect it somewhere to read it.

    This would work similarly to a separate comparator, with the exception that you'd have less control (none?) over the hysteresis. That can be dealt with (to some extent) in software anyway.

    If you connect your divider to an ADC input, it can read a value that corresponds to the battery voltage (maybe you have a divider with a ratio of 1/3 so that 1-15V corresponds to 0 to 5 v at the input, and a count of 0 to 1023 from the ADC. In that case, each count would correspond to about 0.0146V, so you'd me looking at maintaining a count near 901.

    This is the most flexible approach because your software has access to a value corresponding to the actual battery voltage and can be more clever (perhaps reducing the charge rate as the battery approaches full charge, or using a special charge mode if the battery is very flat, etc.

    Note that the internal ADC will give a quite precise reading of voltage, its accuracy is limited to the accuracy of the ADC and your 5V rail.
     
  9. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    In addition to Steve's excellent reply.

    I suspect that using a micro with a built-in ADC, as originally suggested by BobK and amplified by Steve, could be very worthwhile.

    You haven't described your circuit fully, but I take it that the microcontroller is interested in the battery voltage, and is controlling one or more other devices that relate to the charging and/or discharging of the battery. Making firmware able to continuously measure the actual battery voltage could enable you to add smart behavioural features in firmware that would be impossible if the firmware just sees a digital signal representing the battery voltage.

    Have a read of some manufacturers' app notes about measuring analogue quantities to find out where the sources of error will be, and how to minimise them, and to get an idea of what devices would be suitable. (Assuming you haven't already chosen your micro.) Companies like Microchip (PIC devices), Atmel (AVR devices) and Texas Instruments (MSP430 devices) would be a good place to start, and you can search for microcontroller surveys to see all the options.

    Please feel free to post a more detailed description of your project so we can post the most appropriate and useful suggestions.
     
  10. hca

    hca

    15
    1
    Aug 28, 2012
    Thank you for your detailed answers. I will look more deeply into the options, and may post a reply at a later stage.
     
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

-