SENSOR-H

We use humidity sensor dht11 temperature chip:
Detail information about  you can find here => DHT11


Attiny85
We use Atmel Attiny85 chip to communicate with Raspberry Pi using I2C bus. Attiny85 is a slave device in I2C bus with address 0x22. Attiny85 communicate with dht11 using only one PIN PB1 - DATA. DHT11 need special protocol described in datasheet.








 Final sensorH with case:


void humidity()
{
bcm2835_i2c_setSlaveAddress(0x16);
uint8_t buf[]={0x16,0x00};
uint8_t data,humtemp;
data = bcm2835_i2c_read(buf, 1);
if (buf[0]==255)
{
   buf[0]=34;
}
humi=buf[0];
if(data==1)
{
printf("U;",buf[0]);
}else{
printf("%d;",buf[0]);
}
}

1 comment: