How does the LM35 Temperature sensor work?
So to understand how you can build something which is Proportional To Absolute Temperature (PTAT) you have to dive a bit deeper into semiconductor basics, or rather principles.

Let's start with a simple diode (which is not how it is done in the LM35). The current through a diode is given by the Shockley equation (which neglects the series resistance which is fine for our use):
$$I=I_S \left(e^{\frac{V_D}{nV_T}}-1\right)$$

with:


\$I\$ the diode current
\$I_S\$ the reverse bias saturation current
\$V_D\$ the voltage across the diode
\$V_T\$ the thermal voltage
\$n\$ the ideality factor


Now \$I_S\$ and \$n\$ are properties of a specific diode, so they depend on the model you have and you can't influence them.

\$V_T\$ is actually what is really interesting. It is the thermal voltage which is given by this formula: \$V_T=\frac{kT}{q}\$ with \$k\$ being the Boltzmann constant, \$T\$ the Absolute Temperature of the diode junction and \$q\$ the elementary charge.

Now what you usually do with diodes as a temperature sensor is to force a constant small current through it and measure the voltage over the diode.

So you can solve the above equation to read:
$$ V_D = n\ \frac{kT}{q} \ \ln\left(1+\frac{I}{I_S}\right)  $$

\$n\$,\$I\$,\$k\$,\$q\$ and \$I_S\$ are all constant, so you can see the voltage across the diode will be varying only with the absolute temperature of the diode.

You will find that often the 1 inside the logarithm is neglected as \$\frac{I}{I_S}\$ is much greater than 1. To get a feeling for it: you might use a constant current of 30 µA as \$I\$ but \$I_S\$ is in the order of pA, so \$\frac{I}{I_S}\$ is in the order of a million and a million + 1 is still pretty close to a million.



Now the fun part is, that the base-emitter voltage of a transistor behaves just the same way as a diode.

The method used is called \$\Delta V_{BE}\$ because you use two transistors with different currents and you measure the difference of the two base-emitter voltages. The key is here to use two transistors which are essentially the same (so their properties are the same and can be cancelled out).

$$V_{BE1} = n\ \frac{kT}{q} \ \ln\left(\frac{I_{C1}}{I_S}\right) \\
V_{BE2} = n\ \frac{kT}{q} \ \ln\left(\frac{I_{C2}}{I_S}\right) \\
\Delta V_{BE} = V_{BE2} - V_{BE1} = n\ \frac{kT}{q} \ \left(\ln\left(\frac{I_{C1}}{I_S}\right) - \ln\left(\frac{I_{C2}}{I_S}\right)\right) \\
\Delta V_{BE} = n\ \frac{kT}{q} \ \ln\left(\frac{I_{C1}}{I_{C2}}\right)
$$

So what is the benefit of this compared to the diode above? You eliminated the process variation of \$I_S\$ and replaced it with two constant currents you have to provide, but you might get that under better control than the process variation.

Another thing you eliminate is the complex temperature dependency of the saturation current, which limits the linearity of your voltage output.

If you dive deep enough into these things you will encounter many properties which are not quite as ideal as the above equations might suggest. Some of these effects are cancelled out by the \$\Delta V_{BE}\$ method.

Also the typical diode has an ideality factor which is not as close to 1 as you would like it to be. Transistors base-emitter diodes have one much closer to 1.