# aht20

> A Node.js library for reading temperature and humidity values over I2C from an AHT20

Latest version **1.0.0** (published 2024-03-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install aht20
pnpm add aht20
yarn add aht20
bun add aht20
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-03-04 |
| First published | 2024-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | OrangeJedi |
| Maintainers | orangejedi |
| Keywords | i2c, aht20, temperature, humidity, raspberry, pi |

## Links

- npm: https://www.npmjs.com/package/aht20
- Repository: https://github.com/OrangeJedi/AHT20
- Homepage: https://github.com/OrangeJedi/AHT20#readme
- Issues: https://github.com/OrangeJedi/AHT20/issues
- npm.io page: https://npm.io/package/aht20

## Dependencies (1)

- [i2c-bus](https://npm.io/package/i2c-bus.md) ^5.2.3

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2024-03-04

## README

# AHT20
A Node.js library for reading temperature and humidity values over I2C from an AHT20

## Installation 

`npm install aht20`

The only dependency is `i2c-bus` and this package will work on any Linux board compatible with the library.
[See the library for more details.](https://www.npmjs.com/package/i2c-bus?activeTab=readme#installation) 

Tested on a Raspberry Pi 3B.

## Usage

```javascript
const AHT20 = require( "aht20" );

const sensor = new AHT20(1);
sensor.readData().then( data => console.log( data ) );
```
Running the above code will use I2C bus 1 to read the temperature and humidity from a connected AHT20.
The output is the temperature in Celsius and the humidity as a percentage and looks something like this:
```json
{ 
    "humidity": 16.15, 
    "temperature": 23.96 
}
```
You can pass in different bus by changing the number in the constructor or passing in an `i2c-bus` bus object. 
See the API or example folder for more details.

See the [`i2c-bus` README](https://www.npmjs.com/package/i2c-bus) or look online for wiring.

## API

All functionality is through the AHT20 Class. See [`./examples`](./examples) for usage.

### new AHT20(bus, address)
* bus - a number or I2C Bus
* address - optional, defaults to `0x38` - the address of the AHT20

Returns a new AHT20 object.

### readData()

An asynchronous function that returns the temperature (Celsius) and humidity (%) date from the sensor.

### reset()

An asynchronous function that resets the sensor.

## Author & License

© 2024 OrangeJedi. Released under the MIT License.

---
_Source: https://npm.io/package/aht20 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
