Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By mojESP8266
#39054
WereCatf wrote:It's 1.0V, not 1.1V, but yeah, it sounds like your setup is fine and the issue lies with your code instead. I don't have one of these moisture-sensors, but when connecting to a "real" Arduino-board you're getting values in the range of 0-1023? Mind showing your sketch?


Here is part of testing code ... yes and it works on real arduino board

int moisturePin = A0;
int moistureVcc = 5;
int mappedValue;

(setup)
pinMode(moisturePin, INPUT);
pinMode(moistureVcc, OUTPUT);
digitalWrite(moistureVcc, LOW);

(loop):

digitalWrite(moistureVcc, HIGH);
delay(100);
int moistureValue = analogRead(moisturePin);
mappedValue = map(moistureValue, 0, 1023, 0, 1023); /*0 - 1023*/
Serial.print("Sensor value: ");
Serial.print(mappedValue);
Serial.println(" ...");
digitalWrite(moistureVcc, LOW);
delay(1000);
User avatar
By WereCatf
#39055
mojESP8266 wrote:My MS(moisture sensor) is using 3.3V


I just realized that it's supposed to be driven from a 5V-supply, not from a 3.3V. When you're using it with a "real" Arduino-board are you using 5V? I don't know if it works right from a 3V3 when it's designed for 5V, but if you insist on using 3V3 then you need to fix your sketch:

Code: Select allint moistureVcc = 5;


Your code calculates its values based on 5V.
User avatar
By mojESP8266
#39059
WereCatf wrote:
mojESP8266 wrote:My MS(moisture sensor) is using 3.3V


I just realized that it's supposed to be driven from a 5V-supply, not from a 3.3V. When you're using it with a "real" Arduino-board are you using 5V? If so, then there's your problem -- you can't just slap a device designed for 5V on a 3V3 supply and expect it to work right, unless it has a built-in voltage-regulator for that.


Specs for YL-69 module: VCC: 3.3V-5V

I was testing it with arduino board 5V and 3.3V. Both works.