I’d like to connect a soil moisture sensor to a diaphragm irrigation valve such that the sensor actuates the valve when the moisture level drops below a user-defined threshold. The valve is equipped with a solenoid for actuation. The moisture sensor should be solar-powered, but the valve doesn’t have to be. The sensor and the solenoid should communicate wirelessly.
Initially, I only want to control one valve. Eventually I’d like to control two dozen valves or so. On a long enough timeline, the system would be controlled by a phone and could receive input from other sensors (temperature, pressure, humidity, etc).
Locating the sensor on the website is easy enough. However, can you please help me determine the most optimal models of other hardware that I would need (boards, solar panels, battery backup, etc.)?
Thank you!
Hi evanlavin,
To get started with this project, I would recommend taking a look at our guides for the SparkFun Photon Weather Shield. Specifically, the [Optional Peripherals section goes over using the Soil Moisture Sensor with this shield and a [Particle Photon. The [Particle Docs page will help you familiarize yourself with the Photon and the Particle IDE.
The Photon Weather Shield has some optional power options to add in a battery or solar power source. The [SparkFun Sunny Buddy will help to efficiently charge an attached battery to keep the project powered up.
On the solenoid end of the circuit, you would need another Photon or other WiFi-connected microcontroller to listen to the sensor data and then trigger a relay to power the solenoid since the digital output of a microcontroller would most likely not be able to power a solenoid on its own. We have quite a few different relays available in our [relay category if you want to look through that.
I hope this helps you get started with this project. Let us know if you have any follow-up questions about these or another of our products and we would be happy to help as much as we can.](Relay - SparkFun Electronics)](https://www.sparkfun.com/products/12885)](https://docs.particle.io/)](Particle Photon (Headers) - WRL-13774 - SparkFun Electronics)](Photon Weather Shield Hookup Guide V11 - SparkFun Learn)
Hi, TS-Mark~
Apologies, I had no idea that you had responded here. Not sure how the notifications work. Thank you for your feedback.
I’ve actually purchased a photon and photon weather shield, and the process of working with particle has been completely unproductive and disappointing. At this point, I’m not interested in utilizing their platform if I can possibly avoid it. If I purchase an Arduino weathershield, can you tell me if it’s possible to combine it with soil moisture and temperature sensors? I don’t see anything on your Arduino weathershield hookup guide, but I’ve had much better luck interfacing with Arduino via Linux in the past (as opposed to zero luck with particle).
Thanks!
Evan
Hi Evan,
Not a problem. You can enable notification settings in your profile for any of your posts or for entire forums or you can click the “Subscribe Topic” button near the top of this page next to the “E-mail”, “Print View” and “Bookmark Topic” buttons if you want e-mail notifications of a reply.
As for attaching a soil moisture sensor and (I assume) a soil temperature sensor to an Arduino with a Weather Shield, you can but will most likely need to use an Arduino with a larger pinout than the Uno since the Weather Shield utilizes all six Analog pins on a standard Uno/Uno clone. What you could do is modify the Weather Shield (assuming you are using an R3 Arduino that has dedicated SDA/SCL pins) to disconnect A4 and A5 from the I2C bus and then use those pins for the inputs from the temp and soil moisture sensors. You can either sever the trace going to those pins from the rest of the Weather Shield’s I2C circuit or you can bend out or not solder pins for A4/A5. For code, I would recommend taking a look at our [Hookup Guide for the Soil Moisture sensor. Depending on which temperature probe you choose, there may be example code out there for that as well like this [DS18B20 Temperature Sensor.
I hope this helps!](Temperature Sensor - Waterproof (DS18B20) - SEN-11050 - SparkFun Electronics)](Soil Moisture Sensor Hookup Guide - SparkFun Learn)
It seems like something like the Arduino Due would be better. The Due appears to have the same pin pattern as the Uno, so I’m assuming the weather shield would work with the Due as well. Are you able to verify? Thanks!
Hi again Evan,
While the Due has the same pinout as an Uno, it runs on a different processor (SAM vs AVR) so you might run into some compatibility problems with our example code. A quick test did not throw any compile errors when testing with the [Basic Firmware Example for the Weathe Shield so it will at least compile and upload to the board. You may need to tweak the code a bit, specifically the Wire.begin(); call, but otherwise, the Due will have more than enough pins to add a soil moisture and temperature sensor to your circuit.](Arduino Weather Shield Hookup Guide V12 - SparkFun Learn)
It would be much easier to add a ESP8266 module than to try to add a USB enabled WiFi adapter.
Ordered, thanks!
Next question: I need to add an LCD display to my weather node. At the moment it just needs to output pre-defined text. Eventually it will need to display sensor output, but for now I’d be happy with Hello World. I’m using an LCD 1602 that I’m nearly certain supports the Hitachi HD44780 driver (I got it in the Elegoo Most Complete Arduino Mega 2560 Starter Kit).
Ordered, thanks!
Next question: I need to add an LCD display to my weather node. At the moment it just needs to output pre-defined text. Eventually it will need to display sensor output, but for now I’d be happy with Hello World. I’m using an LCD 1602 that I’m nearly certain supports the Hitachi HD44780 driver (I got it in the Elegoo Most Complete Arduino Mega 2560 Starter Kit). Attached is a pic of my code.
Nothing mystical. Works fine on its own. Once I combine it with SparkFun’s Weather Shield sketch, which has a soil moisture sensor added and works fine either way, the LCD outputs gibberish. Currently it’s splashing “fff” for like a second on startup. In the past it’s displayed random assortments of question marks and such. The weather shield still works the same. The serial monitor outputs identically with or without the LCD. It’s been suggested that perhaps the issue is how power is distributed in the SF Weather Shield sketch. It’s also occurred to me that perhaps serial.begin or serial.println are interfering with lcd.begin or lcd.println, but I’m new enough to Arduino that I’m not sure. Do you have any suggestions before I spend hours beating my head against it?
Hello,
Are you using a LCD screen from the SparkFun product catalog?
Also, I can’t really get a good idea of what is going on within your code from the screenshot. Can you host the file somewhere else like GitHub and link to it?
I’m using an Elegoo LCD1602 display. It came in their most complete Arduino mega starter kit ( https://smile.amazon.com/gp/product/B01 … UTF8&psc=1 ). I’m looking into GitHub now. Thanks
Combining code can get tricky and I’m wondering if the different sections of your sketch are conflicting with one another.
Unfortunately we can not offer support for a non SparkFun product, but we may have a LCD that’s easier to use. The LCD you’re using now is a parallel LCD and we carry a serial LCD that only needs 1 wire to communicate. (When in serial mode)
Our [SerLCD might be easier to implement. You only need to send serially what you want to display.](https://www.sparkfun.com/products/14072)
You should be able to view the code here: https://github.com/evanlavin/evanlavin.github.io
It seems to be identical to SparkFun’s sample code for your corresponding module except for how the pins are assigned.
The larger sketch including the weather shield code is in there, too, except I commented out the second counter in the void loop.
The link you provided doesn’t link to your code unfortunately.
The code and module I’m using are identical to [this except I’m calling the pins directly as arguments instead of defining them as variables and then calling the variables. I wouldn’t think that would make a difference.](https://learn.sparkfun.com/tutorials/basic-character-lcd-hookup-guide)
Does the link work at all, or is it broken?
Okay. Can you view the attachment here? It threw me an error message
Seriously, what kinds of files am I allowed to attach here?