I recently bought a SI7021 sensor (here).
But i can't get it to work.
The I2C scanner finds it tho.
I have tried the adafruit library and another (LowPowerLab). none of them worked.
I don't know if the sensor is defective or if I am using the wrong library?
Can the I2C Scanner find both sensors ? Then everything should be okay. On the back side are level shifters with pullup resistors and a voltage regulator, so the module is compatible with 5V and 3.3V Arduino boards.
Did you solder the pins to the module ?
Can you try the Adafruit library once more and also the Sparkfun library. Use an example from the library.
If something is not working, can you tell what the result is ?
It is possible that the I2C Scanner can find it, but when real data is transferred that the I2C bus fails. Do you use a breadboard ? They have often bad contacts. Jumper wires can be broken. Can you check if the GND is a good GND ?
You could let the I2C Scanner run for a long time, and meanwhile wiggle with wires.
Validate you have the correct part, many were sold with a different part. You can use a logic analyzer to follow the I2C and see if it fails. You can get a 24 MHz analyzer one from your favorite chins supplier for less then $10.00 US.
I had the same problem with my si7021s: they wouldn't report with instructions using the SHT11 library. The problem was solved to use "wire.h" and to address the si7021 directly. This works with Arduinos and ESP8266s.
For a detailed description of a si7021 humidity-temperature sensor / ESP8266 microcontroller (with sketch), see my post on thesolaruniverse.wordpress.com
they wouldn't report with instructions using the SHT11 library.
Are you saying that there is a problem with the libraries ? Do you have a clue what it might be ?
Are you willing to fix your code ?
You have now: if (condition) do nothing
The ; after the if is a "do nothing".
Suppose that you remove that ;
Then you have: if (Wire.available ()<=2)
That is always true. If the sensor is connected, then there are two bytes, and if the sensor is not connected then there are 0 bytes.
You can remove that if-statement and that would improve the sketch.
You can also test if the sensor is connected with:
Actually I have not the slightest idea what the "<=2" in (Wire.available ()<=2);" does in terms of shuffling bytes around. Lacking the training for it, must learn !
As soon as I have a Si7021 ready for testing (must solder the pins on a breakout) and a humble amount of time I will run the sketch with your modification. Anyway, #include <SparkFunHTU21D.h> library did not help much in getting temperature and humidity data out of a Si7021.