mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.0 SHT31_SW
This commit is contained in:
parent
9ec2de3b80
commit
25415adbeb
@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.3.0] - 2024-05-31
|
||||
- add buffers to SW I2C, see issue #12, should fix the SW I2C on AVR.
|
||||
- verified with SHT31 on AVR UNO
|
||||
- minor edits
|
||||
|
||||
----
|
||||
|
||||
## [0.2.0] - 2023-12-09
|
||||
- refactor API, follow SHT31
|
||||
|
||||
|
@ -34,10 +34,12 @@ devices on one Arduino.
|
||||
|
||||
The **SoftWire** library is portable, however it could not read (on AVR)
|
||||
the SHT85 sensor which is command compatible with the SHT3x.
|
||||
The cause is not found yet.
|
||||
Therefore a separate repo is created based upon the AVR specific **SoftwareWire**
|
||||
A fix has been made in 0.3.0 and works on AVR (UNO) with an SHT31.
|
||||
See #12. It still has to be verified with an SHT85.
|
||||
The solution was to add buffers for I2C.
|
||||
|
||||
A separate repo is created based upon the AVR specific **SoftwareWire**
|
||||
see links below.
|
||||
If you know a solution to get softWire working on AVR, please let me know.
|
||||
|
||||
The **SoftwareWire** library is an AVR specific and worked for the SHT85.
|
||||
See https://github.com/RobTillaart/SHT31_SW/issues/5
|
||||
@ -197,7 +199,8 @@ Returns false if reading fails or in case of a CRC failure.
|
||||
#### Should
|
||||
|
||||
- remove script for atomic if not needed any more.
|
||||
- investigate why SHT85 does not work with SoftWire.
|
||||
- verify SHT85 (as SHT31 works now).
|
||||
- make **isCOnnected()** more robust, it now only fails on missing CLOCK.
|
||||
|
||||
#### Could
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: SHT31_SW.cpp
|
||||
// AUTHOR: Rob Tillaart, Gunter Haug
|
||||
// VERSION: 0.2.0
|
||||
// VERSION: 0.3.0
|
||||
// DATE: 2019-02-08 (base SHT31 lib)
|
||||
// PURPOSE: Arduino library for the SHT31 temperature and humidity sensor
|
||||
// to be used with the SoftWire library instead of (hardware) Wire.
|
||||
@ -36,6 +36,9 @@ bool SHT31_SW::begin()
|
||||
return false;
|
||||
}
|
||||
_softWire->begin();
|
||||
// See #12
|
||||
_softWire->setTxBuffer(swTxBuffer, sizeof(swTxBuffer));
|
||||
_softWire->setRxBuffer(swRxBuffer, sizeof(swRxBuffer));
|
||||
return reset();
|
||||
}
|
||||
|
||||
@ -63,6 +66,7 @@ bool SHT31_SW::writeCmd(uint16_t cmd)
|
||||
_error = SHT31_ERR_WRITECMD;
|
||||
return false;
|
||||
}
|
||||
// delay(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: SHT31_SW.h
|
||||
// AUTHOR: Rob Tillaart, Gunter Haug
|
||||
// VERSION: 0.2.0
|
||||
// VERSION: 0.3.0
|
||||
// DATE: 2019-02-08 (base SHT31 lib)
|
||||
// PURPOSE: Arduino library for the SHT31 temperature and humidity sensor
|
||||
// to be used with the SoftWire library instead of (hardware) Wire.
|
||||
@ -12,7 +12,7 @@
|
||||
// https://github.com/RobTillaart/SHT31
|
||||
|
||||
|
||||
#define SHT31_SW_LIB_VERSION (F("0.2.0"))
|
||||
#define SHT31_SW_LIB_VERSION (F("0.3.0"))
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
@ -32,7 +32,11 @@ public:
|
||||
private:
|
||||
bool writeCmd(uint16_t cmd);
|
||||
bool readBytes(uint8_t n, uint8_t *val);
|
||||
|
||||
SoftWire* _softWire;
|
||||
|
||||
char swTxBuffer[8]; // see #12
|
||||
char swRxBuffer[8]; // see #12
|
||||
};
|
||||
|
||||
|
||||
|
@ -38,9 +38,9 @@ void setup()
|
||||
|
||||
void loop()
|
||||
{
|
||||
for (uint32_t I2Cfreq = 50000; I2Cfreq < 500000; I2Cfreq += 50000)
|
||||
for (uint32_t I2Cfreq = 50000; I2Cfreq <= 400000; I2Cfreq += 50000)
|
||||
{
|
||||
Serial.print(I2Cfreq/1000);
|
||||
Serial.print(I2Cfreq / 1000);
|
||||
sw.setClock(I2Cfreq);
|
||||
test();
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
|
||||
IDE: 1.8.19
|
||||
Board: AVR UNO - no speed gain above 300K
|
||||
|
||||
SHT31_LIB_VERSION: 0.3.0
|
||||
8010
|
||||
50 9912 19.6 64.4
|
||||
100 8892 19.5 64.4
|
||||
150 8488 19.6 64.3
|
||||
200 8300 19.6 64.4
|
||||
250 8284 19.5 64.4
|
||||
300 8088 19.6 64.5
|
||||
350 8092 19.6 64.4
|
||||
400 8088 19.6 64.5
|
||||
450 8088 19.6 64.4
|
||||
500 8088 19.6 64.4
|
||||
550 8092 19.6 64.5
|
||||
600 8088 19.6 64.4
|
||||
650 8088 19.5 64.4
|
||||
700 8092 19.7 64.4
|
||||
750 8088 19.5 64.4
|
||||
800 8096 19.5 64.4
|
@ -11,7 +11,9 @@
|
||||
#define SHT31_ADDRESS 0x44
|
||||
|
||||
|
||||
SoftWire sw(6, 7);
|
||||
// SoftWire sw(32, 33);
|
||||
// SoftWire sw(34, 35);
|
||||
SoftWire sw(6, 7); // sda, scl
|
||||
|
||||
uint32_t start;
|
||||
uint32_t stop;
|
||||
@ -52,7 +54,9 @@ void loop()
|
||||
Serial.print("\t");
|
||||
Serial.print(sht.getTemperature(), 1);
|
||||
Serial.print("\t");
|
||||
Serial.println(sht.getHumidity(), 1);
|
||||
Serial.print(sht.getHumidity(), 1);
|
||||
Serial.print("\t");
|
||||
Serial.println(sht.getError(), HEX);
|
||||
delay(3000);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo
|
||||
// URL: https://github.com/RobTillaart/SHT31_SW
|
||||
//
|
||||
// fails only when SCL line is disconnected.
|
||||
|
||||
|
||||
#include "SoftWire.h"
|
||||
@ -76,4 +78,3 @@ void loop()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// FILE: SHT31_async.ino
|
||||
// FILE: SHT31_rawValues.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo async interface
|
||||
// URL: https://github.com/RobTillaart/SHT31_SW
|
||||
@ -85,4 +85,3 @@ void loop()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
"version": "^1.1.2"
|
||||
}
|
||||
],
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=SHT31_SW
|
||||
version=0.2.0
|
||||
version=0.3.0
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>, Gunter Haug
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for the I2C SHT31 temperature and humidity sensor
|
||||
|
Loading…
x
Reference in New Issue
Block a user