diff --git a/CHANGELOG.md b/CHANGELOG.md index 123f9f7..28cb959 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/DHT20.cpp b/DHT20.cpp index e953918..101f82b 100644 --- a/DHT20.cpp +++ b/DHT20.cpp @@ -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. diff --git a/DHT20.h b/DHT20.h index baa5f7f..cbdd840 100644 --- a/DHT20.h +++ b/DHT20.h @@ -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 diff --git a/LICENSE b/LICENSE index 7ff5257..3f2859b 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index a3516f7..5d556e0 100644 --- a/README.md +++ b/README.md @@ -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, - diff --git a/examples/DHT20/DHT20.ino b/examples/DHT20/DHT20.ino index 28388a8..de1a1a8 100644 --- a/examples/DHT20/DHT20.ino +++ b/examples/DHT20/DHT20.ino @@ -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); diff --git a/examples/DHT20_I2C_speed/DHT20_I2C_speed.ino b/examples/DHT20_I2C_speed/DHT20_I2C_speed.ino index 26cd077..23dba0c 100644 --- a/examples/DHT20_I2C_speed/DHT20_I2C_speed.ino +++ b/examples/DHT20_I2C_speed/DHT20_I2C_speed.ino @@ -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"); diff --git a/examples/DHT20_async/DHT20_async.ino b/examples/DHT20_async/DHT20_async.ino index c197c43..f26b5e6 100644 --- a/examples/DHT20_async/DHT20_async.ino +++ b/examples/DHT20_async/DHT20_async.ino @@ -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); diff --git a/examples/DHT20_lcd/DHT20_lcd.ino b/examples/DHT20_lcd/DHT20_lcd.ino index 0cc712d..96b2bc3 100644 --- a/examples/DHT20_lcd/DHT20_lcd.ino +++ b/examples/DHT20_lcd/DHT20_lcd.ino @@ -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 // diff --git a/examples/DHT20_offset/DHT20_offset.ino b/examples/DHT20_offset/DHT20_offset.ino index 3d30ca5..859255e 100644 --- a/examples/DHT20_offset/DHT20_offset.ino +++ b/examples/DHT20_offset/DHT20_offset.ino @@ -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 // diff --git a/examples/DHT20_plotter/DHT20_plotter.ino b/examples/DHT20_plotter/DHT20_plotter.ino index c0adbfe..d1414f2 100644 --- a/examples/DHT20_plotter/DHT20_plotter.ino +++ b/examples/DHT20_plotter/DHT20_plotter.ino @@ -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 // diff --git a/examples/DHT20_read_status/DHT20_read_status.ino b/examples/DHT20_read_status/DHT20_read_status.ino index f751fd8..d1988b6 100644 --- a/examples/DHT20_read_status/DHT20_read_status.ino +++ b/examples/DHT20_read_status/DHT20_read_status.ino @@ -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); diff --git a/examples/DHT20_test_esp/DHT20_test_esp.ino b/examples/DHT20_test_esp/DHT20_test_esp.ino index d49d19d..6c9a4b5 100644 --- a/examples/DHT20_test_esp/DHT20_test_esp.ino +++ b/examples/DHT20_test_esp/DHT20_test_esp.ino @@ -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 // // +--------------+ diff --git a/examples/DHT20_test_rp2040/DHT20_test_rp2040.ino b/examples/DHT20_test_rp2040/DHT20_test_rp2040.ino index 9688687..2ad8698 100644 --- a/examples/DHT20_test_rp2040/DHT20_test_rp2040.ino +++ b/examples/DHT20_test_rp2040/DHT20_test_rp2040.ino @@ -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 // // +--------------+ diff --git a/library.json b/library.json index 2fce220..a8c51fd 100644 --- a/library.json +++ b/library.json @@ -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": "*", diff --git a/library.properties b/library.properties index 6ea1930..41aa1ef 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=DHT20 -version=0.3.0 +version=0.3.1 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for I2C DHT20 temperature and humidity sensor. diff --git a/test/unit_test_001.cpp b/test/unit_test_001.cpp index c6f8782..484233e 100644 --- a/test/unit_test_001.cpp +++ b/test/unit_test_001.cpp @@ -25,7 +25,6 @@ #include -#include "Wire.h" #include "DHT20.h"