2023-09-28 8:56 AM
OK, this is perhaps a fairly stupid question but I do not get it.
I have an analogue voltage in range -5V..+5V and wantto measure it with the ADC of an STM32F446. The ADC-input works in range 0..3.3V.
I have the feeling I can do that with a simple, resistor-based voltage divider that pulls down the 10V effective of the input value to the 3.3V the ADC expects.
But...how has ti voltage divider to look like when going with +-5V, means when it starts at -5V?
Solved! Go to Solution.
2023-09-28 9:01 AM - edited 2023-09-28 9:10 AM
You can do it by using 3 resistors instead of the usual two.
3V3
|
[R2]
|
[SIGNAL]----[R1]----+-----[ADC PIN]
|
[R3]
|
GND
Edit:
LET R1 = 10K
SIGNAL = 5V
ADC_PIN = 3.3V
VADC = 5V * R3 / (R1 + R3) = 3.3V
--> 3.3 = 5 * R3/(1K + R3)
--> R3 = 19.4K
SIGNAL = -5V
ADC_PIN = 0V
VADC = 3.3 - 8.5 * R2/(R1+R2) = 0V
--> 3.3/8.5 = R2/(1K + R2)
--> R2 = 6.34K
2023-09-28 9:01 AM - edited 2023-09-28 9:10 AM
You can do it by using 3 resistors instead of the usual two.
3V3
|
[R2]
|
[SIGNAL]----[R1]----+-----[ADC PIN]
|
[R3]
|
GND
Edit:
LET R1 = 10K
SIGNAL = 5V
ADC_PIN = 3.3V
VADC = 5V * R3 / (R1 + R3) = 3.3V
--> 3.3 = 5 * R3/(1K + R3)
--> R3 = 19.4K
SIGNAL = -5V
ADC_PIN = 0V
VADC = 3.3 - 8.5 * R2/(R1+R2) = 0V
--> 3.3/8.5 = R2/(1K + R2)
--> R2 = 6.34K
2023-09-29 3:41 AM
Thanks for your feedback. Based on your suggestion and due to the fact I have a single 5V power rail available, I have adjusted your scheme a bit:
+5V
|
|
[R 4K7]
|
|-----[ADC Pin]
|
[R 10K]
|
|
[SIGNAL]---+
This variant uses regular resistor values only while not completely going to 3.3V - which should be OK.
When [SIGNAL] is at -5V, the resistors voltage-divide a level of 10V and the ADC-pin gets 3.2V. when [SIGNAL] is at +5V it has the same level as the upper voltage input, so the ADC-pin is at 0V. This should work too...or did I miss something?
2023-09-29 6:42 AM - edited 2023-09-29 6:43 AM
> This should work too...or did I miss something?
> when [SIGNAL] is at +5V it has the same level as the upper voltage input, so the ADC-pin is at 0V.
You missed something. If +5V is 5V, and SIGNAL is 5V, how exactly is the ADC Pin going to be 0V?
2025-04-22 8:21 PM - edited 2025-04-22 9:27 PM
VADC = 3.3 - 8.5 * R2/(R1+R2) = 0V
Where does this 8.5 come from? Is it the total voltage swing -5V to 3.3V? Then it had to be 8.3. Please help.
I have a +30V -30V input to be fed to STM32H7 ADC, 16-bit and I am planning to use this circuit.
I tried using a 2 resistor potential divider using 33K and 3.3K resistors, but the output is not correctly read by the ADC. If I bypass the divider circuit and feed an input less than 3.3V to the ADC pin directly, it reads perfectly. Also tried adding an opamp buffer after the divided voltage, still no change. ADC output is fluctuating and not constant. What could be the reason? Should sampling time affect the resistor values?
2025-04-23 5:52 AM
Let's keep that discussion in the thread you made for it please.