I am new to making circuits. What I am trying to do is get +-20V to be readable by an arduino. I found this circuit:

and got it to work. It scales +-6V to 0V - 5V. The problem I am having is changing the range from +-6V to +-20V. It seems like all I would have to do is change the resistor values, but I don't know how to approach finding them. Also I don't want to just know the values, but I want to learn how to find the values in other cases and for other circuits.


  • \$\begingroup\$ What input impedance do you want here? \$\endgroup\$ Commented Oct 25, 2016 at 1:32
  • \$\begingroup\$ Wouldn't I want it to be as low as possible? So that it stays accurate? \$\endgroup\$
    – user127754
    Commented Oct 25, 2016 at 2:25
  • \$\begingroup\$ Actually, you want a high impedance input for that. \$\endgroup\$ Commented Oct 25, 2016 at 2:30
  • \$\begingroup\$ Oh yeah. I was just thinking about it backwards. I don't fully understand impedance that well. \$\endgroup\$
    – user127754
    Commented Oct 25, 2016 at 2:36
  • \$\begingroup\$ It helps to know more about your +/- 20V signal. What is the source impedance? \$\endgroup\$ Commented Oct 25, 2016 at 4:09

2 Answers 2


For three resistors coming together from three different voltages (sharing a common reference potential):


simulate this circuit – Schematic created using CircuitLab

The center node that these resistors share in common then has the following voltage expression:

$$\begin{align*} V_o &= \frac{V_i\cdot R_p\cdot R_g + 5\:\textrm{V}\cdot R_i\cdot R_g +0\:\textrm{V}\cdot R_i\cdot R_p}{R_p\cdot R_g + R_i\cdot R_g + R_i\cdot R_p} \\ \\ &=\frac{V_i\cdot R_p\cdot R_g + 5\:\textrm{V}\cdot R_i\cdot R_g}{R_p\cdot R_g + R_i\cdot R_g + R_i\cdot R_p} \end{align*}$$

In your case, one of the voltages is zero, so that simplified things. Go ahead and plug in your resistor values and two different input voltages and I think you'll find that it precisely calculates the results you already know are correct.

Let's solve the above for the two important resistor divider values, \$R_p\$ and \$R_g\$. I think we can just set \$R_i\$ to some initial input resistance, so we don't need to solve for it since we'll just determine what it is and go from there.

$$\begin{align*} R_p &= \frac{\left(V_o-5\:\textrm{V}\right)\cdot R_i\cdot R_g}{V_i\cdot R_g - V_o\cdot\left(R_i + R_g\right)} \\ \\ R_g &=\frac{V_o\cdot R_p\cdot R_i}{V_i\cdot R_p+5\:\textrm{V}\cdot R_i - V_o\cdot\left(R_i + R_p\right)} \end{align*}$$

The first interesting thing to notice is that if you really do want \$V_o= 0\:\textrm{V}\$ when \$V_i\$ is some minimum voltage, like \$-20\:\textrm{V}\$, then you can actually solve for \$R_p\$ without needing to know \$R_g\$; because it reduces like this:

$$\begin{align*} R_p &= \frac{\left(0\:\textrm{V}-5\:\textrm{V}\right)\cdot R_i\cdot R_g}{V_i\cdot R_g - 0\:\textrm{V}\cdot\left(R_i + R_g\right)} \\ \\ &= \frac{\left(-5\:\textrm{V}\right)\cdot R_i\cdot R_g}{V_i\cdot R_g} \\ \\ &= \frac{\left(-5\:\textrm{V}\right)\cdot R_i}{V_i} \end{align*}$$

This is actually pretty cool. So long as \$V_{i\left(min\right)} \lt 0\:\textrm{V}\$, you can get a realistic valued \$R_p\$ without worrying over \$R_g\$ -- in the special case only, where \$V_o=0\:\textrm{V}\$. I'm pretty sure that the author (the one who created what you read about elsewhere about this divider idea) knew this detail. I don't believe it is just a coincidence that one of the input voltages leads to an exact zero voltage as an output.

So, let's say you want \$R_i=2.2\:\textrm{k}\Omega\$ and \$V_{i\left(min\right)}=-20\:\textrm{V}\$. Then it follows that \$R_p=550\:\Omega\$. That was easy. And now that we have \$R_p\$, we can use the next equation to solve for \$R_g\$, in the case where \$V_{i\left(max\right)}=20\:\textrm{V}\$. From that, we get \$R_g=733\:\tfrac{1}{3}\:\Omega\$.

If you want standardized values, you'd set \$R_p=470\:\Omega\$ and \$R_g=680\:\Omega\$, which would provide \$V_o\approx 380\:\textrm{mV}\$ when \$V_i=-20\:\textrm{V}\$ and \$V_o\approx 4.87\:\textrm{V}\$ when \$V_i=20\:\textrm{V}\$.

The total impedance, as seen by \$V_i\$, is:

$$\begin{align*} R_L &= R_i + R_p\vert\vert R_g \end{align*}$$

In the above example, this means \$R_L \approx 2.5\:\textrm{k}\Omega\$.

Regardless, the above equations provide you an algorithm or method by which you can establish various resistor values for your situation. You can also include your source resistance (of the input voltage) as part of \$R_i\$ in your calculations, if you happen to know it.

  • \$\begingroup\$ @AidanBlumLevine Thanks for the kind comment. Appreciated and I hope it does help. I think you can see how to design your own situation, now. Or I hope so. If this does answer your question, feel free to mark it as such. (If not, perhaps you have a related question? This is entirely your own decision.) \$\endgroup\$
    – jonk
    Commented Oct 25, 2016 at 21:11

You can try something like this. +20V in will be divided down to +5V. -20V in will shut off the diode and R1 will pull the Arduino input to ground. Scale R2 up if you want a lower voltage to the Arduino.


simulate this circuit – Schematic created using CircuitLab


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.