Does somebody knows a working library to read temperature/humidity sensor AM2320 with ATTiny85.
I found on internet few Tiny-libraries, but non of them is working as it supposed to. I spend 2 days testing different libraries, but I can not adapt any of them to read this sensor. With Nano working without any problems almost immediately, with ATTiny85....doesn't. Help please. If somebody has working example..please.
Thank You!
p.p. I tested with TinyWireM; TinyI2CMaster
KrasiSoft:
p.p. I tested with TinyWireM; TinyI2CMaster
That sensor (better known as DHT22) has its own protocol, not using I2C. So using those libraries is a dead end for this sensor.
Start with the regular DHT22 libraries, read the code carefully, and find out where the incompatibilities are.
wvmarle:
That sensor (better known as DHT22) has its own protocol, not using I2C. So using those libraries is a dead end for this sensor.
Start with the regular DHT22 libraries, read the code carefully, and find out where the incompatibilities are.
Thank You for the answer, but your answer is half true mostly not true. It is true that DHT22 and AM2320 are almost the same, it is not true that DHT22 doesn't have real I2C protocol-IT DOES!!! The one who has not real I2C protocol is ATTiny85 (it has USI-protocol [Universal Serial Interface])and this is the main reason the standard library Wire.h is not working with ATTiny8x and this is the reason for building TinyWireM to overcome this inconvenience and simulate by software I2C protocol on ATTiny8x to USI - protocol. So using TinyWireM is not "dead end" after all! According to all i read it should work. I think is question of right timing. I will test again today with TiniWireM.
Thank You!
Mmm... It seems I mixed up the AM2302 with AM2320. You should've posted a link to the datasheet of your sensor, that always helps. In that case you should be able to just use the Wire library that comes with the ATTinyCore.
wvmarle:
Mmm... It seems I mixed up the AM2302 with AM2320. You should've posted a link to the datasheet of your sensor, that always helps. In that case you should be able to just use the Wire library that comes with the ATTinyCore.
Do You have link to this library or link to ATTinyCore which comes with this library?
It's part of the ATTinyCore which I may assume you have installed just to be able to work with the ATtiny85 in the Arduino IDE.
wvmarle:
It's part of the ATTinyCore which I may assume you have installed just to be able to work with the ATtiny85 in the Arduino IDE.
No! There is no library for I2C-protocol coming with the core.
Then it's not installed properly. It's really part of that core.
wvmarle:
Then it's not installed properly. It's really part of that core.
I see... I am not using this library because adds some extra length to program....Ver 1.2.0 was adding 1KB extra garbage to the code. I just installed the last version....it is much better, but still adding extra bytes to the code, and with ATTiny85 the programing space is too tight....The most optimized i found so far is the one of
David A. Mellis ver 1.0.2.
By the way, i succeeded to connect and read from AM2320 with TinyWireM.....My mistake was that i was trying to establish communication with CPU running on 16MHz, and it was written in the library that it works only on 8MHz, but some how, i missed it...But may be the limitation is in the sensor itself-i have OLED screen with I2C interface, wich is using the same TinyWireM library, and is communicating on 8 or 16MHz without any problems - that's why i did not paid attention for the frquency-if the screen is OK the sensor should be OK too...apparently NOT!