0.3.1 DHT20

This commit is contained in:
Rob Tillaart 2024-01-26 13:10:13 +01:00
parent 68b76c7bdc
commit aa8b2bed0f
17 changed files with 56 additions and 17 deletions

View File

@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.1] - 2024-01-26
- update readme.md
- update examples
## [0.3.0] - 2023-10-25
- simplify begin()
- updated all examples

View File

@ -1,7 +1,7 @@
//
// FILE: DHT20.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.3.0
// VERSION: 0.3.1
// PURPOSE: Arduino library for DHT20 I2C temperature and humidity sensor.

View File

@ -3,7 +3,7 @@
// FILE: DHT20.h
// AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for DHT20 I2C temperature and humidity sensor.
// VERSION: 0.3.0
// VERSION: 0.3.1
// URL: https://github.com/RobTillaart/DHT20
//
@ -20,7 +20,7 @@
#include "Arduino.h"
#include "Wire.h"
#define DHT20_LIB_VERSION (F("0.3.0"))
#define DHT20_LIB_VERSION (F("0.3.1"))
#define DHT20_OK 0
#define DHT20_ERROR_CHECKSUM -10

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022-2023 Rob Tillaart
Copyright (c) 2022-2024 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -21,8 +21,7 @@ The DHT20 is a humidity and temperature sensor.
The sensor has a fixed address of **0x38**.
It is not known if the address can be changed.
The library must be initiated by calling the **begin()** function,
or **begin(dataPin, clockPin)** for **ESP32** and similar platforms.
The library must be initiated by calling the **begin()** function.
Thereafter one has to call the **read()** function to do the actual reading,
and call **getTemperature()** and **getHumidity()** to get the measured values.
@ -55,10 +54,14 @@ reset the sensor if needed in both synchronous and asynchronous calls.
This keeps the API simple. The reads are 1-2 ms slower than 0.1.4. (< 50 ms).
Still far below the 80 ms mentioned in the datasheet.
### 0.3.0
User should call Wire.begin(), and setting I2C pins himself.
It is removed from the specific ESP32 begin() call to be more generic.
#### 0.3.0 Breaking change
Version 0.3.0 introduced a breaking change.
You cannot set the pins in **begin()** any more.
This reduces the dependency of processor dependent Wire implementations.
The user has to call **Wire.begin()** and can optionally set the Wire pins
before calling **begin()**.
#### Tested
@ -75,6 +78,24 @@ The sensor has a fixed address of **0x38**.
It is not known if the address can be changed.
#### I2C multiplexing
Sometimes you need to control more devices than possible with the default
address range the device provides.
This is possible with an I2C multiplexer e.g. TCA9548 which creates up
to eight channels (think of it as I2C subnets) which can use the complete
address range of the device.
Drawback of using a multiplexer is that it takes more administration in
your code e.g. which device is on which channel.
This will slow down the access, which must be taken into account when
deciding which devices are on which channel.
Also note that switching between channels will slow down other devices
too if they are behind the multiplexer.
- https://github.com/RobTillaart/TCA9548
#### Connection
Always check datasheet!
@ -148,7 +169,8 @@ and should only be used if you are in a need for speed.
#### Constructor
- **DHT20(TwoWire \*wire = &Wire)** constructor, using a specific Wire (I2C bus).
- **bool begin()** initializer for non ESP32. Returns true if connected.
- **bool begin()** initializer. Returns true if connected.
The user must call **Wire.begin()** before calling this function.
- **bool isConnected()** returns true if the address of the DHT20 can be seen on the I2C bus.
- **uint8_t getAddress()** returns the (fixed) address - convenience.
@ -251,6 +273,8 @@ the read calls. (0.2.0)
#### Must
- improve documentation.
- sync AM2315C developments
- see https://github.com/RobTillaart/AM2315C
- investigate the bug from #8 further
(is done in 0.2.1 see issue #8)
@ -284,4 +308,3 @@ donate through PayPal or GitHub sponsors.
Thank you,

View File

@ -2,6 +2,7 @@
// FILE: DHT20.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//
@ -19,6 +20,7 @@ DHT20 DHT;
uint8_t count = 0;
void setup()
{
Serial.begin(115200);

View File

@ -2,6 +2,7 @@
// FILE: DHT20_I2C_speed.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//
@ -14,12 +15,14 @@
// NOTE datasheet states 400 KHz as maximum
#include "DHT20.h"
DHT20 DHT;
uint32_t start, stop;
void setup()
{
Serial.begin(115200);
@ -58,7 +61,7 @@ void setup()
Serial.print(speed);
Serial.print("\t");
Serial.print(stop - start); // time
Serial.print(stop - start); // time
Serial.print("\t");
Serial.print(DHT.getHumidity(), 1);
Serial.print("\t");

View File

@ -2,6 +2,7 @@
// FILE: DHT20_async.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//
@ -19,6 +20,7 @@ DHT20 DHT;
uint32_t counter = 0;
void setup()
{
Serial.begin(115200);

View File

@ -2,6 +2,7 @@
// FILE: DHT20_lcd.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//

View File

@ -2,6 +2,7 @@
// FILE: DHT20_offset.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//

View File

@ -2,6 +2,7 @@
// FILE: DHT20_plotter.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//

View File

@ -2,6 +2,7 @@
// FILE: DHT20_read_status.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//
@ -19,6 +20,7 @@ DHT20 DHT;
uint8_t count = 0;
void setup()
{
Serial.begin(115200);

View File

@ -2,8 +2,8 @@
// FILE: DHT20_test_esp.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//
// +--------------+

View File

@ -2,8 +2,8 @@
// FILE: DHT20_test_rp2040.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
// URL: https://github.com/RobTillaart/DHT20
//
// Always check datasheet - front view
//
// +--------------+

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/DHT20.git"
},
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=DHT20
version=0.3.0
version=0.3.1
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for I2C DHT20 temperature and humidity sensor.

View File

@ -25,7 +25,6 @@
#include <ArduinoUnitTests.h>
#include "Wire.h"
#include "DHT20.h"