Comments (7)
Does the same error occur with the official samples, e.g. sht-autodetect
? I'd start there as a baseline, and then enable the second sensor support line by line.
One thing that I would recommend is checking the return values for the calls to init()
to make sure the sensors were properly detected, although the library should be robust enough to handle this without causing bootloops.
from arduino-sht.
Hi winkj
sht-autodetect does not cause bootloop but will return "error in readsample" regardless of 1 or 2 sensors.
sht-multiple-sht-sensor will return "error in readsample 2" if only 1 sensor is plugged in. And error in readsample when both sensors are plugged in.
The multiple-sht-sensor has a comment regarding address pins. However, the SHT-85 only has 4 pins, no separate address pin.
// Sensor 1 with address pin pulled to GND
// Sensor 2 with address pin pulled to Vdd
I will try with the auto-detect line by line but is it even worth moving forward if no sensors are being auto-detected?
Thanks
from arduino-sht.
I will try with the auto-detect line by line but is it even worth moving forward if no sensors are being auto-detected?
Just to be sure, did you adjust the Wire configuration for the sht-autodetect
sample?
Since all the readSamples seem to fail here, I personally would try first with a simple I2C scanner, like shown here: https://playground.arduino.cc/Main/I2cScanner/. Of course, you may have to adjust the pins to the bus you're using. I'd focus on one I2C bus first, and make sure that the sensor is being discovered properly. This should rule out any wiring issues. If this is working, we can move on to troubleshoot the library.
The address of the SHT85 is going to be fixed at the default (0x44), so you shouldn't have to do do any additional configuration for that.
from arduino-sht.
Hi winkj
Sorry, Just tested again with sht-autodetect sample to verify.
With just a single sensor it is in fact showing sensor readings.
If multiple sensors are plugged in to the same i2c bus then "error in readsample" occurs.
I will modify the wire configuration and see if it provides a reading on 2 separate i2c buses as well as the i2c scanner if it fails.
Thanks
from arduino-sht.
Glad to hear, and keep us posted once you get it to work.
It may make sense to try the second bus on it's own first, too - i.e. make sure that both sensors work individually, then move on to running them at the same time.
from arduino-sht.
Hi winkj
Got it working with the following code:
SHT-85 x 2
NodeMCU-32s
Thanks for your support.
#include <Wire.h>
#include <SHTSensor.h>
#define I2C2_SDA 4
#define I2C2_SCL 5
SHTSensor sht1;
SHTSensor sht2;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Wire.begin();
Wire1.begin(I2C2_SDA, I2C2_SCL);
Wire.setClock(100000);
delay(1000); // let serial console settle
if (sht1.init()) {
Serial.print("init(): success\n");
} else {
Serial.print("init(): failed\n");
}
if (sht2.init(Wire1)) {
Serial.print("init(): success\n");
} else {
Serial.print("init(): failed\n");
}
}
void loop() {
// put your main code here, to run repeatedly:
if (sht1.readSample()) {
Serial.print("Bottom:\n");
Serial.print(" RH: ");
Serial.print(sht1.getHumidity(), 1);
Serial.print("\n");
Serial.print(" T: ");
Serial.print(sht1.getTemperature(), 1);
Serial.print("\n");
} else {
Serial.print("Error in readSample1()\n");
}
if (sht2.readSample()) {
Serial.print("Top:\n");
Serial.print(" RH: ");
Serial.print(sht2.getHumidity(), 1);
Serial.print("\n");
Serial.print(" T: ");
Serial.print(sht2.getTemperature(), 1);
Serial.print("\n");
} else {
Serial.print("Error in readSample2()\n");
}
delay(5000);
}
from arduino-sht.
Awesome, thanks for reporting back. We have a todo item to add a sample for multiple sensors to this library.
from arduino-sht.
Related Issues (17)
- I2C communication without clock stretching HOT 3
- All examples generate a compile error HOT 1
- Can't able to download Sensirion library in arduino HOT 1
- Unstable readings on the SHT85 sensor HOT 8
- SHT85 library for Particle Argon HOT 2
- [remove Compiler Warning]: caused by unused Variable in SHTSensor.h HOT 11
- Add type for SHTC3 HOT 2
- [Problem]: sht31D not updated regularly when used on Arduino nano HOT 2
- connect sensor to 2nd I2C bus HOT 4
- Allow choice of Wire, Wire1, Wire2 to use different wire (like Teensy 4.1) HOT 1
- First Reading "High" with autodetect example using SHT4x HOT 7
- Heater on SHT4x / SHT85 and status register on SHT48? HOT 1
- No response from SHT85 HOT 1
- Turn off the heater on the SHT40 HOT 7
- SHT40 Raspberry Pi Pico Arduino Earle Phillhower HOT 4
- Error compiling in SparkFun ESP32 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-sht.