I have the adafruit mpr121 breakout hooked up to a seed and I wanted to see the raw or filtered data stream from the mpr121 so that I could understand what to set the thresholds to. I’m using the libraries function as such:
But the debug output is only 1 or 0 depending on if I’ve touched the capacitive pin. This does not seem like the filtered data as that function returns a 10-bit unsigned value. So it seems it should be outputting larger numbers.
Is this to be expected? How can I properly see the filtered data stream? Thanks
I haven’t tried MPR121 with Daisy, but I’d suggest reading the source code to see what to expect.
Edit: I’ve looked at the code, and I’ve looked at the mpr121 datasheet, this has got me curious. I have a MPR121 around here somewhere, maybe I can find it.
I’ll be curious too! I also noticed that adafruit’s arduino library is quite similar to libDaisy (perhaps even ported) and when they call their filtered data function it returns a stream of differing values corresponding to minor fluctuations in capacitive sensing.
I haven’t figured out WHY, but FilteredData(i) is returning the same value as Touched(), for all values of i.
I suspect register addressing isn’t working (at least on reads), and it’s only reading register 0, which is MPR121_TOUCHSTATUS_L.
This suspicion is supported by the following comment in mpr121.h:
// this doesn't work for some reason...
// uint8_t c = ReadRegister8(MPR121_CONFIG2);
I can’t tell if addressing works on writes, so I can’t be certain configuration is working at all. I wish I had a good I2C analyzer (for example - Total Phase Beagle I2C), like I used to have when I was working. Cost $400, but saved a ton of time.
Thank you for your analysis. Very helpful to me to know there is an issue with the library/hardware. I wonder how adafruit got it to work. It can’t be the differences between the Seed and an Arduino, I would think, as it all seems to be about the MPR121 registers.
Well we’ve got the issue cornered now! Its an ironic choice to have to go with a higher-level language to get lower-level features. I’ll open an issue on the repo and hopefully this gets fixed.