Это видео недоступно.
Сожалеем об этом.
SOIL MOISTURE SENSOR FOR PLANTS (V1.2 / V2.0) - Arduino tutorial #31
HTML-код
- Опубликовано: 15 авг 2024
- The capacitive soil moisture sensor allows you to measure the moistness of soil. The biggest advantage over a traditional moisture sensor is that the capacitive sensor doesn't corrode. In this tutorial I'll explain how you can read the soil moisture sensor and what the advantages are. Further you learn how to work with the map() function and how to calculate the soil moisture in percentage.
Many ask what the difference is between v1.2 and v2.0, this is what I found:
- The spelling of the out pin: AOUT on v1.2 and AUOT on the v2.0
- The top of the PCB shows a tiny circle on v2.0
🤓 Fun fact: One pin on my sensor is labeled AUOT which should be AOUT for Analog OUT.
The Arduino for beginners tutorials series guides you through the world of Arduino. A video is around 10 minutes and shows you step-by-step how to build the circuit and write the code. The website contains the course material, circuit diagram, Arduino code and shopping list of all the components used in the tutorial.
⬇️ Course material, circuit diagram, code and part list arduino-tutori...
👉 More tutorials and projects on arduino-tutori...
🇳🇱 Deze tutorial is ook in het Nederlands beschikbaar • 🇳🇱 CAPACITIEVE VOCHTSE...
CHAPTERS:
00:00 Introduction
00:15 Components
00:30 Capacitive soil moisture sensor
02:57 Building the circuit
03:34 Arduino code - part 1
04:42 Arduino code - part 2
COMPONENTS
🇨🇳 Arduino Uno (clone) with cable - AliExpress
arduino-tutori...
🇳🇱 Arduino Uno (clone) - Opencircuit
arduino-tutori...
🇳🇱 Arduino Uno SMD (original) - Opencircuit
arduino-tutori...
🇳🇱 Arduino Uno Chip (original) - Opencircuit
arduino-tutori...
🇨🇳 1x breadboard small - AliExpress
arduino-tutori...
🇳🇱 1x breadboard small - Opencircuit
arduino-tutori...
🇨🇳 1x breadboard large - AliExpress
arduino-tutori...
🇳🇱 1x breadboard large - Opencircuit
arduino-tutori...
🇨🇳 Jumper wire assortment (MM/MF/FF) - AliExpress
arduino-tutori...
🇨🇳 Jumper wire male-male - AliExpress
arduino-tutori...
🇳🇱 Jumper wire male-male - Opencircuit
arduino-tutori...
🇨🇳 128x64 I2C OLED (blue) - AliExpress
arduino-tutori...
🇳🇱 128x64 I2C OLED (blue) - Opencircuit
arduino-tutori...
🇨🇳 128x64 I2C OLED (white) - AliExpress
arduino-tutori...
🇳🇱 128x64 I2C OLED (white) - Opencircuit
arduino-tutori...
🇨🇳 128x64 I2C OLED (yellow-blue) - AliExpress
arduino-tutori...
🇳🇱 128x64 I2C OLED (yellow-blue) - Opencircuit
arduino-tutori...
🇨🇳 20x colored tactile switches - AliExpress
arduino-tutori...
🇳🇱 5x colored tactile switches - Opencircuit
arduino-tutori...
VIDEO SUMMARY:
In this tutorial, Bas will show you how to use a capacitive soil moisture sensor. You'll need an Arduino board, the sensor, a sensor cable, jumper wires and a glass of water. He explains that the sensor works by measuring the resistance between two pins which changes based on the water level in the soil. However, he warns that fertilizers and corrosion can affect the sensor's accuracy. Instead of measuring resistance, this sensor works like a capacitor, measuring charge and discharge timing. The sensor also has a chip called a 555 timer chip which helps with timing. Bas will guide you on how to connect the sensor to the Arduino board and run the code. Finally, he'll show you how to calculate the percentage of moisture in the soil by adjusting the code and measuring the total range of the sensor.
#arduino #BasOnTech
Many ask what the difference is between v1.2 and v2.0. There isn't much information available. This is what I found out so far myself:
- The spelling of the out pin: AOUT on v1.2 and AUOT on the v2.0
- The tip on the top-side of the PCB shows a tiny circle on v2.0
there is absolutely no difference some circuits are different and some are also faulty it depends on supplier from which tou bought the sensor
The tip on the top-side of the PCB it doesn't have any function at all? I'm asking to know whether or not to put a little lacquer to avoid corrosion due to water seepage.
@@zatsion2299 I guess using lacquer on the sensor will immediately stop any capacitive function of the sensor
Well I got my sensor in the mail, copied the code, plugged it in, calibrated it, stuck it in some almost dry potting mix and got a reading of 35% and then added some water to the pot and got a reading of 57%.
So for me if the reading is less than 20%, water is needed, if more than 20% it doesn't need water.
Your code works a treat, your explanations were terrific. Thank you very very much !
Now all I have to do is solve my wretched SD card and RTC issue and I have myself a hand dandy watering controller.
Great to hear! 😃
Mapping the values directly to percentages assumes that the change is linear, which is not the case. I wish more tutorials would point out this fact.
Better way would be a calibration test, where a dry soil sample is watered by tiny amounts of water until its fully saturated. This will give you a nonlinear function. Then you could fit a curve (e.g. a logarithmic function) to your observed values and apply a proper calibration.
Good point! Thanks for sharing! 👍🏻
I think he's provided all the instruction necessary in text. He saved you the time you'd have to spend watching a video. For practical applications, if you know when to water a plant, you can just take a reading at that point and make it the "water now" level. Take another reading after watering until water comes out the bottom of your pot and you call that "100%". It's not actually 100%, but it's as watered as the soil will get. Then get some pumps and maybe some relays and get to auto watering. At least that's my plan.
@@JaredLucas great point. I would even go so far to say that % concept isn't needed. One only needs a value for when to add water and a value for when to stop.
@@kreynolds1123 you are right, it would work as you said, however if you follow gardening instructions for watering plants, will that not refer to moisture in percentage? It could save some time and plenty of trial and error to convert the range to percentage as it was shown and just base the watering on whatever moisture percentage is advised for a certain species. If I’m missing something can you kindly let me know?
@@Ferreira019760 How about stick ones finger in the dirt every so often. When you sence it is ready to be watered take your reading and call that value the time to water value. On further thought, one only needs a predetermined amount to water. So water 5 seconds,10 or what ever is needed. Adapt the concept to the specific needs of the plant.
Many times the biggest problem is waiting for the perfect, as it gets in the way of getting started. I'm speaking from personal experence worrying about every little detail has held me back on numerous projects, and try to keep it simple.
The reason for the slow response time at the end is because your sensor is faulty, there is no pulldown resistor on the analogue output.
At 0:01, on the bottom right of the sensor, just below C4 and R4, the via hole is breaking the trace. You need to run a wire from the right side of R4 (nearest to the end), to the analogue output pin. Check out the video by “flora” on capacitance soil sensors
Thanks for sharing! 👍
👉 Don't forget to check arduino-tutorials.net for the code and 35 other Arduino tutorials and projects.
If you have questions, don't hesitate to ask them in de comments. Remember: There are no stupid questions 😃
🔔 Want to stay up-to-date with the latest videos? Subscribe to the Bas on Tech channel!
Such a great tutorial. I loved how thorough your explanation was. Subscribed!
Awesome, thank you! 😃
Overlooking the nonlinearity in capacitance and hydration, map is a nice function. Not knowing better but wanting the same result, I would have done hydration=100×(measured - dry)/(wet-dry)
Thanks for sharing! 😃
Hey there, I;m trying to make a project where accuracy is much needed. Can I use this formula for calculation of moisrture content(considering it's non linear as you said)
You may use what ever formula you like. I have not confirmed it but I believe the map function is doing the same exact thing as this formula.
It is good to understand what the readings is putting out and why. If you are not already familiar with the electronics I'd sugest to first Google "rc time constant" then goto images and find an rc time constant graph to examin and understand how charging or discharging an rc network (resistor and capacitor) workes. Additionally, Google Schmitt trigger, and read up on that.
The rc time constant is how long it takes to charge to 63.2% of of the voltage applied to a resistor and capacitor. That's pretty close to the % of supply voltage a Schmitt trigger needs to switch from a 0 to a 1 or discharge a capacitor to 32.8 % of supply voltage to switch the schmitt trigger output back back to a zero. It's so close it serves well as an aproxination to the rc time constant. The Schmitt trigger output is the digial input to the arduino. It's either fully on 1 or fully off 0. If you time how long it takes to switch on or off then you learn the rc time constant. Its a period of time increased by either an increase in capacitance or an increase in the resistance and changing the duelectric of the spik changes the capacitalnce. If you know the resistor value you can determin the capacitance between the two plates, or determin a max capacitance with water saturated soil, and minimum capacitance for soil that is bone dry. More capacitance simply takes longer to charge and to discharge through the restance of the resistor.
As pointed out in the video, fertilizer may change the conductivity, but it may also change the capavitive dielectric properties of the soil. And soil itself has different dielectric properties than air. So calibrating the fully wet and fully dry values of the soil helps get the most accurate readings. I'd sugest to prepare relativly large soil samples. One dried in a stove to 100c or slightly higher, And the other with soil that is saturated but allowed the water to drain. Then measure the time constant for the soils. Capacitance us effected by things at a distance si use reasonable sized sample. I belive well water saturated but drained soil is better to call 100% because in the ground, the soil can not retain any more water than that. And dry soil has a different capacitance than air, so using actual soil to calibrate the dry and wet rc time constant values gives better values to represent actual fully dry and fully wet. It's possible where a soil has poor drainage for it to get super saturated. An analogy is holding a sponge under water, versus simply dunking the spong and letting the excess drain out. Super saturated soils may result readings greater than 100% (super) saturation when their is more water than the soil can hold. Seeing as the roots of most plants need oxygen, supersarurated soil is not desirable and one should ensure the soil can adequately drain.
@@kreynolds1123 thankyou for clarifying. I'll try some of your suggestions and write out the results :)
Man!!! You explained that map() function so clearly. Thanks a lot!
Thanks! 😃
Well a smarter way to do it, is self adjusting the moisture, like saving the variable in a permanent memory (store even when turn off) and re-ajust by when a higher or lower score hits than the stored range. (Button of reset is needed if change the circuit)
At 2:00 the video is wrong. The output of the circuit is tied to ground. So there will not be a signal to measure at 2:14.
What happens is this: When capacity increases (more moisture), the voltage swing across the capacitor will decrease. Vice versa, when capacity decreases (less moisture), the swing will increase.
Thanks for teaching and sharing. May the force be with you :)
Thanks Boris! 😃
Дякую за детальну інформацію!
Sorry I can only read English and Dutch 😄
Best explanation so far ; you just gained a like on the video and a sub in your channel
Thanks! 😃
Very cool Bas. I just stumbled upon your Channel today!,
Hi Daryl, glad to hear you liked it! 😃
Thank you for your explanation of a capacitive sensor very good
You are welcome 😃
Your videos are pretty awesome! Thank you.
Hi Jakob, great to hear, thanks! 😃
Thanks for the great explanation
A few questions:
1. Is this solution scalable for a large garden with about 50 pots. What is the proper way to measure multiple pots at once?
2. How do you protect the sensore from water in case you want to keep it constantly in soil even when raining?
Hi Tom, to be honest I think this sensor is more suitable for fun projects than for a large garden. This sensor turned out not to be very accurate and the durability is questionable as well.
@@BasonTech How was it less durable than you expected? Was there corrosion of the plates? And if so where they actually coated to prevent current flow across the plates?
As to accuracy, one will find that a saturated soil will have a different capacitance than pure water. Water has a high dielectric constant. But salts in the soil and the soil itself even when fully saturated with water will have a lower capacitance than pure water. So a reading with 100% saturated made from pure water will only ever read 100% again in pure water. And in another comment it was pointed out that the resistor needed to be grounded. If you had taken saturated and dry soil reading as references instead of air and pure water readings, and had grounded the resistor, would these have resolved accuracy issues?
As for practicality, there's water logged soil saturation with no to poor drainage and then there's freshly watered soil saturated with as much water as it will hold before it drains excess. Which is best called 100% saturated? I don't know which convention is typically used. But, it seems more usefull to me factoring in drainage, because there's no point in watering more than a soil will hold, so take a reading in the soil when the soil is well watered and begines draining should be considered saturated and and then another reading when soil is completely dry calling that dry.
But, ultimatly what we really want to know is when to add water and how much is sufficient. taking readings for both when we decide it needs water and when it has been sufficiently watered. We can call those values StartWatering and StopWatering.
Or maybe some people simply want to know the actual % hydration at a given point in time.
Bravo !! Nice explanation
Thanks! 😃
I actually prefer the resistive sensors.
You turn them on one by one for two seconds, store their values in variables and then read those variables and activate the pumps. You run the code every thirty minutes, this way the sensors last a very long time, because they're only powered for a couple of seconds per hour.
Thank you so much! This is very helpful!
Glad it was helpful! 😃
Can you add to this a water pump that will be triggered when soil dry. It will pump water until sensor detects water added then auto shut off pump. The pump can be small as it will water a single plant. Disabled, I need to make 100 of these set ups to grow food.. Most Humble Appreciation! Alton
Hi, I thing there are better solutions available than using this sensor times 100. For such an implementation this sensor is simply not suitable.
Noting the length of time for the reading to go from 0 to 100% hydration. Maybe the delay could be a problem with automatic watering. Anyway to reduce the delay?
I remember that some modified the sensor. But unfortunately I can't pinpoint anymore what it was :/
Hope will read this when u need help. I tried it by my self to read the moisture and it didn't changed the value even thought the sensor was in wet soil.
The problem was that I plugged the sensor nearly close to the edge of the flowerpot and the sensor got no good connection to the soil.
You have to be sure that the sensor is really pressed at the front side of the sensor (front side = Label side with Capacitive ....)
Thanks for sharing! 👍🏻
Great experience . Plz add more videos
Thanks! 😃
ook here is the thing, your values are changing very slowly which are supposed to change just after the change in moisture. The reason is the resistor which is not connected to the ground, Due to this the capacitor discharges very slowly. To get the accurate value you'll have to connect the resistor(R4) with the ground.
Thanks for sharing! 👍🏻😃
Thank you for this tip, as automated watering might have problems over saturating the soil if the sensor takes a long time
@@kreynolds1123 yeah you will see the major changes in readings after grounding the R4 because the capacitor wasn't discharging previously. actually 82% of the capcitive sensors which are available in the market are faulty.. and the common fault is discharge resistor not connected to the ground.
Amazing difference, didn't know that, thanks a lot! This definitely removes my the workaround (with wait cycles) to not make a mess
how long does the sensor last if used continuously?
Unfortunately, I have no idea. I haven't conducted any extensive testing. I've heard here and there that this sensor shouldn't be used for long-term measurements that can be relied upon.
I've used mine for 3 summers (about 4months each summer so a year total of use) and have only replaced 1 out of my 5. They were planted out in dry greenhouse so conditions we're good and weren't exposed to rain or wind. There are a lot of unreliable sensors available to buy and a lot of ppl have had a lot of trouble finding reliable ones. Try look for a reliable one. Hope this info answers your question
@@iiinicky6224this is mainly because the sides of the PCB are exposed to the elements, meaning water gets sucked into the PCB. You need to seal the exposed edges with something, like cheap nail polish or hot glue
love your explanations.
Thank you! 😃
Nice video! It helped a lot
Glad it helped! 😃
The Vegtronix seems very nice. Just ordered one
Kind of curious if this one will corrode 😃
@@BasonTech in 2 weeks in will have it in coco to test. It will be in the pot permanently.
It's help me so much. Thank you.
Super! 😃
Great video! Thanks 👍👍👍
Great to hear! 😃
Your video tutorial helps me a lot on setting up my soil sensor. However i cant use it yet since i dont have the code, where can i see the code? if it's okay, for my research
In the video description of every video is a link to the code 😃
This is great video. I'm experimenting same sensor for Rock moisture variations. Could you do a video how to connect those sensor to a data logger. Thank you for the good work
In ruclips.net/video/PYkzJQhFNlA/видео.html I explain how to connect an audio sensor to the data logger. With the help of this video you should be able to connect the moisture sensor as well. 😃
very helpful for me! thanks
You're welcome! 😃
The code is exactly the same as the one used for the resistivity sensor! that can be very handy to compare both
Well done love it 👌🏻
Thank you 😁
awesome and helpful video!!
Great to hear! Thanks! 😃
Really great video!
Thank you! 😃
thank you for video ~
You're welcome! Hope you liked it 😃
You explained it great, but I did the same thing you did and the code just does not work.
That is quite unfortunate. Recheck your wiring and make sure the pin layout of your sensor is the same as mine. Without any error message I can't help you further.
Good tutorial, thanks.
My pleasure! 😃
I tried it, it worked for the first exercise, but after that it got all weird and only shows "54" over and over, even when I remove the sensor from water or even disconnect it from the Arduino Mega. Shouldn't it stop reading and show 0, when there is NO SENSOR connected? Something went screwy, but I cannot figure it out and the Mega works for other projects...
These sensors tend to be quite hard to work with. I experienced the same: one time they work and another time they give faulty measurements.
Is it possible to use this other than soil but will use the calibration?
Not really, this sensor is especially made for soil moisture
i want to use 3 of these sensors on a plant but i was wondering if there can be problems when u put the side of the sensor with the electric components in the soil ass well. maybe that pasrt cant get weet and i have to make it watter tight
I wouldn't recommend to do that. Maybe hotglue can help to seal the parts, but still. When the parts get wet it will damage your sensor.
@@BasonTech ohw okay that makes sense thank you!
So the map range is clamped by default? Or will it go over 100% like 101% or below zero -1% for example?
As far as I know it is camped indeed. It will not map outside the range.
@@BasonTech So I finally experimented with it a bit. At first it seemed like this was the case, but I eventually found out that it can indeed go to -1% and further as well as 101% and beyond. So its unclamped and I don't think there is a clamped version of the map range function (That I know of)
For anyone wondering, I clamped the range with a simple if statement:
if(moisturePercent > 100) {moisturePercent = 100;}
if(moisturePercent < 0) {moisturePercent = 0;}
This way we can make it hit 100% without going over. And for me, send a warning message that its too wet or dry and something could be broken or leaking.
Cheers 👍
Can someone help me with the code i have 2 capacitive soil moisture sensor with different dry/wet sensor, how will i declare it?
How to convert the value of wet and dry sensor to Celcius?
You can't. The values given do have nothing to do with temperature. Therefore you'll need a temperature sensor.
Can you use several sensors on the same Arduino? And how could that be? Thanks for great explanation btw!
Sure! You can share the Vcc and GND between sensors. Then you use different pins on the Arduino to connect the AOUT sensor pin to 😃
How to send this soil moisture data to cloud server using GSM module?? Please share the link
On what part do you get stuck?
How would you do this for multiple sensors sometime like 30+ individual pots with sensors
I would not recommend using that many of these sensors. They quality of these is quite questionable. However, you might want to look into "multiplexing".
Great video! I actually got it to work. Do you know how I could find a way to attach an OLED to show a reading? I.m looking all over and can't get it to work..appreciate your videos though!
You can just follow my tutorial at arduino-tutorials.net/tutorial/128x64-i2c-oled-display-ssd1306-on-arduino
This video ruclips.net/video/pdGRs7GXBeE/видео.html is a useful explanation for how the soil sensor works internally. Note that it mentions that U2 is a 3.3v voltage regulator, so that the output is limited to 3.3 volts. On a 5 volt arduino, analogRead() will report a maximum of 3.3/5 or 66% of full scale. If the analog to digital converter gives 10 bit results, full scale is 1023 (i.e. 2^10-1) and the maximum possible returned value is 675. Bas on Tech is getting a max real world value of 600, not too surprising, especially since the 3.3v will drop across a diode (labelled D1 on my moisture sensor) on its way by an RC smoothing circuit to AOUT.
Thanks for sharing, great background information on the sensor! 😃
Thx for the tutorial
My pleasure! 😃
Thanks!
Many thanks! Appreciated! 🚀
Thank you so much for this video. I will use it as my guide. Please do you have a tutorial on using several soil moisture sensor to one arduino?
Thanks! With this tutorial it shouldn't be ver hard to readout multiple sensors. Just connect the AOUT to a new analog pin and read the sensor 😃
@@BasonTech Thank you so much
What does AP and STC mode stands for version 2.0 capacitive sensors?
Where did you read about these modes? I've never heard about them 🤔
Hi sir, may I ask why my serial monitor prints a reading over 100% when i put my sensor in the soil? when in air it is 0%
Is it wet or dry soil?
@@BasonTech it's after i remove it in the wet soil
thank you for the tutorial. i've been going mad with someone else's sketch not working. obviously im creating an automated watering system so do you have a further tutorial that will help connect a relay to this so the moisture sensor activates the pump and if so could i please have the link.
really nice video though so thanks again
Unfortunately I don't have a tutorial about a relay. However there is not so much difference in connecting a relay board and a LED. Just make sure that the relay has the correct specs for your project and Arduino. Some operate at a different voltage than the Arduino.
Thank you so much 🤩🤩
You're welcome! 😃
hello, can I use the capacitive soil moisture sensor to detect/measure moisture in oil
I am quite sure you can't. The oil will probably damage the PCB. This sensor is as far as I know for soil.
@@BasonTech Thanks for your reply, I am doing final year project and part of it is about monitoring transformer oil quality, more specifically its dielectic strenght. Moisture/water reduces dielectric strenght of transformer oil that in most cases lead to explosion of the transformer , what sensor can you recommend that I can use to detect/measure moisture in oil
Unfortunately I have no experience with such a sensor. You might want to ask this question on Facebook / Reddit Arduino groups.
you are reading out the values out with a computer but it be cool to get it posted directly to a screen ;)
Hi Nikky, therefore I've made several tutorials about screens like: ruclips.net/video/aACOC9XBBks/видео.html or ruclips.net/video/SNt3UsMEqc8/видео.html Make it a challenge to get it working, with these tutorials it shouldn't be that hard 😃
Hello!
It was a great video. I wanted to plug this to SparkFun ESP32 Thing (which only has options of Vcc as 3.3V) Should I proceed similarly or do I need to make some changes?
As far as I know this sensor is made for 5V perhaps your can find a 3V moist sensor somewhere?
It should work with a 3V3 input
I have an Arduino Nano 33 IoT board that does not have a 5V port only 3.3. Is that a problem?
Hi Stephen, according to media.digikey.com/pdf/Data%20Sheets/DFRobot%20PDFs/SEN0193_Web.pdf it should be able to work with 3.3V
@@BasonTech Thanks!
how about the water pump side ? how is the connection and the Arduino code ?
There are multiple options: you can use a valve which you switch with a relais, or a pump which you turn on/off at a desired level.
Wow! Great tutorial! I would love to make to this, but where is the code? Could the code be put in the description?
The link to the code is already in the description of this video 😃
@@BasonTech Ok Thank You!
Really great and high quality tutorial, I do have one question though, I just got four 2.0 sensors and after setting things up on my arduino board the analog value shown in the serial monitor doesn’t change even when I put the sensor directly in water, do you have any idea why that is? I plan on testing the other sensors later today
Please be aware that there is a line on the sensor which indicates the max level of water. The electronic components should not become wet. Maybe your sensor has a different pin layout which needs the sensor to connect differently?
@@BasonTech Thanks for the fast reply! I am aware of the max depth line in fact I’ve already waterproofed the top part of the sensor with all the electronics. Interestingly I connected the sensor to my uno instead of my mega and it seemed to work fine after I fixed a couple of issues. I still have no idea why it didn’t work on the mega but I was planning on using my uno for the project anyways. Thanks again!
How would you prevent this thing from shorting out if left outside?
You could use an enclosure or perhaps even hotglue to seal the sensor.
can you provide me the litrature review of this
your video is awesome. 1 question, do you think the soil moisture sensor is going to sense the oil or just the water?
Hi, I think it isn't recommended to use this sensor in oil. It might damage the PCB and oil doesn't conduct the same way as water does 😃
@@BasonTech how about we try to attached a probe into the board so that the probe will be the one submerged in water with oil? I am planning to do a project about water in an oil and this capacitive sensor is one of my option because I tried resistive sensor but it is not functioning well with water detection in the oil
Of course you can always give it a shot, they're not that expensive 😃
The dielectric constant (effecting capacitance) for air is 1 and many oils is about 3 and pure water will be close to 80 but changes with temperature.
Considering a smaller change in dielectric constant between air and oil, and slightly different constant for different oils, then it might be hard to get accurate readings. For many different kinds of oils.
On the other hand, because of the big difference in dielectric constants between oil and water seeing a big change in the capacitance measured could easily sugest the presence of water.
And keep the sensor away from metal walls that will mess with the readings.
Ty you helped me alot
Great to hear! 😃
Nice video, I just tried something with a Raspberry Pi Pico W using also an oled screen.
I have two questions.
1. What is the difference between version 1.2. and 2.0?
2.I used a version 1.2 in combination with a raspberry Pi. I found out that in case of using a solar panel the values measures are different. What are your experiences with this behaviour??
Hi! 1. See my comment on this video. 2. Didn't have any experience with this setup, sorry.
Are you missing the voltage regulator V2 on the board?
such a useful video, can you explain how we can plot the data?
Thanks! With this tutorial you should be able to plot the temperature: arduino-tutorials.net/tutorial/drawing-sound-sensor-data-on-serial-plotter
Best video on this sensor! Question for you. On other videos they seal up the sides of the sensor...I don't think you do that...do we need to seal up the sides with epoxy or something like that?
Hi Peter, I am not aware of the need to seal the sensor. Neither do I know if it will affect the inner working.
Yes the sensor leaks from the sides. They are sealed before scoring thus the sides were never covered
@@Ed19601 thanks, I keep running into an issue where when I first stick it in water i get great readings, but then eventually I just get zeros. I "sealed" the sides with nail polish that I had laying around as someone on another video has done. Is this because I didn't really seal it? You think the nail polish is a bad way to seal? Should I order some sort of epoxy?
@@peterm.4026 most nail polish will start to leak after a short time
@@Ed19601 what's the best sealant for this? I'm on amazon right now lol
I am using a v2.0 sensor and am trying to calibrate it following this video. However I keep getting inconsistent random values, wether it's wet or dry. I have tried with 3 different sensors. For instance I would get wet->63, dry->65 (nothing compare to this 500+ values in the video), and after a while, I am getting wet->68. dry->61. It's impossible for me to calibrate, does anyone know what's going on? Thanks
I've made this tutorial quite some time ago and I see more and more people struggle with this sensor. Unfortunately it looks like many of them are faulty and do not work as expected
How accurate the sensor data is when compared to data from a soil laboratory?
Hi, it is definitely not accurate compared to such data.
@@BasonTech ok. I have a project going on with a Japanese company. So I am suppose to build a device that can detect essential soil components which are responsible to make a good soil. And it should also be cost effective.
Then this is not the sensor you are looking for. It is a very simple capacitor based moisture sensor, and does not in any way tell you the soil components.
@Bas on Tech Yeah, I did not find sensors that can individually detect soil nutrients. But, there is one sensor probe that is not cost effective.
Hi Bas,
Hope you read this. I was copying the code on the Arduino Code Part-2 and then the value started going into negative even I mapped it to 100 and 0 pls help me
Hard to say what goes wrong. I would advise to reproduce the code step-by-step. With copy/paste you can have introduced many errors all at once.
@@BasonTech Thanks @Bas on Tech i will try your suggestion
Great tutorial! I wonder if this sensor would be useful for measuring moisture in round hay bales?
Hi, would a humidity sensor not be sufficient instead of a moisture sensor?
@@BasonTech Most of the currently used sensors for this application are called moisture sensors. They are using the resistance method. Which sensor would you personally suggest for this application?
I was more thinking about a DHT11, but I am no expert on this one 😄
@@BasonTech Thanks! I'm no expert either ...
@@sigmadews5403 Hi, a BME280 Sensor is great and can measure temperature, humidity and as bonus also the pressure. Nice greetings Edi
good project, how can i order complete project?
You can't. In the description of the video is a link to the parts used in this tutorial 😃
what is the unit of these wet and dry values?
It is not really a unit, it a conversion of the sensor value to the Arduino range. So the sensor gives 0-5V and the Arduino maps this to 0-1023
The capacitive soil moisture sensor V2.0 is extremely difficult to find in the US!! I got some V1.2 and they have lots of flaws: bouncing values, sluggish...
That's too bad, I order them from arduino-tutorials.net/r/a7D28h the picture said 1.2 but I received a 2.0 kinda weird I guess...
Hi, i love the video, but i have a question, if i wanted to connect 4 moisture sensors, can i plug them all into one arduino? how would i manage the power input into all the sensors? im trying to make indoors irrigation system and im looking for a way that every plant(i've got 4) wil have its own moisture sensor. Thanks in advance :)
Sure! They can share the 5V and GND. The Arduino Uni has 6 analog in so you can use 6 of then together 😃
@@BasonTech Thank you so much for this video. I will use it as my guide. Please do you have a tutorial on using several soil moisture sensor to one arduino?
code didnt work error came up for line 5?
Line 5 is in the comment section, maybe missed a character when copy/pasting?
Though yr explanation of the general principle of a capacitive sensor (measuring charge and discharge time)is correct, it is not how this sensor is working: you are not measuring a time but a voltage.
Should you measure a charging time, you would need a starting point.
The principle in this sensor is different. The output of the 555 oscillator is fed to a voltage divider that is fomed by a 10k resistor and the reactance of the capacitor in the probe. When that reactance changes as a result of the capacity changing so does the voltage on the Aout
Thanks for clarifying! 😃
@@BasonTech V1.2 had some issues (a not connected 1Mohm resistor) that could easily be fixed. I see you are having V2.0 that one is OK i presume.
Another issue is that some clones have an NE555 chip rather than a TLC555. The latter accepts 3v3 the former does not but needs 5V
About how long should it take for the sensor to be at "100%" when putting it in water to get its wet value?
Hi, a few mins max
@@BasonTech Ok that is what I thought. I am having a weird issue where the wet value and dry value are not working properly with the map function. The fully wet value is 391 and dry value is 721 but it over maps to 102% and undermaps to -2% with those values but if I adjust them to wet 385 and dry 710 it seems to work properly. Not sure if it is the arduino somehow doing math wrong or what. I have also tried doing map(readVal, dry, wet, 0, 100) as well as map(readVal, wet, dry, 100, 0) and they both do the same thing. Any suggestions or would you say the modified numbers regardless of what its top and bottom are reading would work? I am using the V1,2.
The thing is that the sensor is not a digital sensor. So the current 0 could be -2 in another measurement. The same goes voor the wet value. Therefore you should keep some margin and for example assume > 90% wet and < 20% dry. This sensor is not suitable for exact 1 percentage accurate measurements.
@@BasonTech I figured it would not be an exact precise measurement being an analog sensor. Thank you for the help. You are also the first RUclipsr I have ever gotten response to help from. I appreciate that greatly. For sure subscribing to your channel. Keep up the amazing work. :)
Thanks and great to hear! I try to response to everyone who took the time to leave a comment 😃
Hi there! My serial monitor is showing values ranging from 5-61. I did the wiring like you did and did the code exactly. Do you have a reasoning for this?
Thank you!
Could be several reasons for example a faulty sensor or more water than the marked line. Unfortunately for me it is hard to tell without actually being able to see and touch the sensor 😃
@@BasonTech Oh its working now! Thank you! I checked the video again and saw some of my errors!
Great! Could you share what error you'd made so others can learn from it when they read the comments? Thanks!
@@BasonTech I had to switch the placement of the wires I looked at it wrong haha.
Happens to all of us 😄
Does this sensor rust after a while? I've seen a ton of other sensors that rust after a short period of use
At least not as bad as the "two probe" sensor. I have no experience with using this sensor for a long time. Andreas Spiess had made a nice video explaining this ruclips.net/video/udmJyncDvw0/видео.html
@@BasonTech Yes! I've seen Andreas video. Thanks for answering!
if you have multiple sensors do each need their own set of wet/dry const int?
Hi, I don't think that is needed. However these numbers will differ between sensors. The question is how much they differ and if this is an acceptable bias for you. Otherwise you need to create a new wet/dry const for every sensor. In this way you calibrate them individually. 😃
@@BasonTech Thanks a lot, nice videos!
@@wes2242 You're welcome and thanks! 😃
Hello, can someone teach me the code when you hzve multple sensors
I want control 4 relay unit using this sensor value please send ma code for it
What have you tried so far? On what part did you get stuck?
@@BasonTech i want on solenoid's relay using two input one of capacitive type sensor input other one is digital input(tank water level) help me to code for this application
Can you please make a tutorial on using a capacitive soil moisture sensor , Arduino Uno to make a automatic watering system? I have tried but I can't trigger the motor! tried a mos module and a relay same result :(
Thanks for the suggestion! Unfortunately not on short notice.
@@BasonTech Hey it's always worth asking :) Can you suggest any videos on how to trigger events/devices using if statements?
What you mean with "trigger events/devices using if statements"?
I have 3 Capacitive Soil Moisture Sensor v1.2 and they are working only with 5 volts! If I use 3.3 volt I always read 0!
Furthermore each of the 3 sensors has a different dry-wet range. For example one is 600-800 the other is 700-900. Is it normal for this kind of sensors to have different range for wet and dry?
Hi, I know there are some issues with these sensors. I can imagine that the range depends on the components. For the best result you need to calibrate each sensor individually
Most probably you have the same problem than mine: NE55 mounted instead of TLC555C(or...i)
Check this video from Stewart that will help you to solve. ruclips.net/video/QGCrtXf8YSs/видео.html
I Use the 1.2V variant as well and can confirm that the ranges are indeed different when the sensors are in the soil. This comes from different local soil composition and especially the local pressure/tightness of the sensor within the soil. Even slightly touching the sensor while in the soil results in persisting value jumps, as the soil loosens around the sensor.
9600 baud is not 9600 characters per second; it is closer to 1000 characters per second, assuming 8 bit characters (plus 1 start bit and 1 stop bit for each character). See wikipedia article "asynchronous serial communication".
Thanks for clarifying! I've got it from en.wikipedia.org/wiki/Baud where it states "symbols per second or pulses per second" which I interpret as characters per second.
Which software applications is used for programming
I am using the Arduino IDE which you can download for free at www.arduino.cc/en/Main/Software 😃
Thnxx😊
do you have any idea why my values are between 1246, 3540 ??
That is really weird since the possible values should be between 0 and 1023. Have you checked your code?
@@BasonTech I used your code. I connect my sensor to pin 33 of my esp32
Maybe it has something todo with the esp32. I've only used it on the Arduino Uno. Maybe using another pin does the trick?
you get this result because the ADC of your microcontroller works with a bit width of 12
Kind Sir,
Do you have video to connect moisture sensor also add water pump ?
When dry, sensor sends message, pumps water plant until water sensor cuts off water pump? Check every 3 days?
I am Disabled with brain damage but want plant outside and auto watering.
I have 12 vegetable plants. Neighbor helps now, but I want automated.
Can you do video on 12 sensor/12 pump system?
Or do one of each but tell me what to buy for larger quantity.
Most Humble Appreciation! Alton
Hi Alton, I don't have a tutorial available for that. The easiest I can think of is to make the pump system work with a relais. You can switch this relais based on the sensor value 😃
Sir how take realtime reading?? Can you suggest a program for that?
Hi, what do you mean by realtime?
@@BasonTech sir i need a graph with respect to time. I mean time- humidity graph pls help🥺
Have a look at this tutorial of mine: arduino-tutorials.net/tutorial/drawing-sound-sensor-data-on-serial-plotter Instead of sound you can also plot the humidity. Changing the code should nog be that hard to do.
@@BasonTech thakyou sir😍😍😍
I am currently using the same v1.2 capacitive Sensor, however it has proven to be a pain in the a**. Returned analog values depend heavily on soil pressure and local soil properties. Values from multiple sensors therefore can't be compared directly even tho all were the same value in air and water during calibration. Soil pressure against the sensor has (in my case) shown to be the most influential external variable on the sensor outputs. This hoever can be normalized between sensors. Worst par however, is that values AND sensitivity of the sensor jumps once it slightly shakes/wiggles in the ground as the initial press-fit loosens. Has anyone else experienced this?
I experienced the same, this is sensor is not a very robust solution. I had it laying around and decided to make a tutorial about it. For fun projects it is sufficient, but to manage een greenhouse probably not.
It does what it sais it does to be fair. For sure suitable in an indifferent environment. Just bad, that my inddor chili farm is not like that, with rotating pots eg.
Changing values and instable sensitivities even during one watering cycle are just too much to handle
Guess, a more specialised greenhouse sensor would be a better solution (and probably more expensive).
I think youd be better to adjust what we think of as is saturated. Consider the following points.
Dielectic constants of materials effect the capacitance. Air has a dielectric constant of 1 while many hydrocarbons, maybe including soil, have a constant slightly above or below 3 while water can be 80 or so and change a bit by temperature changes, and soil salts may lower the capacitance of water.
Compressing a soil is certainly going to remove air filling the space between the electrode with materials and water resulting in a net effective dielectric constant higher than air.
What seems to make more usefull sense is to take completely dried soil, measure it and call that dry which would be 0. Then water the same soil very well and let it drain off the excess and then call that 100% saturated.
If we think about this, and set up an automatic watering, it makes no sence to water any soil past the point where it can hold no more water draining off the excess. We would call excess watering oversaturating the soil.
I hope this information and perspective change helps make readings more useful.
I'm not certain "commercial" versions are immune to pressure changes. Differences in soil salts. This unit would be more practical if we adjust some definitions to more practical definitions.
@@kreynolds1123 what you suggest is a calibration step i had performed already. Sadly this isn't the solution for the problem mentioned. Even with stable water content in the soil the values drift as the soil relaxes around the sensor and jump on slight vibration. You are right from a physical standpoint, but in operation this makes the sensor readings unreliable, as the scaling of values changes and cant be nornalized.
Can someone help me with datasheet about this sensor ? V2.0
Are you looking for something like this? wiki.dfrobot.com/Capacitive_Soil_Moisture_Sensor_SKU_SEN0193
what is the difference between v1.2 and v2.0?
Besides the typo of the analog out pin on v2.0 I could find any information about a difference between both. The component layout looks the same. Maybe the probe part is different, but I couldn't find any information which supports this.
@@BasonTech I have a v1.2 and it has the same AUOT typo, which I actually didn't notice until you mentioned it. I also have not been able to find any info on the differences between the 2. They seem identical. Thanks for the reply.
Plz help, As u said when the sensor is dry it shows the value of 572 or something and when its put inside moist soil or water it drops , Bt when I did that same thing the value showed 937 or something and when I put that inside water the value increased to 1200 and more , I thought the sensor was faulty so I replaced that ASAP bt still its showing same result. Why? What should I do?
That is weird. Please try other wires and/or Arduino. Also check your connections and make sure the wiring is correct.
@@BasonTech I tried I changed the wires even the connector that comes with that, tried in 4 Arduinos still same , I dont know whats going wrong.
I would say if it is not the hardware then it has to be the software
@@BasonTech The IDE or code or anything?
The Arduino code
9600 baud == 9600 bits per second, not characters per second
en.wikipedia.org/wiki/Baud states "It is the unit for symbol rate or modulation rate in symbols per second"
The differences are found in www.geeksforgeeks.org/difference-btween-bit-rate-and-baud-rate/