AVR Mega/Tiny Series-0/1 TWI Master (Sensor: HYT271)

GermanFranz's picture
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0



This project contains all the code required for a simple interrupt- based TWI-Master implementation.
I2C slave of this example is a single HYT271 humidity / temperature sensor.

The timed subroutines (be part of the main program or a cyclic timer interrupt) must be called at a certain time interval: 
Sensor takes some wakeup and response time.  

Measurement cycle starts with MR measurement request command, via DF command new data (4 Bytes) will be fetched later.

For details have look the HYT271 datasheet.

Any communication errors will be 'quick and dirty' responded via TWI disable, then the user have to try new request cycle again.