Electronics notes/Temperature sensing
Thermocouple
Any two metals touching will produce a tiny voltage due to the thermoelectric effect (specifically the seebeck effect).
A few things can be called thermocouples, but very typically it's a an arrangement of two metals/alloys with a junction we can connect to both sides of,
A thermopile can be considered a bunch of thermocouples combined in series.
These tend to appear in devices that wish to skip the need for external power, precise amplification, but also in some more precise sensors as it can give better noise immunity. (They may also have a more robust housing)
(note that some pilot flame and other gas safety devices - the kind you have to heat to open a valve - also get called thermocouples. That's confusing and you can consider it incorrect. This seems seems to come from a mix of there being no singular short name for those, and proximity - thermocouples also get used in safety devices)
Notes:
- Inexpensive
- High range of temperature - though split into a few ranges (look through the types)
- These age with time and high-temperature use, so will need occasional recalibration and/or replacement.
- assume that most variants you will use won't get better than 1 degree Celcius of resolution
- Variants
- As most thermocouples are any two metals or alloys touching, there are endless possible variations.
- There are some combinations that became industry standards, and specified.
- The most common in general use may be type K.
https://en.wikipedia.org/wiki/Thermocouple#Types
Thermistor
Most resistors vary their resistance with temperature.
A thermistor (thermal resistor) is produced to do this intentionally, and more pronounced.
NTC: negative temperature coefficient, resistance drops (logarithmically) as its body temperature increases
PTC: positive temperature coefficient,
Due to being produced for varied wishes,
the 'at-rest' resistance varies with intent
They are frequently used in temperature sensing, temperature regulation, and (over)current protection.
Perhaps the he simplest way to get a voltage from a thermistor (think ADC, comparator) is to have it be one leg of a voltage divider.
Power thermistor
A power thermistor is a very low-resistance (NTC) thermistor in series with your main current, as a current limiter and/or (self-resetting) overcurrent protector.
One use is to spread the inrush current (in transformers and such) over more time:
- place in series with the primarily coil
- when cold (device just switched on) it typically has a few hundred ohm resistance
- and once it warms it (few seconds later) goes to under an ohm.
This lessens the magnitude of the sudden current that can happen right after you switch something on.
See also:
DHT11, DHT22
Measures:
- Temperature (NTC thermistor)
- 0-50 ℃
- output reported to 1℃ but don't assume more than ±2℃ accuracy
- Relative Humidity
- Range: 20 to 90 %RH (note: range and accuracy vary somewhat with temperature)
- output reported to 1% but don't assume more than ±5%RH accuracy
In a quick test with two DHT11 modules next to each other, temperature was reported 0.0 to 1.0 degrees apart on average, but humidity was ~11 %RH apart on average (fairly consistently so you can probably improve this a little via calibration against a known value).
Pins: 3.5-5.5V, data, NC, Gnd.
- You will want a pullup resistor on the data pin, mostly because it's bidirectional onewireish(verify).
Power: ~0.5mA while measuring, 0.1mA idle
DHT22:
- RH: 0 to 100% range, 2 to 5% accuracy
- Temp: -40 to 80°C range, ±0.5°C accuracy
AHT
AHT10 AHT20 AHT21 AHT25 AHT30
HDC1000
https://www.ti.com/lit/ds/symlink/hdc1000.pdf
HDC1080
http://www.ti.com/lit/ds/symlink/hdc1080.pdf
AM2320
https://akizukidenshi.com/download/ds/aosong/AM2320.pdf
PT100
Semiconductor
The forward voltage of a silicon PN junction depends on temperature.
In a sense, all semiconductors are potential temperature sensors, but most of them couldn't be connecteed to be read out, or engineered to be precise if they could.
Diode, transistor
Perhaps the simplest variant where you can is arguably the simplest semiconductor, a diode:
The voltage across a diode will decrease by approx 2 mV per °C in a fairly linear way.
The circuit is basically 'Pass a constant current, and sense the voltage drop'. Accuracy isn't great and you need amplification, and probably a DAC if you want in digital form, but it's quite convenient inside processors, FPGAs, and such, (where it can also be closer to the heat source than external sensors) especially if you just want a general idea.
A transistor can be used the same way, and might help the circuit around it a little.
DS18B20
A semiconductor bandgap type sensor, with its own ADC and reference(verify) which makes it a complete sensor in an IC.
- 1-wire interface
- 3V ~ 5V supply
- sample interval is 100ms..750ms depending on resolution
- range: -55°C to 125°C (seems quoted both as sense range and operating range)
- accuracy:
- see also DS18B20 accuracy curve, and things like this evaluation/calibration)
- expect drift of a few tenths of a degree
- quoted as
- 0.5°C within -10 to +85°C
- up to 1 or 2°C in the -10..-55°C and +85..+125°C ranges
- e.g. in a quick test of two of mine on wet ice cubes, the two settled on 0.44C and 0.19C, and in boiling water went up to 99.13C and 99.44C, respectively.
- And at least one of these appear to be counterfeit (seemingly one of the better ones in the set I have)
- there are counterfeits with clearly less accuracy (many cheap ebay/aliexpress will probably be this[1]
- you can do some custom calibration, with a distilled-water ice bath, boiling water
By itself it's a through-hole TO-92 part.
Waterproof enclosures are moderately common, often in stainless steel, and preferably (but not always) with silicone cable, so you could actually stick it in e.g. a sauna.
On the resistor
1-wire needs the data line to be pulled high, so that the master and (potentially multiple) devices can each pull it down. (and, in some cases, for parasitic power, but for this sensor we'll probably not use that)
It's common practice to add a 4.7k resistor to Vcc (varying a little with what that voltage is).
And yes, you can also use a microcontroller's internal pullup. They're typically rather higher value (e.g. 50k) so for longer wires the capacitance involved means communication may break down - but for short wires it works fine.
On counterfeits:
This is a whole bunch of research.
tl;dr
- some behave differently
- some have more noise on the measurement
- some have a few degrees of error (worse than a cheap DHT11)
- some are poorly calibrated, but would be fine with two-point calibration by you
- some are basically fine -- but you won't know which knockoff you'll get.
See also
LM92
http://www.ti.com/lit/ds/symlink/lm92.pdf
Unsorted
BMP085
Pressure, but also does temperature
https://www.sparkfun.com/datasheets/Components/General/BST-BMP085-DS000-05.pdf
https://www.sparkfun.com/tutorials/253
BME680
https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf
BME280
Humidity and pressure sensor
https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf
BMP280
Pressure (also temperature)
https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/