How do i measure -50 v to 50 v using At-mega micro-controller
Depending on the impedance of the source, you can actually do it with only 3 resistors.







simulate this circuit &ndash; Schematic created using CircuitLab

This basically forms a potential divider which is biased to the centre of the power supply rails. When the voltage at the input is at \$-50\mathrm{V}\$, you can work out that you will end up with \$0\mathrm{V}\$ at the output, and when  at \$50\mathrm{V}\$ you will end up with \$5\mathrm{V}\$ at the output.





To address the comment asking how this works, we have to delve into a bit of circuit theory. Lets first rearrange the above circuit to something we can do some derivations with. This is shown in the top left circuit below.







simulate this circuit

It is possible to transform a voltage source with a series resistance into a current source with a parallel resistance. In the top right circuit in the diagram above I have made this transformation. Using this transform, we can say that:

$$\begin{matrix}
I_s=\frac{V_s}{R_1} &amp;&amp;&amp; I_{dd}=\frac{V_{dd}}{R_3}=\frac{5}{R_3}
\end{matrix}$$

We can actually then do the transform again. If we group the resistances \$R_1\$ and \$R_3\$ together, and group the current sources together, then do the transform again, we get the bottom right circuit. After the transform, we can say:

$$\begin{matrix}
R_t=\frac{R_1 R_3}{R_1 + R_3} &amp;&amp;&amp; V_i=(I_s + I_{dd})\times R_t
\end{matrix}$$

With a little bit of substitution, we get:

$$V_i = \left(\frac{V_s}{R_1} + \frac{5}{R_3}\right)\times R_t$$

We can see from the circuit that this is now just a simple potential divider with a rather ugly input voltage. So we can say that:

$$V_o = V_i \frac{R_2}{R_2 + R_t} = \left(\frac{V_s}{R_1} + \frac{5}{R_3}\right)\times\frac{R_2 R_t}{R_2 + R_t}$$

We know from the very basics of a potential divider, that there is a linear relationship between the input and output. When the input gets lower, the output does (albeit by a scaled amount). So to start putting a value to the above resistors, we can take some limits. The questions asked for:

$$V_{i_{max}} = 50\mathrm{V} \rightarrow V_{o_{max}} = 5\mathrm{V} $$
$$V_{i_{min}} = -50\mathrm{V} \rightarrow V_{o_{min}} = 0\mathrm{V} $$

So lets work with that. First we will do the minimum limit. What can that tell us about the resistors?

$$\begin{align}
V_o &amp;= \left(\frac{V_s}{R_1} + \frac{5}{R_3}\right)\times\frac{R_2 R_t}{R_2 + R_t}\\\\
0 &amp;= \left(\frac{-50}{R_1} + \frac{5}{R_3}\right)\times\frac{R_2 R_t}{R_2 + R_t}\\\\
\frac{50}{R_1} &amp;= \frac{5}{R_3}\\\\
R_1 &amp;= 10 R_3
\end{align}$$

That's quite handy. It tells us a nice simple relationship between \$R_1\$ and \$R_3\$. It also simplifies the relationship of \$R_t\$ to:

$$\begin{align}
R_t&amp;=\frac{R_1 R_3}{R_1 + R_3}\\\\
R_t&amp;=\frac{10 R_3 R_3}{10 R_3 + R_3}\\\\
R_t&amp;=0.909 R_3
\end{align}$$

Now lets try our maximum case:

$$\begin{align}
V_o &amp;= \left(\frac{V_s}{R_1} + \frac{5}{R_3}\right)\times\frac{R_t R_2}{R_t + R_2}\\\\
5 &amp;= \left(\frac{50}{R_1} + \frac{5}{R_3}\right)\times\frac{R_t R_2}{R_t + R_2}\\\\
5\frac{R_t + R_2}{R_t R_2} &amp;= \frac{50}{R_1} + \frac{5}{R_3}\\\\
5\frac{0.909 R_3 + R_2}{ 0.909 R_3 R_2} &amp;= \frac{50}{10 R_3} + \frac{5}{R_3}\\\\
R_2 &amp;= 1.111 R_3
\end{align}$$

So in this case, we can basically say for the original circuit that:

$$\begin{matrix}
R_1 &amp;= 10 R_3 &amp;&amp;&amp; R_2 &amp;= 1.111 R_3
\end{matrix}$$

From there you can easily pick a value for \$R_3\$ and use it to find the other two resistor values.