There have been a few posts on here about differences in readings from BME280s and some general reliability issues. I tried a comparison between three BME280s and two TMP36s and thought the result might be of general interest.
I’ve been building three temperature sensors to dot around the house, with small ePaper displays. Still on breadboard, they have been sitting on my monitor stand for months and I have noticed a regular difference of about 1 degree C between two of them. Wondering if a TMP36 would be more reliable, I added a couple of them to two of the devices with a BME280 and graphed the results. What I have found has been surprisingly consistent. I also grouped them tighter together on my desk further away from the heat of monitors and PCs.
For the BME280, I’m using the Adafruit_BME280 library, and for the TMP36, it is connected to an analog port, then uses the following code to read:
float temp = bme.readTemperature();
// Read the TMP36
float tmpr = analogRead(TEMP); // Raw reading
float tmpv = (tmpr * 3.3) / 4095.0; // Convert to voltage
tmpTemp = (tmpv - 0.5)*100;
float tmpDiff = temp-tmpTemp;
I calculate the difference in temperature between the two devices to see if it is consistent.
The graph after a day is:
One TMP36 read consistently higher than the other. Out of the 5 temperature sensing devices, one was always the highest (in green) and one was always the lowest (in yellow). The difference was about 2 degrees. The biggest difference in the BME280s was about 0.7 degrees, making up the blue, grey and purple lines in the middle.
On the same Particle device, one TMP36 was consistently 0.5-1 degree higher than the BME280, while on the other one the difference was anywhere between 1 and 2.5 degrees lower, with 1.5 degrees lower being the most common difference.
My conclusions are that each device is (as specified) within a certain percentage of the exact temperature. Read high or read low, whatever the difference it is, it sticks to it. With one TMP36 higher and one lower, the TMP36 does not seem to be any better or more accurate than the BME280. The BME280s are far more consistent between each other. Some people have said they can report a little high. If that is true they all seem to report high by the same amount. Calibrating with a TMP36 isn’t going to help and you probably need a much higher quality sensor.
If you are trying to decide between them, then it comes down to a cost & functionality decision as the BME280 also measures pressure and humidity. However I have had two BME280 units go quite erratic before failing. The TMP36 is more moisture resistant and I think you can get it in a waterproof package.
My initial issue that I noticed a regular 1-1.5 degree difference in the two BME280s, it turns out after this experiment that one part of my monitor stand really is that much hotter over quite a small space. I should have just swapped over their locations!