Temperature + humidity AHT20 with TinkerPie
Small, fast and accurate. Also fits AHT10 and AHT21.
| Type | Smart sensors (I2C) |
|---|---|
| Connect to | SENSOR port · 0x38 |
| Gives | °C and % RH |
| Simulator | Yes: a control appears under the simulated board |
How it works
The AHT20 has a tiny chip that measures temperature and the amount of water vapour in the air (relative humidity). It does the maths itself and sends finished readings over I2C (address 0x38).
How to wire it
Plug into any SENSOR 1-4 port (SDA, SCL, 3.3 V, GND). Each type has a fixed I2C address, so different types can share the bus.
Code
In blocks: Accessories category in TinkerPie Studio. As code:
// JavaScript
sensors.ahtTemperature()
sensors.ahtHumidity()
// Arduino C++
sensors::ahtTemperature()
sensors::ahtHumidity() Good to know
- Typical accuracy: about ±0.3 °C and ±2 % RH.
- Works from 2.0 to 5.5 V.
- Keep it away from the board and the sun so it measures the air, not the heat of the electronics.
Projects with the Temperature + humidity AHT20
Similar modules
- Light meter BH1750
- Temperature + humidity SHT31
- Motion sensor MPU6050
- Colour sensor TCS34725
- IR thermometer MLX90614
- Real-time clock DS3231
- 4-channel ADC ADS1115
- Current + voltage sensor INA219
Questions
Can I try the Temperature + humidity AHT20 without buying one?
Yes. In TinkerPie Studio the simulator shows a control for it under the board, so you can test your program before you build it.
Is the AHT20 better than the DHT11?
Yes: it is more accurate, faster and uses I2C, so it does not need special timing. The DHT11 is cheaper and fine for first projects.