Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

AHT21 I2C labview arduino

Hello everyone,

I'm having trouble with the Labview program. I am developing a code for reading the temperature and humidity of the air using a sensor AHT21 in the LABVIEW LINX module via I2C communication established between the sensor and the Arduino UNO board.

The program is running but it's reading constant values of T and H, even if I'm changing the environment (for example putting my hand in contact with the sensor).

Anyone can help me with my problem?

Thank you 

 

Download All
0 Kudos
Message 1 of 4
(1,273 Views)

Hey Gaialomb19, would you mind saving your VI in version 20? most people who can help won't be on the latest LV version.

 

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 2 of 4
(1,264 Views)

Hello  jorgemondadori

Thank you for the answer!

Here there is the file saved in version 20,

thank you 

0 Kudos
Message 3 of 4
(1,198 Views)

Hey! thanks for sending that file. 

 

i am not able to test it here because I do not have this sensor/module. however I can point out that you are not following manufacturer's instructions. Please read carefully sections 7.3 and 7.4 of datasheet.

Note that you should be also reading other registers.

 

7.4 Sensor Reading Process
1. After power-on, wait for ≥100ms. Before reading the temperature and humidity value, get a byte of status word
by sending 0x71. If the status word and 0x18 are not equal to 0x18, initialize the 0x1B, 0x1C, 0x1E registers,
details Please refer to our official website routine for the initialization process; if they are equal, proceed to the next
step.
2. Wait 10ms to send the 0xAC command (trigger measurement). This command parameter has two bytes, the first
byte is 0x33, and the second byte is 0x00.
3. Wait 80ms for the measurement to be completed, if the read status word Bit[7] is 0, it means the measurement
is completed, and then six bytes can be read continuously; otherwise, continue to wait.
4. After receiving six bytes, the next byte is CRC check data, which the user can read as needed. If the receiver
needs CRC check, it will send an ACK reply after receiving the sixth byte, otherwise it will send a NACK reply. The
initial value of CRC is 0xFF, and the CRC8 check polynomial is:
CRC [7:0] = 1+X4+X5+X8

 

After reading, you you carry on converting those values following section 8.

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 4 of 4
(1,154 Views)