How to use 2n2222 transistor as a temperature sensor?
Ask QuestionAsked todayActive todayViewed 78 times2
I’m supposed to use a TMP36 transistor for a class to read temperature of the environment but I only have a 2n2222 transistor; the Arduino will have an analog read of it but the numbers wont change even if I heat it up. Am I screwed or can I fix this?arduinotransistorssensortemperatureshareedit follow flag asked 6 hours agoJohn Rawls12111 bronze badge New contributor
- 3A TMP36 is not a transistor, so there is no way to substitute it with a 2N2222 which will give you useful results. – brhans 6 hours ago
- 1@John Rawls, Ah yes, you can turn 2N2222 into a TMP2222 for your class to read temperature of the environment. The problem is that Arduino ADC is only 8 bit so it is not precise enough to detect the small 2N2222 characteristic differences (eg, hFE, Ic etc) as temperature changes. A workaround is to use a dirt cheap 10bit/12bit ADC such as MCP3008/MCP3201/MCP3208 which enable you to read 0.!% to 0.025% accuracy. Then you need a thermometer to calibrate the hFE/Ic vs temperature graph. The graph might not be that linear. But / to continue, … – tlfong01 5 hours ago
- / continue, … you can show your class that you are an innovative future engineer, and of course they would see you as a hero, and your teacher couldn’t resist to give you a A grade, and your school principal to give you an outstanding R&D academic award, Then your principal can write to Analog Device about your fake TMP36 studies, and request them to give your class 40 real TMP transistors to do real research. 🙂 – tlfong01 5 hours ago
- 2Vbe of the transistor depends on temperature in a fairly predictable way. Using a diode or base-emitter junction as a temperature sensor is a fairly common application. Spehro already answered, though, so I won’t write another answer saying the same thing. – mkeith 4 hours ago
3 Answers
If you connect the transistor as a diode and bias it with a reasonable current, maybe a couple hundred uA, you can read the voltage. It will require calibration (say at room temperature and 0°C in an ice-water slurry.
Sensitivity will be about -2mV/K so with a 5mV resolution ADC you’ll have 2.5 degrees C resolution, not great.
If you connect it as a Vbe multiplier, say with 5:1, and average many measurements you might be able to get a usable resolution of about 0.5°C. Or just use an op-amp.shareedit follow flag answered 6 hours agoSpehro Pefhany264k1111 gold badges217217 silver badges545545 bronze badges
- 1The sensitivity depends inversely on bias current. Lower bias current will give slightly higher sensitivity. And I am not sure but I think maybe a couple hundred microamps will give sensitivity of more like 1.8mV per degree. I think maybe 10uA is enough, but I guess it depends on the ADC leakage current spec. You want the bias current to be much higher than the ADC leakage current. – mkeith 3 hours ago
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 might be possible to look at the various properties of 2N2222 transistor and correlate it to temperature, but that seems not practical for your applicationshareedit follow flag answered 6 hours agosyntax5922 bronze badges
- 2This is the only answer so far that is actually an answer to the question, rather than a science experiment – BeB00 5 hours ago
Question
Can 2N2222 transistor be converted to a temperature sensor, such as TMP36?
Answer
Yes, no problem, though not a very precise one, and you need the help of an ADC, such as MCP3008/MCP3201.

Now let us first look at the temperature dependent part of the 2N2222 characteristics, and see if it is worth doing an experiment or feasibility study.

You see that the DC current gain β(hFE), and collector current Ic changes when temperature changes in the range of 0°C to 50°C.
The current gain β is about 150 at 25°C and increases to 200 when temperature rises to 50°C, and decreases to 100 when temperature drops to 0°C.
We need to design a circuit to perhaps measure the voltage across a resistor when β and Ic changes and calibrate it.
/ to continue, …
References
(1) P2N2222A Amplifier Transistors NPN Silicon – On Semiconductor
(2) TMP36 Voltage Output Temperature Sensors Overview – Analog Devices
(3) TMP36 Voltage Output Temperature Sensors Datasheet – Analog Devices
(4) Low Voltage Temperature Sensors TMP35/TMP36/TMP37 Data Sheet – Analog Devices
Appendices
Appendix A – TMP36 Overview
Before the 2N2222 faking team attacks the real thing, they need to get to know their enemy. Below is the first spy report coming back.

Appendix B – TMP36 Spec Summary

Appendix C – 2N2222 Based Temperature Sensor Spec

Appendix D – 2N2222 Temperature Coefficients

Appendix E – 2N2222 Testing Record

Appendix F – Warning on 2N2222’s non standard pinout

shareeditdeleteflagedited 17 mins agoanswered 5 hours agotlfong011,01844 silver badges77 bronze badges
- 1The dreadful P2N2222 is about to strike again. To the OP: watch out for inverted C and E terminals, if you have a 2N2222. – Sredni Vashtar 5 hours ago
- @Sredni Vashtar, Many thanks for your very important and critical warning. Do you know why some chips have the two terminals inverted? In my long electronics hobbyist life, I have never heard of such a ridiculously dangerous pinout trap, for newbies, ninjas, and even pros alike. – tlfong01 13 mins ago
Categories: Uncategorized