Skip to main content
BSchm.6
Associate II
September 28, 2023
Solved

Voltage divider for ADC input?

  • September 28, 2023
  • 2 replies
  • 6383 views

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?

Best answer by TDK

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

 

2 replies

TDK
TDKAnswer
Super User
September 28, 2023

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

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
BSchm.6
BSchm.6Author
Associate II
September 29, 2023

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? 

TDK
Super User
September 29, 2023

> 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?

"If you feel a post has answered your question, please click ""Accept as Solution""."