Soil Moisture Sensor Project

Hi, I'm a farmer and I'm new here and new to the arduino so forgive me if I sound ignorant and am not clear enough. Okay so during planting I decided I wanted to make a data logging system for my watermark soil moisture sensors

(http://www.irrometer.com/pdf/sensors/403%20Sensor%20%20Web5.pdf)

since they seem to be the most accurate and cost effective for what i am doing.

But then my first problem was getting an Arduino Uno to read them so after a lot of googling I found these

http://emesystems.com/smx/overview.html

and from what I read they allow the arduino to be able to read the watermarks.

Now i've read through the literature and I kind of understand how I need to wire it up, and there are three different ways to wire it up and each gives you a different form of data to read.

Now I've found a couple other threads on this and on one it said that wiring it up to count digital frequency was the way to go but I'm not sure where to start with the code on that...

I've found a little info here and there but nothing that has been very helpful for my application. And if possible I would also like to read 3 sensors from the one Arduino.

Would that be possible? Any help would be appreciated and I apologize if what I said doesn't make sense.

One Arduino should be able to do as you wish.

In future posts, please break up the paragraph to improve readability. Also put the links on their own line to make it easier to copy.

Weedpharma

Soil humidity sensors are not very accurate, so that some sensor modules allow to establish an threshold that can be read as a digital value (humidity lower or higher).

Other sensors offer analog values (resistance), which you have to compare (in code) to your threshold values. These sensors allow for more control, like issuing an alarm on too high or too low values, which may indicate a sensor failure or failure in your watering system.

Also check for appropriate housing of the sensor modules, for outdoor use.

Some sensors are for short term use only, not for continuous use as you seem to want. That's why you can find circuits with AC measurement, to prevent electrolysis of the sensor contacts. You may find modules using such technique, or add your own circuit to the analog sensors.

Not sure how far apart you want your sensors.

not sure of the power requirements.

it should be possible to use a solar panel and make a stake with all of your parts on it.
then it could wireless send out the data.

you could have one send data to the next, then that relay the data to the next, so that each one would listen to the ones further away and add their data to it's data.

not sure how often you need the data, if hourly for testing, but once a day for collection might work.

DrDiettrich:
Soil humidity sensors are not very accurate, so that some sensor modules allow to establish an threshold that can be read as a digital value (humidity lower or higher).

Other sensors offer analog values (resistance), which you have to compare (in code) to your threshold values. These sensors allow for more control, like issuing an alarm on too high or too low values, which may indicate a sensor failure or failure in your watering system.

Also check for appropriate housing of the sensor modules, for outdoor use.

Some sensors are for short term use only, not for continuous use as you seem to want. That's why you can find circuits with AC measurement, to prevent electrolysis of the sensor contacts. You may find modules using such technique, or add your own circuit to the analog sensors.

capacitance sensors are reported to change readings if a person comes close.
resistance sensors are effected by soil type, clay vs sand, etc.
probably need some calibration for each sensor before you put them in use. possibly a roaming unit that you put near each other one to verify readings.

Ok, thank you. And yes they are resistance type sensors but these need an AC current going through them when you read them so like you said, it prevents electrolysis, which is what the SMX chip does.

And they would be in the ground most of the summer which is what they are designed to do but I don't need constant readings from them, every 10 minutes would be more than enough.

And as far as power they require, it can be as little as 3 volts or as many as 17 volts and they will function, so I was wondering if I could set it to power up one sensor at a time, read it, power down and then go to the next sensor so I wouldn't ever have to worry about being short on power.

The distance that these are apart is about 6 inches usually but I don't think that it affects them all that much.

If anybody has an example of the code I would need to do something like this and could share it, it would be greatly appreciated!

Page 3 on that link describes the 3 ways that you can wire which are volts, mA or frequency, the only thread I've found with much info on it says to wire it up for frequency output and count pulses, I have no idea how to do that.

They also said to then use the digital pins instead of the analog, according the the info in the link, does that sound right?

I don't know why people are giving you general advice on sensors when you've obviously found a pretty good sensor for the job.

If you were to use the voltage output, its output is only a small fraction of the Arduino's analog input range. The voltage range 200mV to 1600mV will give analog outputs of 40 to 320 on a standard Arduino. This range of 280 steps seems like it is a lot but the inaccuracies of the analog measurement mean that you will only get one-half or one-quarter of this resolution. If you wanted measurements accurate to 1% then this would not be suitable. However, the precision of the sensor is unlikely to be this accurate so you probably need to ignore fluctuations of 5-10%.

One trick to improve the accuracy is to use a lower voltage on your Arduino. A 3.3V Arduino has the full analog scale compressed into 0-3.3V, so it will give you 434 counts of resolution. It also uses much less power so it's more suitable for battery operation, if that's important to you.

If you were to use the frequency output, you can either count pulses over time or you can try to measure the duration of an individual pulse. The Arduino pulseIn() function is not used much but it is capable of measuring the frequency you're looking for. It's an easy way to measure the duration of a single pulse. The disadvantage is that your Arduino can't do anything else while it's waiting for the pulse but that is probably not a problem in this application.

I would try to use pulseIn() first.

Ok, but what would an example of the code look like for the pulseIn() command be for measuring the duration of a single pulse?

Ok, so I made a sketch, no idea if its right or not because when I try and upload it to the arduino it says

Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"

Sketch uses 2,122 bytes (6%) of program storage space. Maximum is 32,256 bytes.

Global variables use 188 bytes (9%) of dynamic memory, leaving 1,860 bytes for local variables. Maximum is 2,048 bytes.

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xca

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xca

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Here is the sketch I made.

int pin = 0;
unsigned long duration;

void setup() {
Serial.begin(9600);
pinMode(pin, INPUT);
}

void loop() {
duration = pulseIn(pin, HIGH);
}

The messages indicate that no Arduino could be detected on USB. Did you select the right board (Uno?) and COM port from the Tools menu? Arduino plugged into USB connector?

Try one of simple example sketches first (Blink...), to find out what's the problem in general.

Hint: use Compile to check your sketch. If it succeeds then the problem with Upload is a physical one, not in your sketch.

I did not try a different sketch today but I did last night and it worked fine. And I did try to compile it and it didn't come up with any errors.

Perhaps your computer assigns different COM ports to the Arduino, whenever reconnected or booted. Check the Port assignment in the Tools menu, does it show an entry like "COM10 (Arduino Uno)"?

Did you read the suggested link:
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

It says its COM3, and I've got it set on Arduino Uno. If I switch to a different port then it simple says that it can't connect or find the arduino. When I switch back to the original usb port then I get the above message after waiting for a couple minutes.

Again: can you upload an example sketch?

The ground itself will shield capacitive sensors from bodies on top of the ground. Assuming you properly shield the wires above ground.