Electrical – Reading a negative and positive voltage from an STM32F4 ADC


I'm working on an application which requires me to read a curve on an analogue signal. Depending on external influence the curve could either be a negative voltage or positive voltage. The shape of the curve doesn't change so it's effectively a direct inversion. The ADC of the STM32F4 that I am using has a Vref- that must be tied to Vss ie. ground (vref+ is currently 3V3 but I'm planning to reduce that when I get around to it). The ADC is currently configured to 12bits @ 1Msps. I'm taking 30 samples for each time i get a signal at the indicated point.

enter image description here

My problem: I can read Potential Signal 2 fine, it is within my ADC reference voltage. I cannot read Potential Signal 1 as it is outside my ADC reference voltage.

Solutions: I was initially just going to add a DC offset of 0.7V or so with a 5V rail that I have but ripple which may be present on the supply (LM78L05) could affect my reading as I am currently converting with an approximate accuracy of 800uV per bit.

I've also considered configuring the ADC to use two channels. One channel would be connected to the signal via a low gain inverter (this would flip potential signal 1 and amplify it a little) and channel 2 would be connected to the signal via a low gain non-inverting amplifier. I'm thinking that I could do this with a 2 Op Amp package and with precision resistors for the feedback loop.


simulate this circuit – Schematic created using CircuitLab

I could then use software to determine which of the two possible signals is the correct one (eg. potential signal 1 would mostly read a zero in ADC channel 2 but would look correctly inverted on ADC channel 1).

Does this make any sense, is there a simpler way to do this? My biggest issue is that my accuracy needs to be quite high, in the region of 100s of microvolts. Would voltage ripple present on the supply for the op Amp affect the output?

Idea number 2 inspired by @Rohat Kılıç's answer:


simulate this circuit

As I was initially concerned about adding an offset because of the potential added noise/ripple from the power rail, could I stick with the idea of using 2 channels of the ADC, add the same offset to both with the signal only being present on channel 1 and then channel1 – channel2 to remove the common noise?

thanks for the help

Best Answer

I wouldn't choose this tack, because the negative-going signal would not be within the range of allowable input signals on your microcontroller. Note that for the STM32f405 the absolute minimum input for a 5V tolerant pin is \$V_{SS} -0.3\$.

The way this is done is to offset the input signal to be midrange for zero input, attenuating if necessary.

Note in your circuit, the inverting gain is -1 and the noninverting gain is +2.

I see your need for accuracy, but suggest that if you can't handle a factor of two that attenuation would give you, you should be looking at your signal chain, perhaps considering a higher bit A2D.

An alternate method would be to use a precision rectifier to make the signal positive, and a comparator, read on a digitial input, to tell you if the signal is positive or negative. This might be more disturbing to your signal chain than the offset and attenuation.