QMC5883L magnetometer: too slow output rate for given oversampling

Hi, I have a board with a QMC5883L connected to an ESP-12e and I set it to

oversampling: 512x
update_interval: 1s

No processing or publishing of any kind is done, only (automatic) logging to the console, when I connect to the device to see the logs.

Well it doesn’t comply with my request, I get a values surely less than once per second.

If I reduce to oversampling 128x, the values appear as expected once per second.

In principle, oversampling rate is tied to refresh, since the device (https://datasheet.lcsc.com/lcsc/QST-QMC5883L-TR_C192585.pdf) can do:
512x = 10 Hz
256x = 50 Hz
128x = 100 Hz
64x = 200 Hz

So why am I not getting 1 log entry per second when using 512x?

I’m really guessing here, but maybe only one oversample sensor reading can happen per esphome loop (~ 16ms ).

So maybe to oversample at 512 your update interval would been need to be about 9sec.

I think the oversampling is done in hardware, not in esphome, since it’s mentioned in the datasheet and it has a register value for setting it up, which would make no sense if it were done by esphome in software.

But thanks for trying :slight_smile:

I hope we find out the cause of the issue! I dint want to program the device in Arduino to get the readings as expected :frowning:

1 Like

I switched back to 512x while keeping 1s sampling rate and apparently it works as expected. I tried 0.1s as well, still 512x, and it works.

I guess there was a mismatch between the source code I was seeing and the binaries loaded into the device, set to 5s sampling rate.

All fine, no issues then.

1 Like