Environmental Sensors for scratchClient

The recent months have been busy with preparing new experiments for my
school project, especially one experiment measuring temperatures with TMP36. See
link

When looking in detail to the datasheet of TMP36, there is an accuracy of max
+- 4K (G-Grade device) and +- 3K (F-Grade device). This is not bad for -40 to 125 °C. At 25°C, accuracy is  +- 3K (G-Grade device) and +- 2K (F-Grade device).
Unfortunately the ADC on my adapter board, the MCP3202, uses the
vcc-voltage as reference, which gives additional error for the measurement.
With patch cables, there is also some noise. I twisted signal and ground
line, added some capacity close to the TMP36 power pins and a low pass
filter in the adapter logic. Which reduced, but did not remove the problems.

So I started to look for more precise alternatives. LM35 in combination
with an adc ads1015 and internal precision reference voltage gives better results.
LM35A specs give +-1K over -40 to 110 °C, around 25°C +- 0.5K.

When starting to look for integrated solutions, complex devices like SHT15
come around. Main purpose is to measure humidity, but temperature
measurement is included. +-0.3K around 25°C and +-1.5K in -40 to 90°C are
quite good. I2C is not supported, but a two-wire GPIO protocol is
available. Disadvantage is the high price.

BMP085 is a digital pressure sensor with temperature sensing included. +-2K
accuracy in 0 to 65°C. I2C, internal calibration data in registers, needs
some calculations to correct the raw values.

MAX31855K is used with k-type thermocouples and extends temperature range
to -200 to 1350°C. Note that K thermocouples have about ±2°C to ±6°C
accuracy. SPI interface is easy to use.

And for curiosity, I added a luminosity sensor BH1750 to this collection of
devices.

Scratch integration is ‘as usual’ with adapters, where configuration is
done by xml files.

Hardware interface to the devices (to be more precise: the breakout boards
with the devices, is by I2C, SPI or plain GPIO. For the SHT15, I added a
serial resistor of 1kOhm for the data line to protect against
input-output-mismatches during debug phase of code. For the clock line, this
is not needed, but in general a good idea to a serial resistor there too.
Too expensive this device, to take the risk of burning it away.

These sensors will not be part of the school workshop documentation. Setup
is described in the scratchClient handbook → link.