I am busy tinkering around at the moment with using an ATTiny85 microcontroller to provide an analogue input to a Pi (the ultimate goal is to built a water level sensor for my rainwater tanks using a differential pressure sensor).
I am currently using I2C, but have been running into the issue that the Pi does not support I2C clock stretching, with the result that I am getting data corruption in some cases. What I have found is that what generally occurs is that bit 7 of the value I am reading gets zeroed. Given that I am reading a 10 bit ADC, a hack which greatly improves the quality of the data I get back is to split the way I store the value read from the sensor into 2 5 bit quantities rather than 8 and 2 - i.e. I can ignore bits 5, 6 and 7. (I am running the ATTiny at 8MHz - I haven't tried 16MHz yet as that will require running it at 5V, which will require level shifters on my I2C bus - I need to dig out some MOSFETs.)
What I was wondering was if anyone has a readily implementable better solution, especially an easily usable implementation of a SPI slave using USI. One of the reasons I haven't tried SPI yet is that I have been struggling to find an implementation that looks reasonably straight forward to use.
Any advice or suggestions would be appreciated.