ATtiny – I2C ondersteuning

Standaard bied de ATtiny 25/45/85 geen I2C ondersteuning, sensoren met dit protocol woorden niet ondersteunt, echter is daar een oplossing voor…de ATtiny heeft een Universal Serial Interface (USI), welke softwarematig kan worden gemanipuleerd om toch I2C ondersteuning te bieden.

Een bekende bibliotheek voor I2C ondersteuning voor ATtiny is: TinyWire

Informatie (eng):
TinyWire is an Arduino library, that provides I2C support for ATtiny micro controllers.

ATtiny micro controllers don’t have built in support for I2C or SPI, instead they have only a Universal Serial Interface (USI). This library uses that to provide I2C support for ATtiny micro controllers.

Let wel: de bibliotheek gebruikt vaste GPIO pinnen (dmv USI):

TinyWireM:
– ATtiny Pin 5 = SDA (data)
– ATtiny Pin 7 = SCK (clock)


Er zijn meerdere versies van “een TinyWire” bibliotheek in omloop, eentje daarvan is hier te vinden: https://github.com/sudar/TinyWire