BME680 breakout - negative ohms on gas sensor?


#1

Have done the 20 minute burn in (did it for 30 using the read_all script) and then ran read all again, when I put a marker near the sensor the ohm values start to change then go negative!

Then tested with the air quality script and some of the output is pasted below. Either I have really really bad pirate grog breath or something isnt quite right. Would really appreciate some pointers. Connected to Pi Zero W and using the Pimoroni GitHub example scripts.

Gas: 131858.00 Ohms,humidity: 37.46 %RH,air quality: 98.34
Gas: 129573.00 Ohms,humidity: 37.47 %RH,air quality: 97.04
Gas: 129573.00 Ohms,humidity: 37.47 %RH,air quality: 97.05
Gas: 128828.00 Ohms,humidity: 37.53 %RH,air quality: 96.66
Gas: 127546.00 Ohms,humidity: 37.59 %RH,air quality: 95.97
Gas: 127365.00 Ohms,humidity: 37.63 %RH,air quality: 95.89
Gas: 124883.00 Ohms,humidity: 37.66 %RH,air quality: 94.50
Gas: 122999.00 Ohms,humidity: 37.68 %RH,air quality: 93.44
Gas: 123848.00 Ohms,humidity: 37.69 %RH,air quality: 93.93
Gas: 122328.00 Ohms,humidity: 37.69 %RH,air quality: 93.07
Gas: 123678.00 Ohms,humidity: 37.71 %RH,air quality: 93.85
Gas: 120359.00 Ohms,humidity: 37.75 %RH,air quality: 91.98
Gas: 120037.00 Ohms,humidity: 37.75 %RH,air quality: 91.80
Gas: 119398.00 Ohms,humidity: 37.75 %RH,air quality: 91.44
Gas: 120198.00 Ohms,humidity: 37.75 %RH,air quality: 91.90
Gas: 118923.00 Ohms,humidity: 37.75 %RH,air quality: 91.17
Gas: 118766.00 Ohms,humidity: 37.72 %RH,air quality: 91.06
Gas: 118766.00 Ohms,humidity: 37.71 %RH,air quality: 91.06
Gas: 118296.00 Ohms,humidity: 37.69 %RH,air quality: 90.77
Gas: 110979.00 Ohms,humidity: 37.74 %RH,air quality: 86.65
Gas: -1425780.00 Ohms,humidity: 37.93 %RH,air quality: -786.47
Gas: 1382577.00 Ohms,humidity: 38.25 %RH,air quality: 98.91
Gas: 556403.00 Ohms,humidity: 38.62 %RH,air quality: 99.14
Gas: 414773.00 Ohms,humidity: 38.97 %RH,air quality: 99.36
Gas: 348282.00 Ohms,humidity: 39.21 %RH,air quality: 99.51
Gas: 314655.00 Ohms,humidity: 39.37 %RH,air quality: 99.61
Gas: 292468.00 Ohms,humidity: 39.43 %RH,air quality: 99.64
Gas: 298203.00 Ohms,humidity: 39.41 %RH,air quality: 99.63
Gas: 323582.00 Ohms,humidity: 39.33 %RH,air quality: 99.58
Gas: 353682.00 Ohms,humidity: 39.21 %RH,air quality: 99.51
Gas: 377066.00 Ohms,humidity: 39.11 %RH,air quality: 99.44
Gas: 418578.00 Ohms,humidity: 38.99 %RH,air quality: 99.37
Gas: 495924.00 Ohms,humidity: 38.88 %RH,air quality: 99.30
Gas: 495924.00 Ohms,humidity: 38.75 %RH,air quality: 99.22
Gas: 592533.00 Ohms,humidity: 38.63 %RH,air quality: 99.14
Gas: 608334.00 Ohms,humidity: 38.54 %RH,air quality: 99.09
Gas: 724207.00 Ohms,humidity: 38.45 %RH,air quality: 99.03
Gas: 800439.00 Ohms,humidity: 38.38 %RH,air quality: 98.99
Gas: 950521.00 Ohms,humidity: 38.30 %RH,air quality: 98.94
Gas: 1061047.00 Ohms,humidity: 38.25 %RH,air quality: 98.91
Gas: 1200659.00 Ohms,humidity: 38.19 %RH,air quality: 98.87
Gas: 1267362.00 Ohms,humidity: 38.14 %RH,air quality: 98.84
Gas: 1382577.00 Ohms,humidity: 38.09 %RH,air quality: 98.81
Gas: 1629466.00 Ohms,humidity: 38.07 %RH,air quality: 98.79
Gas: 3258935.00 Ohms,humidity: 38.04 %RH,air quality: 98.78
Gas: 3509623.00 Ohms,humidity: 38.01 %RH,air quality: 98.76
Gas: 3509623.00 Ohms,humidity: 37.99 %RH,air quality: 98.74
Gas: 4147738.00 Ohms,humidity: 37.98 %RH,air quality: 98.74
Gas: 11406336.00 Ohms,humidity: 37.98 %RH,air quality: 98.74
Gas: -11406162.00 Ohms,humidity: 37.98 %RH,air quality: -6457.61
Gas: -7604127.00 Ohms,humidity: 37.99 %RH,air quality: -4297.17
Gas: -3802073.00 Ohms,humidity: 38.01 %RH,air quality: -2136.71
Gas: -2683818.00 Ohms,humidity: 38.01 %RH,air quality: -1501.28
Gas: -2172616.00 Ohms,humidity: 38.01 %RH,air quality: -1210.79
Gas: -1520832.00 Ohms,humidity: 38.02 %RH,air quality: -840.42
Gas: -1267360.00 Ohms,humidity: 38.00 %RH,air quality: -696.40
Gas: -1036931.00 Ohms,humidity: 37.99 %RH,air quality: -565.47
Gas: -1112804.00 Ohms,humidity: 37.94 %RH,air quality: -608.62
Gas: -1061046.00 Ohms,humidity: 37.91 %RH,air quality: -579.23
Gas: -950520.00 Ohms,humidity: 37.89 %RH,air quality: -516.44
Gas: -877403.00 Ohms,humidity: 37.88 %RH,air quality: -474.90
Gas: -829545.00 Ohms,humidity: 37.85 %RH,air quality: -447.72
Gas: -786637.00 Ohms,humidity: 37.84 %RH,air quality: -423.35
Gas: -747950.00 Ohms,humidity: 37.82 %RH,air quality: -401.37
Gas: -661232.00 Ohms,humidity: 37.80 %RH,air quality: -352.11
Gas: -712890.00 Ohms,humidity: 37.76 %RH,air quality: -381.49
Gas: -773305.00 Ohms,humidity: 37.81 %RH,air quality: -415.79
Gas: -651785.00 Ohms,humidity: 37.91 %RH,air quality: -346.67
Gas: -600329.00 Ohms,humidity: 38.00 %RH,air quality: -317.37
Gas: -592532.00 Ohms,humidity: 38.03 %RH,air quality: -312.92
Gas: 110432.00 Ohms,humidity: 38.02 %RH,air quality: 86.51
Gas: 110841.00 Ohms,humidity: 37.99 %RH,air quality: 86.73
Gas: 111948.00 Ohms,humidity: 37.96 %RH,air quality: 87.34
Gas: 114814.00 Ohms,humidity: 37.91 %RH,air quality: 88.94
Gas: 114520.00 Ohms,humidity: 37.86 %RH,air quality: 88.74
Gas: 115404.00 Ohms,humidity: 37.78 %RH,air quality: 89.19
Gas: 114961.00 Ohms,humidity: 37.73 %RH,air quality: 88.90

Thanks,
Colin


#2

I just got a BME680 yesterday and I to am getting negative readings.I am using the indoor-air-quality.py script.
Can anyone help
Thanks,
Garry


#3

This may be related to Issue #6 on GitHub, see: https://github.com/pimoroni/bme680/issues/6

I believe the negative numbers are a result of a missing cast from uint64 to int32 which is present in the C equivalent library.

They don’t make especially great sense when casted to positive numbers, but they at least follow the sharp upward trend of the other datapoints.


#4

See my comment at https://github.com/pimoroni/bme680/issues/6 and related pull request from https://github.com/lowflyerUK/bme680.git

I have just got a BME680 and have seen these spikes. I think the problem is in line 328 of bme680/constants.py.

It is now:
self.range_sw_err = (sw_error * RSERROR_MSK) // 16

and should be:
self.range_sw_err = (sw_error & RSERROR_MSK) // 16

At least my results of calc_gas_res are much more consistent now!!


#5

lowflyerUK’s script change seems to have worked for me. Much less negative spikes now . But I am finding the temperature sensor to be a bit optimistic 5 degrees c higher than a ds18b20 sensor. Any ideas ?