Miceuz / i2c-moisture-sensor

I2C based soil moisture sensor
Apache License 2.0
240 stars 72 forks source link

Sensor outputs only 65535 as the reading #11

Closed varunhr closed 7 years ago

varunhr commented 7 years ago

Hi i recently bought a chirp I2C soil moisture sensor V2.7.4 and i hooked it up to Arduino Uno Like this Uno Chirp 5V/3.3V----- VCC(Tried Both) Gnd---- GND SDA -----SDA(10k Pullup) SCL------ SCL(10k Pullup)

My Code is this

include

void writeI2CRegister8bit(int addr, int value) { Wire.beginTransmission(addr); Wire.write(value); Wire.endTransmission(); }

unsigned int readI2CRegister16bit(int addr, int reg) { Wire.beginTransmission(addr); Wire.write(reg); Wire.endTransmission(); delay(20); Wire.requestFrom(addr, 2); unsigned int t = Wire.read() << 8; t = t | Wire.read(); return t; }

void setup() { Wire.begin(); Serial.begin(9600); writeI2CRegister8bit(0x20, 6); //reset }

void loop() { Serial.print(readI2CRegister16bit(0x20, 0)); //read capacitance register Serial.print(", "); Serial.print(readI2CRegister16bit(0x20, 5)); //temperature register Serial.print(", "); writeI2CRegister8bit(0x20, 3); //request light measurement Serial.println(readI2CRegister16bit(0x20, 4)); //read light register delay(1000); }


My Serial port output is this


65535, 65535, 65535 65535, 65535, 65535 65535, 65535, 65535 65535, 65535, 65535 65535, 65535, 65535 65535, 65535, 65535

Miceuz commented 7 years ago

Hi,

How long if your cable? Also, please write directly to me - mic at wemakethings net. Please send me your order number, we will sort it out.

varunhr commented 7 years ago

Hi, Sorry for the delay in response. The sensor worked properly after some solder touchup on the Crystal Oscillator. Thanks for your support.

Regards Varun h r

On Sun, May 7, 2017 at 4:27 PM, Albertas Mickėnas notifications@github.com wrote:

Closed #11 https://github.com/Miceuz/i2c-moisture-sensor/issues/11.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Miceuz/i2c-moisture-sensor/issues/11#event-1071837040, or mute the thread https://github.com/notifications/unsubscribe-auth/AUX_zKKkkJphNksDScmSXloFJ9gEntBmks5r3aOWgaJpZM4NAi1b .