STHS34PF8 readings slowly increasing in sunlight

Hello all,

I am using a STHS34PF8 presence sensor as a part of a project of mine, and when I leave it outside in the sun, it will work fine for a while, maybe between 10-20 minutes, but it sometimes the presence values will slowly increase, up to values of 3000 over the course of 1 or 2 minutes, which messes everything up.

Anyone know what might be causing this? My guess is that either the sensor or the the arduino (ESP32-S3 chip) could be overheating in the sunlight, but I want to know if anyone else has had a similar problem.

Thank you.

Sensors typically have a temperature range in which they operate optimally, and direct sunlight could push the temperature beyond this range.

Page 6 and several others in the datasheet might be useful here; it looks like you’d need to let it heat up first then power it on, as the shifting ambient temp will spread the delta across a weird range and you’ll end up with funky values

You might be able to implement some code that uses the temp ambient shock high register in the code and adjusts gain/filters accordingly