void setup() {
Serial.begin(9600); // open serial port, set the baud rate as 9600 bps
}
void loop() {
int val;
val = analogRead(0); //connect sensor to Analog 0
Serial.println(val); //print the value to serial port
delay(100);
}
The only information I get from the serial monitor, after setting it to 9600, is 1023.
It does not display any different information when I dip it in water.
The connections are exactly the same as mentioned in the tutorial.
Other topics in the forum could not help me, for example:
since A0 is an analog input and the unit should not read more than 600 in air,
there is something odd.
check wiring,
lift the
AOUT off the sensor and leave A0 connected on your Arduino
there is always the possibility of a bad sensor, funny, but does it pass the smell test ?
although I do not have exactly the same setup as in the tutorial you mentioned, I did stumble across that one as well while trying to get my sensor to work.
I use a NodeMCU, the capacitive soil moisture sensor v1.2 and uPyCraft IDE (MicroPython).
At first, uPyCraft set the baud rate to 9600 by default (and as suggested in the tutorial). Unfortunately, the serial output was an underwhelming "3". When I swapped to a baud rate of 115200, I got values ranging from 833 (dry in air) to 520 (wet in water). Bytesize = 8, stopbits = 1 and parity = NONE are other values displayed by the IDE.
The Arduino analog input voltage is max. 1V and the output voltage of the capacitive sensor is about 3V (if you use it from 3.3V power supply).
So you have to use a voltage divider at the output of the sensor.
The Arduino analog input voltage is max. 1V and the output voltage of the capacitive sensor is about 3V (if you use it from 3.3V power supply).
So you have to use a voltage divider at the output of the sensor.
This might be true, but even tested with a multimeter the output only changes when using a arduinoUNO
NodeMCU and Wemos D1 Mini seem to work sporadically. The weird result is a value of 0 - 7 on A0. To fix this, I temporarily ground the VIN pin of the sensor which causes it to function normally for a few seconds until it reverts to a faulty state.
The only way I can get this sensor working reliably is with an arduino UNO with VIN connected to 5v. Otherwise the Aout pin outputs absolutely no voltage.
I received a couple of capacitive sensor (same as topic starter) last week, and no matter what I do I do not get a valid result. I am hoping some of you guys have a tip.
Maybe it was the connector so I soldered new cables to the board, but that did not help. When I touch the resistors with my finger the value jump up, but then slowly goes to zero again.
Maybe the board is faulty, but I ordered 5 of them, will all 5 be broken?
Has somebody a tip for me which I can try, or that I can check that the board(s) are not broken.
Are you measuring from the right pin? Try using A0 as the pin address
void setup() {
Serial.begin(9600); // open serial port, set the baud rate as 9600 bps
}
void loop() {
int val;
val = analogRead(A0); //connect sensor to Analog 0
Serial.println(val); //print the value to serial port
delay(100);
}
I received a couple of capacitive sensor (same as topic starter) last week, and no matter what I do I do not get a valid result. I am hoping some of you guys have a tip.
Maybe it was the connector so I soldered new cables to the board, but that did not help. When I touch the resistors with my finger the value jump up, but then slowly goes to zero again.
Maybe the board is faulty, but I ordered 5 of them, will all 5 be broken?
Has somebody a tip for me which I can try, or that I can check that the board(s) are not broken.
What Arduino board are you using?
What voltage are you applying to the sensor?
Thanks... Tom.....
Hello,
i´ve the same issue. I connected the sensor to a uno and a nodemcu. On both units i receive a value of around 330. But it does not raise or unraise when soil becomes wet or dry.
It toogles around 330 to 350, but not more.
I also changed power from 3.3 to 5v but nothing changed. I tried two sensors, both the same result.
Did anyone make them work?
TimMJN:
Have you tried replacing your sensor with a potentiometer? Are you able to get a decent reading out of that?
Yes I tried that and that worked.
TomGeorge:
What Arduino board are you using?
What voltage are you applying to the sensor?
Thanks... Tom.....
I tried multiple Arduino uno boards, and tried both 5v and 3.3v.
Paul__B:
Perhaps stump up the money and (if you are in the USA.) get a better product?
Not many webshops have those sensors in stock. It did take some time but finally my order came in today. I received a couple of adafruit 4026 like you mentioned, and they work out of the box, Thanks!
But.. I found a youtube video with the title "How to fix faulty Capacitive soil moisture humidity sensor v1.2" (https://www.youtube.com/watch?v=QGCrtXf8YSs) so maybe i am able to fix it.
I was having a similar problem where i thought it was not responding and why i found this thread. A bit more fiddling and i discovered that the output when in water (low) takes a couple of minutes to get to the minimum value. Once pull out into air the response is in seconds going back to the max value.
I also note you can check the output from the sensor with a DMM it ranges around 1.8 v in water to 3 volts in air.
Hi, the analog value from Capacitive Soil Moisture Sensor can be converted to a percentage. Here is a very nice article, how this person has done the percentage calculated using the map function: Interface Capacitive Soil Moisture Sensor v1.2 with Arduino