Bmp280 random temperature spikes


Both my bmp280 sensors started to output random 100+ Celsius temperature spikes lately. Looks to me like an anomaly in reading. Could anyone point me in the right direction? Is this faulty hardware? Or misconfiguration? Not sure how to debug this.

Would appreciate any feedback.

This is my yaml:

# Needed config for i2c bus to work
  sda: 21
  scl: 22
  scan: true
  frequency: 400kHz #TMP117, BH1750 support max 400kHz (Fast Mode); BMP280, SHT4x are capable more. There is a known issue with SSD1306 displays where the Auth Expired message appears and the board is unable to connect to the wifi, setting the frequency to 800kHz seconds will remedy this. ->

# Sensor settings
  - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
    name: "WiFi Signal dB"
    id: wifi_signal_db
    update_interval: 1min
    entity_category: "diagnostic"

  - platform: bmp280
      name: "Temperature Pantry"
      id: temperature_pantry #id of the sensor reading
      oversampling: 8x
#        - offset: -1.8
#        - multiply: 0.95
    address: 0x77
    iir_filter: 4x
    update_interval: 1min

  - platform: bmp280
      name: "Temperature Outside"
      id: temperature_outside #id of the sensor reading
      oversampling: 8x
#        - offset: -1.8
#        - multiply: 0.95
      name: "Pressure Outside"
      id: pressure_outside
      oversampling: 16x
    address: 0x76
    iir_filter: 4x
    update_interval: 1min

Interferences? Long wiring?

1 Like

Power supply?
You should track down the actual problem, but you can use a filter to just ignore spikes in the mean time.
I believe filters are available as lamda’s in espHome and they are available in HA on the sensor created.

1 Like

@Karosm thank you. One wire is cca 2m the other 0.1m. Since both sensors are reporting anomalies and it only started lately (haven’t made any hardware changes.), I ruled this out for now.
I thought of interference (moisture), especially the sensor which is outside. But not sure why the Pantry (inside) sensor would also report anomalies.
Can it be the proximity of the access point? The ESP is 10cm away.
What else could interfere?

@Sir_Goodenough thank you! I thought of power issues, but simulating power outages would just give a reporting gap in the histogram, so I am not sure it’s that. I noticed that some of the pressure values are having anomalies at the exact times, but not all, so I am lost even further now.
Thank you for the idea for filtering, I could try using the clamp filter. it’s a quick fix at least.

Can an IIR filter or the wrong IIR multiplier produce this?

End of the day I will start changing hardware (esp module, sensors, wiring) if nothing else works.

Thank you!

Try reducing i2c frequency down to 50 khz

1 Like

Quite long for I2C…
Also nice antenna for interferences

-shorter wiring, shielded wiring
-soldered connections (do you get spikes if you touch the wires?)
-reduce speed
If nothing helps, filter out those spikes in your esphome yaml

    - clamp:
        min_value: 10
        max_value: 75
        ignore_out_of_range: true
1 Like

Shielding sounds more expensive. What about a twisted pair of the SDA and GND wire.

I often use leftover alarm system wire, sometimes some spare stp ethernet cables, both are twisted and shielded. Never bought for purpose.

I guess many of us do have spare bits of ethernet cable lying about. I built several antennas for 433mhz out of them after stripping wires out. I found even few cm long wires useful in esp32 projects.

You almost can’t avoid accumulating those in your house :grinning:

Anyway, to do it properly one should ground that shielding on ESP end

oh ok. Nothing happens when I touch the wires or around Dupont connectors. I used two pairs of UTP cables however, for the sensor going outside. But the short wired Pantry sensor is also reporting spikes (albeit only one so far). Not sure if it is really the cables, but I will consider using a STF. Or can the interference from the longer cable spill to the other sensor?

This is the crude setup. UTP cable going outside, you can also see the inside Pantry bmp280 and a splitter before going to the esp module:

Thank you very much for the ideas, I’ll report back. I’ll test one idea at a time, it might take some days. But would be nice to know what is happening, before applying the filter.

We live in an elecromagnetic soup. I made the mistake of once having a switch to a light on a pair of 10cm cables without the pullup resistor. Instant disco strobe lights

I understand this is the only way a stp cable would live to it’s purpose, by actually grounding it to the ground. I did that for one stp in the same room so I have a ground to connect too. :sweat_smile:

Not necessarily easy task. If it wasn’t the fact that it was working before, I would just tell you shorten your wiring and lowering speed . With 2meters you are crudely out of original I2C design (30cm).
Any changes in ambient that can give interferences? Any power supply changes of your Esp?

You mean earthing it?
You can just connect it to GND at supply end.
If you have curiosity enough about signal wiring, have a look at page 54.

1 Like

Accoring to your yaml, you use a single I²C bus.
So if an electrical disturbance occurs on the longest cable, it will be present on the bus and could also disrupt the sensor connected to the short cable.

Reducing the I²C frequency is free and easy.
And unless 400KHz is needed, that’s always a good idea.

What’s happening electrically?

80cm I²C bus with unshielded wires, 2 devices connected to an ESP32, 50KHz default ESPHome frequency

80cm I²C bus with unshielded wires, 2 devices connected to an ESP32, 100KHz

80cm I²C bus with unshielded wires, 2 devices connected to an ESP32, 400KHz

80cm I²C bus with unshielded wires, 2 devices connected to an ESP32, 800KHz

200cm I²C bus with unshielded wires, 2 devices connected to an ESP32, 800KHz

despite the awfull rising times and a quite high noise level, it works flawlessly on my table, even with 2 meters. But the I²C transceiver of the bmp280 may be weaker, or your environment more disturbed.


No changes. There is a solar inverter and a small breaker box in the same room, but that was there from the start.

Even thermal expansion/shrinkage in the little board could cause problems with solder contacts.

1 Like

Thank you I had a look.
Currently my twisted pairs are:

So if I understand this right I could minimize interference by pairing:

Basically pairing i2c busses with ground?

Earthing, sorry. I use the same term for both. So connecting to the esp GND would be enough? The ACDC power supply does not have a GND pin.

Thank you for pointing this out and a test kind sir! In this case it’s really probably wrong wiring/ interference.

Any point using IIR filters to lower this noise you mention?

1 Like