|
|
|
|
@ -68,7 +68,7 @@ The sensor collects temperature and humidity data, sends it via the I2C Protocol
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Deployment Guide (From Scratch)
|
|
|
|
|
## Deployment Guide
|
|
|
|
|
|
|
|
|
|
### 1. Install Dependencies
|
|
|
|
|
|
|
|
|
|
@ -124,9 +124,48 @@ i2cdetect -y 1
|
|
|
|
|
Expected:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
0x40
|
|
|
|
|
Warning: Can't use SMBus Quick Write command, will skip some addresses
|
|
|
|
|
0 1 2 3 4 5 6 7 8 9 a b c d e f
|
|
|
|
|
00:
|
|
|
|
|
10:
|
|
|
|
|
20:
|
|
|
|
|
30: -- -- -- -- -- -- -- --
|
|
|
|
|
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
|
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
|
60:
|
|
|
|
|
70:
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This output indicates that the sensor is connected at address 0x40.
|
|
|
|
|
|
|
|
|
|
If the device is not detected and the output looks like this:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Warning: Can't use SMBus Quick Write command, will skip some addresses
|
|
|
|
|
|
|
|
|
|
0 1 2 3 4 5 6 7 8 9 a b c d e f
|
|
|
|
|
00:
|
|
|
|
|
10:
|
|
|
|
|
20:
|
|
|
|
|
30: -- -- -- -- -- -- -- --
|
|
|
|
|
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
|
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
|
60:
|
|
|
|
|
70:
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The sensor may still be connected. Some I2C devices do not respond to SMBus probing commands used by i2cdetect.
|
|
|
|
|
|
|
|
|
|
In this case, you can try to directly read from the device address.
|
|
|
|
|
|
|
|
|
|
To read the temperature, send the measurement command (0xE3 for hold mode or 0xF3 for no hold mode) and then read two bytes of data:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo i2cget -y 1 0x40 0xE3 w
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If you receive a hexadecimal value (e.g., 0x3871), the sensor is properly connected and working.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### 5. Compile the Sensor Program
|
|
|
|
|
|