Hi there,
(I noticed a similar (recent!) post in this forum that matches my experience…)
I am testing an unused “new” (but ordered months ago) Qwiic Soil Moisture Sensor: https://www.sparkfun.com/products/17731
I am working with this board: https://www.sparkfun.com/products/18158
I’ve tested this board in both 5v and 3.5 v mode (using the onboard voltage switch unique to this “plus” board)
I have experience with Qwiic and non-Qwiic Moisture sensors including: https://www.sparkfun.com/products/13322
I am using this Qwiic cable: https://www.sparkfun.com/products/17259
I created a sketch as indicated in this tutorial: https://learn.sparkfun.com/tutorials/so … okup-guide[/list]
I was able to see the red power led and green “communication” led on the Qwiic Soil Mosture sensor light up, and I was briefly able to get values from the sensor that were logical (testing in air, vs touching the sensor and/or putting it in moist soil. My results made sense. This continued for perhaps 10 minutes of basic testing.
After reconfiguring my board to add other devices (power down, power up, reload sketch, etc) the Soil Moisture Sensor stopped returning a viable status value to the code fragment below:
Wire.beginTransmission( 0x28 ); // this is the address that was working
delay(10);
byte status = Wire.endTransmission(); // status returned used to be 0, but now is 2
It shows the red LED light still (power), but no more green LED, and returns status 2, which I believe means
“Received NACK on transmit of address. Device did not acknowledge the address.”
I have multiple other Qwiic devices and multiple other Redboards (of multiple types). I also have other Qwiic Cables. I did some sanity tests by swapping out one type of part at a time to assess where the problem could be (board, cable, device)
In every test configuration, the Qwiic Soil Moisture sensor returns status 2 on Wire.endTransmission(); But all other Qwiic devices are fine (In particular I tested the https://www.sparkfun.com/products/19921 which returns values and acknowledges its address no problem.)
I then stripped down my sketch, using strategies other folks have used, to just the code below. This code scans all possible addresses and keeps reporting success or failure after attempting 1 through 126 inclusive.
As I would expect, this code correctly “finds” and reports addresses for my other Qwiic devices.
However, the Qwiic Soil Sensor fails to ever return on any valid address.
I have not cut the jumpers on the Soil Sensor BTW, as I am not running more than 1 Qwiic sensor at a time in these basic tests.
I have carefully pressed the Qwiic cable into the Soil Sensor multiple times attempting to sus out if there is a loose connection - with no luck. As mentioned I have swapped out boards and cables, with no luck.
At this point, and considering other folks have seen this, I have to assume this is a faulty sensor (that is, it just failed in front of me after a few minutes of use.
Are there any other diagnostics I can apply to determine how/if this sensor is bad?
What would cutting the jumpers do in this case?
(FWIW I have regress to the pin-version of this sensor and things are working fine as I would expect)
Thank you!
— qwiic address probing code below -----
#include <Wire.h>
void setup ( ) {
Serial.begin( 9600 ) ; // use the same value in the “Serial Monitor”
Wire.begin();
// Scan for devices
Serial.println(“Scanning for I2C devices…”);
byte address = 1;
while ( address < 127) {
Wire.beginTransmission(address%127);
delay(10);
byte status = Wire.endTransmission();
if (status == 0) {
Serial.print(“Found I2C device at address 0x”);
Serial.println(address%127, HEX);
}
address++; // test the next address
if ( address == 127 ) {
address = 1;
Serial.println(“No devices found between 0 and 127. Starting over at 0x1…”);
}
} // end while
} // end setup()
void loop() {
}