Electronics notes/Temperature sensing
Thermocouple
Thermocouples are any two metals (typically alloys) touching, which produce voltage due to the thermoelectric effect.
That voltage is on the order of millivolts so most uses, so accurate use requires
- amplification (with high input impedance to avoid the measurement affecting the thermocouple itself).
- and calibratio, and also varying somewhat with type.
Notes:
- Inexpensive
- High range of temperature - though split into a few ranges
- 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 thermocouples are any two metals (typically 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) does it 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 (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:
Diodes
The voltage across a diode will decrease by approx 2 mV per °C in a fairly linear way.
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.
Unsorted
DS18B20
- 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
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
HDC1000
https://www.ti.com/lit/ds/symlink/hdc1000.pdf
HDC1080
http://www.ti.com/lit/ds/symlink/hdc1080.pdf
LM92
http://www.ti.com/lit/ds/symlink/lm92.pdf
BMP085
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/
AM2320
https://akizukidenshi.com/download/ds/aosong/AM2320.pdf