: How to use 2n2222 transistor as a temperature sensor?
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?arduinotransistorssensortemperaturetlfong014363@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, …/ 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. 🙂 marcelm11.4k@tlfong01 “The problem is that Arduino ADC is only 8 bit” – The Arduino Uno and comparable boards use an Atmega328P, which has 10 bit ADCs.“the Arduino will have an analog read of it but the numbers wont change even if I heat it up.” – Sooo, how did you connect the transistor and your Arduino? Provide a schematic please. tlfong014363@marcelm, Ah, the first line of my updated answer says that that I will be using MCP3008/3201 ADC, and followed by the schematic. 2N2222 is biased by fixed value Rb (Gloen_geek, suggests 1 Meg, so I will blindly try it.) As shown in the schematic, 2N2222 output will go to ADC, controlled by Arduino/Rpi through SPI.I know the 2N2222 output vs temperature might be very non sensitive and very non-linear, and even 12 bit ADC is not accurate enough to process. So I already have 16/24 bit ADC standby, to brute force do ADC and massage non linear curve to become linear. I know I am walking a long and winding road, and at the end of the journey find nothing. But think I will at least know more 2N2222 inside out, and also 24 bit ADC usage. marcelm@tlfong01 My second comment (asking for a schematic) was intended for the OP 😉 tlfong014363@marcelm, (1) Many thanks for pointing out my careless mistake of wrongly thinking that Arduino ADC is only 8 bits resolution. I wrongly mixed up Arduino ADC with PWM. Actually Arduino PWM has 8 bits only, but Arduino ADC has 10 bits. (2) Now I think Arduino 10 bits ADC is OK to start our experiments. Actually many applications might not need to accurate, 2 Celsius degrees is enough. / to continue, …(3) Therefore I decided to remove the external ADC (MCP3008) in my answer. I will also remove Rpi from my answer, because it is only Rpi that needs MCP3008 ADC. Arduino is just about right for our project here. I will update my schematic ASAP. Thanks a lot. Cheers. PS – I would suggest to move our discussion to chat. See you in the chat room. 7 hours later… tlfong01436317:10@marcelm So I have updated the schematic.

Next step is to measure Ib vs Rb. Stay tuned.
Categories: Uncategorized