How can I use a 2N2222 transistor as a temperature sensor?
TMP36 is specifically a temperature sensor, not an NPN transistor like the 2N2222. You might have them confused because they both can come in TO-92 package. It is possible to look at the various properties of 2N2222 transistor and correlate it to temperature (see the other answers on this page), but that seems not practical for your application.
You will have to find a suitable alternative temperature sensor that &quot;provide a voltage output that is linearly proportional to the Celsius temperature&quot; with similar output to the TMP36 or try a different approach.