Uncategorized

2n2222 temp sensor chat record and answers and comments

Chat Record
https://chat.stackexchange.com/rooms/113855/discussion-between-tlfong01-and-tony-stewart-sunnyskyguy-ee75

DS18B20 Programmable Resolution 1-Wire Digital Thermometer Datasheet (±0.5°C (9-bit yo 12-bit) accuracy, -10°C to +85°C) – Maxim
https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf

A: How can I use a 2N2222 transistor as a temperature sensor?
tlfong01Question How can I use a 2N2222 transistor as a temperature sensor? I’m supposed to use a TMP36 transistor for a class to read the temperature of the environment, but I only have a 2N2222 transistor; the Arduino will have an analog read of it, but the numbers won’t change even if I heat it up. Am…

tlfong01
tlfong01
4439

@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.

@glen_geek. Ha, many thanks for your instruction, which I think is simple and concise. I must confess I don’t know at all your rationale or theory behind. But it so simple, so I guess both me and the OP which I guess is around 16 old student can also blindly follow your tip, and then do some measurement to see if your circuit might lead to anything promising. Then I will study the datasheet or other theories behind, and try to find why you suggest your design. / to continue, …

I now see our approach is odd, because it is not like the photo transistor, which sort of using CE junction, without electrical but only photo/light input from base. Of course I know I can just use a diode, which according to the (Schottky?) diode equation, is current dependent to temperature. Anyway, I will stop selfie brainstorming, and start experimenting @glen-geek’s geek tip..

@glen_geek, now I have set up the test circuit to test out your suggestion of using 1MR for Rb, varying Rc and see how it goes. I have also update the circuit and put it at the very top of my answer. Comments and counter suggestions welcome. Cheers.

@Voltage Spike, Thank you for your advice. Actually some of the suggestions and tests in my answer are out of date, misleading and plain wrong. So I have decided to set up a GitHub page, and place the datasheet summaries there. This way I can make my answer perhpas many times shorter, and only refer to my GitHub page for not too relevant details. Thanks again. Cheers.

@Sredni Vashtar, I agree with you that the vendor packages 2N2222 with pinouts as ordered by the Japanese buyers. I also notice that the new datasheets provide different styles of pin layouts for customers to order.

@Transistor, Ah yes, I am not surprised to discover that the OP is just a 15 year old student and a member of a computer hobbyist club in his school. My thinking is that he might be happy if we guide him to read the datasheets and how he can convert the 2N2222 into a temperature sensor, however crude or non linear his converter sensor it is. I guess even the designer of TMP36 is doing some sort of curve fitting/straighten to make final product linear and accurate. We might explain to the OP, that even if we cannot DIY a temperature sensor with accuracy of 0.5 degree. / to continue, …
But in many applications, eg, measuring the temperature of warm water in a bath, or even room temperature to control air conditioner/heater, an accuracy of two degrees is acceptable. My objective in making this answer is educational, learning how to read a datasheet, idea of non linearity and how to use software to workaround. Accuracy is never a requirement in my suggested DIY sensor, because it is not supposed as a accurate scientific instrument. / to continue, …

As you said, grasping concept, doing/learning/appreciating engineering design, trade off, cost benefit analysis, and the joy of DIY/making things or just a toy, even the project ends up a “failure”, is important, not accuracy or applicability

Tony Stewart Sunnyskyguy EE75
Tony Stewart Sunnyskyguy EE75

When you combine a fairly accurate – 2.2mV/’C NTC characteristics of the Vbe with base-collector shorted and then use a common emitter with hFE changing with T you get an inaccurate temperature sensor. -1
but great effort

tlfong01
tlfong01
4439

@Tony Stewart Sunnyskyguy EE75, Ah yes, everybody is talking about the magic number Vbe 2.2mV/C°. However, I am just a high school student, and my cheapy multi-meters have a ridiculously tiny current range of 2mA.And the real scientists are talking about the μAs. So the whole world’s high school students are weep in the dark.:(

@Tony Stewart Sunnyskyguy EE75, If you watch the videos in my reference list #20, 21, which I suppose are the “best” YTs on this subject, because Google ranks them at the very top. I do think that the alien EE engineers in our neighour galaxy are now LOLing at our high school students weeping in the dark.

Tony Stewart Sunnyskyguy EE75
Tony Stewart Sunnyskyguy EE75
I don’t consider any of those YT’s video’s as expert design references

tlfong01
tlfong01
Ha, yes, the 2.2mV/C° elites are laughing loudly at the YTs, which of course are newbies’ sorrows.

Tony Stewart Sunnyskyguy EE75
Tony Stewart Sunnyskyguy EE75
Thu 16:34

actually the tempco increases from -2.0 to -2.2 as the current is reduced to 1uA. Any self heating is undesirable too with small plastic parts @ 0.2’C/mW

tlfong01
tlfong01
4439

Ha, so I need to get a volt meter in 10 μA range? You remind me that ages ago, when I was educated in college to become an engineer. I was told that any engineer worth his salt must always remember 6 words by heart:

(1) Reliability,

(2) Tolerance,

(3) Accuracy,

(4) Trade off,

(5) Benefit,

(6) Cost.

Ah, I am missing my locking down lunch. Nice chatting with you. See you later.

I remember very vividly, that not too many years after my graduation, I learned many more things that I found very useful in my work, including the following:

(1) Appropriate Technology,

(2) Second Sourcing,

(3) Quality Control and Assurance,

(4) Risk Analysis and Control (MTBF, Black Swan Theory (sort of).

And the very important thing is the following:

(5) Info/Enggr System Analysis and Design(ISAD)

My journey in EE ended abruptly when most of the plants (including FairChild, Motorola, National Semi, Ampex, …) closed and or moved North. So I switched to software engineering, then to IT, … from transistor to IC, to MSI, LSI, to uP, to MCU, to SBC, to …

Long story short, I am all the way back to transistor, to 2N2222, …

And let me explain my 2N2222 temp sensor development with the following two things:

(1) User Requirement and Constraint,

(2) Functional Spec,

(3) Selection of Development Methodology (WaterFall, Protopyping, … Agile, …)

What I am now messing around with the the OP’s 2N2222 question is based on the Agile Methodology, which I see it as so called “Rapid Prototyping”, or “Meddling Through”,..

I also see the OP’s question as a case study of PBL (Problem Based Learning) where I don’t expect a clean solution. I think it would be nice, if me and the OP failed in all our suggested approaches, because we can “Learn by Mistake”, the more mistakes we make now, the more lessons we learn, …

I am just doing a selfie walkthrough of my electronics journey along a long and winding road, …

Just brainstorming/thinking aloud, sorry for all the typo mistakes.

I used to tell the newbies that my project development does based on the expert’s ideas, and the following is the text book I have been reading:

System Engineering Analysis, Design, and Development: Concepts, Principles, and Practices – Wiley 2nd Ed Charles S Wasson
amazon.com/…

For students such as the OP, I usually recommend the free 1st Ed eBook, because the basic concepts and recommendations by Prof Wasson are still up to date and very good.

1 hour later…

Tony Stewart Sunnyskyguy EE75
Tony Stewart Sunnyskyguy EE75
99.7k

Thu 18:24

The question needs more specs on range and accuracy not more analysis. Was it for room temp with 0.5′ accuracy or -40 to 50’C with 2’C accuracy

The kid was high school
he just needed a current source a transistor as a diode and an amplifier or a $5 DMM

20 hours later…

tlfong01
tlfong01
4439
Fri 14:03

(2) Let us deal with your second suggestion first. I agree with you that everybody says the best solution is to short the transistor’s CB and made it a diode then use the 2.2 mV and follow, say what you suggest, use a current source to apply constant current to the diode and the problem is almost solved.

But our customer might not be very happy to what you suggest for two reasons, (a) He asks for the transistor question, but you twisted it to a diode question,

Your suggestion is worse than the following: “Throw away the 2N222 and found a diode, just any diode, and search google for “2.2mV”, “Diode, temperature, sensor”.

The point is that the OP might have spent hours on biasing the transistor, perhaps in the wrong way as I biased it as a switching transistor, in the saturated mode.

If he shows me a photo or a schematic, I would repeat his situation and found that I actually did not know how to use 2N2222 as an amplifier. Then by trial and errors I found that I should bias it in the current amplification region and solved the problem.

Now the OP might need to only change the Rb of Rc and solved the problem, and understand and learn how to use the transistor in two ways, as a switch and as a small signal amplifier. That is what I said “PBL”, / to continue, …

If the OP already reported his problem to his teacher, of course the EE SE’s reputation will be damaged if the teacher know the quick and dirty solution is to forget and twist the old question, …

You remind me what we enggr usually says “Necessity is the mother of invention”.

Even I have no necessity for now, I usually browse a couple of forums and if newbies have any necessity, and I would try to invent or innovate to let the OP become sort of a spiritual rich guy with no necessity, because all problems solved, … 😦

(1) Let us go back to your first suggestion of “Let us don’t do any analysis, and just start with the spec (temperature range and accuracy)” which does make me laugh, because it is just non engineering, / to continue, …

The last message was posted 3 days ago.

How can I use a 2N2222 transistor as a temperature sensor?

Ask QuestionAsked 8 days agoActive todayViewed 3k times72

I’m supposed to use a TMP36 transistor for a class to read the temperature of the environment, but I only have a 2N2222 transistor; the Arduino will have an analog read of it, but the numbers won’t change even if I heat it up. Am I screwed or can I fix this?arduinotransistorssensortemperatureshareedit  follow  flagedited Oct 5 at 2:52Peter Mortensen1,63633 gold badges1616 silver badges2323 bronze badgesasked Oct 4 at 2:03John Rawls19711 silver badge33 bronze badges

  • 10A TMP36 is not a transistor, so there is no way to substitute it with a 2N2222 which will give you useful results. – brhans Oct 4 at 2:12 
  • 5@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 Oct 4 at 3:12   
  • 3/ 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 Oct 4 at 3:17   
  • 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 Oct 4 at 4:43
  • 1Does Vbe really depend on temperature? I think, instead it is the collector current which depends on temperature (for a fixed Vbe) – and Vbe must be reduced by app. 2mV/K to bring Ic back to its former value. – LvW Oct 4 at 12:22
  • 1@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. – marcelm Oct 4 at 14:55 
  • 4“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. – marcelm Oct 4 at 14:57
  • @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. – tlfong01 Oct 4 at 15:07   
  • 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. – tlfong01 Oct 4 at 15:13   
  • 1@tlfong01 My second comment (asking for a schematic) was intended for the OP 😉 – marcelm Oct 4 at 15:40
  • @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, … – tlfong01 Oct 5 at 2:18   
  • (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. – tlfong01 Oct 5 at 2:19   
  • Let us continue this discussion in chat. – tlfong01 Oct 5 at 2:19   
  • 1I just dropped in (been busy.) Top rated answer says “no can do.” Not one single person here has even given the slightest nod to using the collector region where the lower doping and a higher electric field can be used to advantage in providing better linearity and sensitivity. – jonk Oct 5 at 5:19 
  • 1@LvW, yes, Vbe depends on temperature. If you can find it, Bob Pease covered this at length in “what’s all this Vbe stuff anyhow.” This link is working, for the moment. forum.vegalab.ru/… – mkeith Oct 5 at 7:13
  • 1@jonk you mean forward bias the base/collector junction and use it as a temperature sensing diode? – mkeith Oct 5 at 8:02
  • 1@mkeith, I am afraid you did not interpret the article from Bob Pease correctly. In connection with Fig. 2 he wrote: “This illustrates the bias of transistors at various constant currents versus temperature.”. So – as I have stated: Vbe does not vary with temperature, but it MUST be changed EXTERNALLY by app. 2mV/K for a constant collector current Ic. This is because Ic is the source of temp. dependence! – LvW Oct 5 at 8:04
  • 1@LvW I have biased Vbe junctions with constant current on the bench and watched Vbe change with temperature. Same holds for diodes. Please try it yourself. – mkeith Oct 5 at 8:05
  • 1@LvW you may be right that I misinterpreted the direct applicability of Bob Pease’s article to this situation. Still, diodes are often used as temperature sensors on IC’s. The Vbe junction can be used as a diode. Or the base and collector can be tied together. Either way, Vbe will change with temperature under constant bias. – mkeith Oct 5 at 8:10
  • 1@LvW ti.com/lit/an/sboa277a/sboa277a.pdf – mkeith Oct 5 at 8:18
  • 1@mkeith, am I wrong when I think that it is the CURRENT change which is used as an indicator for temp. variations? – LvW Oct 5 at 8:28
  • 1continued: But – with reference to the linked TI note, of course, I agree that for a constant current, the Vbe change can be used in a special circuit (as shown) for temp. measurements. – LvW Oct 5 at 8:35
  • 1You don’t need a special circuit if your ADC has enough effective bits. But you do need to calibrate. – mkeith Oct 5 at 14:26 
  • 1@mkeith No. I guess no one here ever reads BJT-as-temperature-sensor research papers from folks who actually research this stuff. For example, there are innumerable papers on using BJTs created on CMOS process technology exactly for this purpose. And that’s only one small category of research papers on this specific topic. Some of the knowledge there would apply to discrete design (not all of it, obviously.) I guess for engineers, it’s work; and unless they work in this field they don’t read research papers just for fun and enjoyment as I do. They have a life. 😉 – jonk Oct 5 at 19:28
  • 1Well, @jonk, enlighten us! Or at least give a link or something. LOL. – mkeith Oct 5 at 19:52
  • 2@mkeith “The temperature characteristics of bipolar transistors fabricated in CMOS technology,” Guijie Wang & Gerard C.M. Meijer, 2000, is one I quickly see on disk here at home (searched, since I knew what to look for in this case.) – jonk Oct 5 at 19:58
  • @jonk, Many thanks for the reference. Unluckily it is a book costing US$40!. Luckily I googled the book author Meijer and found a free PDF paper also by him: Precision Temperature Measurement Using CMOS Substrate PNP Transistors, M Pertijs, G Meijer, IEEE SENSORS JOURNAL, VOL. 4, NO. 3, JUNE 2004 citeseerx.ist.psu.edu/viewdoc/…. – tlfong01 Oct 6 at 4:24    

add a commentstart a bounty

4 Answers

ActiveOldestVotes41

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 “provide a voltage output that is linearly proportional to the Celsius temperature” with similar output to the TMP36 or try a different approach.shareedit  follow  flagedited Oct 6 at 7:50answered Oct 4 at 2:34syntax55433 silver badges77 bronze badges

  • 11This is the only answer so far that is actually an answer to the question, rather than a science experiment – BeB00 Oct 4 at 3:46
  • 3@BeB00 actually, the use of a BJT as a crude temperature sensor is usually taught in microelectronic courses to stress the dependency of the characteristics from temperaure. If anything, this answer misunderstood the OP intention to create the best temp sensor possible with a single BJT transistor. Scroll down to see actual answers to the question asked. – Sredni Vashtar Oct 6 at 5:24
  • 2@BeB00 I had a look at the edit history and the question has always been how to use a 2n2222 as a temp sensor. There is nothing wrong in what syntax wrote, but that is not the answer to the question. It’s more of a shopping advice. The fact that it has gained more upvotes, along with your comment, does not mean anything: science and engineering are not supposed to be democratic. I’ve see several wrong answers being upvoted above correct ones. The upvoting mechanism isn’t perfect (nothing is), even if it is usually informative. – Sredni Vashtar Oct 6 at 16:20
  • 2@SredniVashtar the question isn’t “I need to make a temperature sensor with a 2n2222, how do I do it”, it’s about a class where the person is supposed to use a temperature sensor to read the temperature. These other answers, while interesting, are not actually relevant to OP, since they are a beginner who needs a simple way to get the temperature, rather than create a complex circuit, calibrate it, and try to use that instead. The OP has confused the TMP36 with a transistor, and they’re asking if they can use the 2n2222 as a subsititute. The answer to this question is no – BeB00 Oct 6 at 23:24
  • 2@SredniVashtar It’s quite common on this site to have beginners come in and ask questions, and then have long answers suggesting (relative to the OPs knowledge level) complex and clever circuits which are of basically no help to the asker. This is one of those times. As I said, the answers are interesting to read, and should be encouraged, but people should also take into account what the question really is, because if Syntax hadn’t answered, there would be nothing that actually helped OP – BeB00 Oct 6 at 23:26 

add a comment  |  show 4 more comments24

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.

Edit: Here is a simulation result used as a simple Vbe multiplier.

enter image description here

0°C 3.591V

25°C 3.328V

50°C 3.057V

75°C 2.781V

100°C 2.500V

The current drops as the voltage increases (due to the use of a simple resistor as a current source) so the linearity isn’t great= 11.2mV/K average at 0..25°C and 10.5mV/K average at 75..100°C, but for narrow excursions around room temperature it should be fine, or it can be corrected digitally. With a 10-bit ADC and 5V Vref the resolution is about 0.5°C, which is adequate for many purposes.

There are much better ways to measure temperature with a transistor, however the complexity is increased. Using matched transistors or multiple (2 or 3) currents with a single transistor allows cancellation of many of the transistor parameters that vary from unit to unit, as well as connection resistance. Unfortunately, the sensitivity is reduced by at least an order of magnitude so better analog circuitry is required.

Edit/Epilog:-

I tried this with a single diode-connected BJT (base connected to collector) with a 10K resistor to the regulated (and otherwise unused) 3.3V rail on an Arduino Nano. Reference set to nominal 1.1V as suggested by @EdgarBonet, summed 100 sequential readings.

  1. Calibrated the voltage by adding a multiplier so the reading was accurate in mV compared to a handheld 3.5 digit DMM.
  2. Wrote the equation for temperature based on the current room temperature and the mV, with an estimate of -2.0mV/K for the Vbe temperature coefficient.
  3. Tested it at 0°C and 45°C against a type K bead thermocouple.
  4. Adjusted the 2.0 to 2.2 to reduce the error at the temperature extremes.
adc *= 1.0532319391 * 0.01;  // calibrated voltage in millivolts, 100 summed
temp = -(adc - 556)/2.2 + 24.0;

Works quite well with only one unexpected thing- the INTERNAL1V1 constant was not defined even though the Arduino environment knows it is an ATMega328p (using an Arduino Nano). I added one line to code the definition:

#define INTERNAL1V1 2
analogReference(INTERNAL1V1);

shareedit  follow  flagedited Oct 5 at 16:06answered Oct 4 at 2:47Spehro Pefhany265k1111 gold badges218218 silver badges546546 bronze badges

  • 2The 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 Oct 4 at 4:59
  • Note that you need an OP amp in order to read the signal using an Arduino (as the OP mentions in the main question). The Arduino required an impedance of 10kOhm or lower in order to stay within spec for the analog inputs – Ferrybig Oct 4 at 15:31
  • @Ferrybig There are techniques for allowing several hundred K input impedance without significant error (10n cap + certain delays), or reduce the resistors 5:1 for similar results. – Spehro Pefhany Oct 4 at 15:40
  • 2Note that on most Arduinos you can set the voltage reference of the ADC to some internal reference lower than Vcc: 1.1V or 2.56V on AVR boards, 1.0V on the SAMD boards… – Edgar Bonet Oct 5 at 8:13 
  • 1At 1.1V a single diode-connected transistor with a 10K series resistor to +5 would work very nicely. Resolution about 0.5°C. Might have to average a bunch of readings. – Spehro Pefhany Oct 5 at 8:24 

add a comment  |  show 1 more comment7

Question

How can I use a 2N2222 transistor as a temperature sensor?

I’m supposed to use a TMP36 transistor for a class to read the temperature of the environment, but I only have a 2N2222 transistor; the Arduino will have an analog read of it, but the numbers won’t change even if I heat it up. Am I screwed or can I fix this?

I am in high school studying for math.


Answer

Update 2020oct08hkt2248

So I did the preliminary test and measured the three values, Ib (Note 1), Ic, and Vc against temperature from about 3°C to above 50°C (Note 2). I also use Excel to calculate β. A summary is given below.

test results 1

Note 1 – The Ib column is almost constant, as is Vbe. So Vcc and Rb is an approximation of applying a current source to an diode (2N2222 BE junction), and measure Vbc, as advised by @Tony Stewart Sunnyskyguy EE75.

Note 2 – My cheapie digital thermometer for home use overflows somewhere above 50°C. The OP’s requirement anyway is to measure the “environment” which I think is approx a range from 0°C to 50°C. So I won’t bother for now to find a thermometer for higher temperature.

Actually my calibration plan is to use the DS18B20 temperature sensor to replace my cheapy home use thermometer.


Update 2020oct08hkt1413

Now 2N2222 is enjoying a cold plunge

cold plunge

Update 2020oct08hkt1111

A more high school student friendly schematic of the 2N2222 temperature sensor.


2n2222 temp sensor

Update 2020oct07hkt1549

Sauna test results – stackOverflow!

Hot water bath overflows my digital thermometer!

sauna 1
sauna 2

Update – 2020oct07hkt1151

Tidying up messy wiring, getting ready for Hot Sauna Cold Plunge


temp sensor test

cat spa

Update 2020oct06hkt2141

So I adjust the values of Rb and Rc to move operation region from saturation to amplification, where current gain is around 250, similar to the value measured by the multi-meter, as illustrated below.

2n2222 test

I then used a hot gun to blow hot air to the 2N2222 circuit. I guess the temperature around the circuit should be higher than 50 degree C, because my hand could not bear it for more that one or two seconds.

I am glad to see that Vc, Ic, and Ib rose, as summarized below.

-------------------------------------------------------
  Temp      Ib (mA)     Ic (mA)      Vc (V)         β
-------------------------------------------------------          
  28°C       0.0230         5.6        0.18       243     
Hot air      0.0244         6.6        1.30       270 
-------------------------------------------------------

Of course the temperature as measured by hand is very crude, but the changes of Ic, Vc, and β is significant.

I don’t worry that Ic, Vc, and β vs temperature is non linear, because we can use software to calibrate, sort of flatten/straighten the non linear curve to a straight line.

Next step is to use ice cold water around 0°C and hot water at 90°C to measure and plot Ic, Ib, Vc, and β against temperature in C°.


Update 2020oct06hkt1534

Now I am updating my old design with an opAmp.

enter image description here

Update 2020oct0601

As I found that my old tests do not give expected results, because of wrongly chosen components values. So I am moving the old design and bad test results to the GiHub page.

I think @csabahu’s answer is very good. So I am studying his design and using his testing parameters to do my coming tests. I originally thought that I should be using the 2N2222’s current gain to amplify the very small output values for easy measurement. Now I thnik @csabahu’s use of the opAmp is a much better approach, because the opAmp should not load down output signals and also can easily adjust gain factors.

But I have little experience in using opAmp for instrumentation. So I need to google some more tutorials before I start my new circuit.

My old design with Ic of the order 1mA has already saturated the 2N2222. Now I am thinking of up shifting the Ic test range from 1mA to 10mA, and even up to 100mA. My old selection of Ib of the order of 1uA is also too small for my cheapy multimeter to measure.

/ to continue, …


References

(1) P2N2222A Amplifier Transistors NPN Silicon – On Semiconductor

Update 2020oct06

The old reference list was getting too long and messy, so I have moved those not too relevant old references (16 in total) to the GiHub page.


(17) Precision Temperature Measurement Using CMOS Substrate PNP Transistors – M Pertijs, G Meijer, J Huijsing etal, IEEE Sensor Journal 2004.

(18) Diode-Based Temperature Measurement – TI, Application Report SBOA277A–March 2018–Revised May 2019

(19) What’s All This Vbe Stuff, Anyhow? – Bob Pease, Electronic Design’s Analog Applications Supplement, 2000jun26

(20) How do you get a temperature sensor from a transistor? – Randy Frank, Sensor Tips, 2017oct27

(21) Using Diodes or Transistors as Temperature Sensors – electronicsNmore, 400K subscribers, 11,037 views 2014nov01

(22) AliExpress LM134/LM234/LM334 3-Terminal Adjustable Current Sources – TI, US $2/5pcs

(23) DS18B20 Programmable Resolution 1-Wire Digital Thermometer Datasheet (±0.5°C (9-bit yo 12-bit) accuracy, -10°C to +85°C) – Maxim

(24) DS18B20 Temperature Sensor – Rpi 3/4 Driver, Wiring, Detection, and Python Programming – Rpi SE 2019jul02


Appendices

Update 2020oct06hkt1434

My first idea of testing plan is wrong, because I don’t understand the small signal properties of 2N2222. My knowledge and experience is only on the use of 2N2222 as a switch. So I am studying the datasheet and thinking of designing a new test plan. One thing I am doing is to shift the Ib and Ic testing range, so it is easier to use my multi-meters to do measurements. The new datasheet summary is pasted below.


2n2222 1
2n2222 2

I am also using the new MMBT2222 datasheet instead of the old 2N2222.


shareeditdeleteflagedited just nowanswered Oct 4 at 3:28tlfong011,10211 gold badge44 silver badges77 bronze badges

  • 6The 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 Oct 4 at 3:49
  • 2@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 Oct 4 at 8:36   
  • 2When you combine a fairly accurate – 2.2mV/’C NTC characteristics of the Vbe with base-collector shorted and then use a common emitter with hFE changing with T you get an inaccurate temperature sensor. -1 – Tony Stewart Sunnyskyguy EE75 Oct 8 at 4:23 
  • 2but great effort – Tony Stewart Sunnyskyguy EE75 Oct 8 at 4:53
  • 2I don’t consider any of those YT’s video’s as expert design references – Tony Stewart Sunnyskyguy EE75 Oct 8 at 5:13 

add a comment  |  show 19 more comments5

If there is an unnecessary operational amplifier in the drawer, a very nice signal can be output from the transistor. 

At zero degrees, set 3V at the output with a 47k resistor. Then at 100 degrees with 10k resistor to 1V. (Ice water or boiling water.)

Of course, if you only use it on your own machine, calibration can be purely with software.shareedit  follow  flag answered Oct 5 at 16:48csabahu1,60655 bronze badges

  • 1You probably meant to write ‘potentiometer’ instead of resistor. – Sredni Vashtar Oct 5 at 18:03
  • 1Almost. A smaller potentiometer with which the ratio of the given resistors can be fine-tuned. For example, a 2k potentiometer between 47k and 10k. Here, it is not the absolute value of the resistance that is interesting, but the voltage setting of the non-inverting input. Of course, this is only needed if we want to calibrate the thermometer. – csabahu Oct 5 at 18:38
  • 1@csabahu, Ah, your colourful schematic is looking nice, and the opAmp Vout vs Temperature chart is impressively ideal. So I will search my jun bin for an opAmp and try it out. – tlfong01 Oct 6 at 3:54   
  • 1@tlfong01, What’s the weather like in your city today? Have you tried the thermometer? – csabahu Oct 6 at 19:31
  • 1@csabahu, (1) Ah, I usually Yahoo to get the weather in my city: hk.news.yahoo.com/weather. (2) I do have a couple of thermometers. See update today (2020cot07) of my answer to see how I am using my digital thermometer. Cheers. – tlfong01 Oct 7 at 4:26   

add a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.