Lurker News

Comments (181) 53 threads

Earlier comments
nrs263 replies#
I am so excited to see this! I've been working on a very similar project to monitor my outdoor vegetable garden using a raspberry pi and some ESP8266's. Like you, I'm using this as a project to better learn javascript, angular and django. It's in the very early stages, but I'm really loving the experience so far.

Here's a picture of my setup. http://imgur.com/a/BV188
I have a enclosure (that I recently made waterproof) that sits out in my garden that has the ESP8266 wireless chip in there, which works very similar to an Arduino with built in WiFi. I have it reading data in from a soil humidity / temp sensor, an air humidity sensor, a light sensor, and a air temperature sensor.
That data gets sent back to a simple django webserver that I have running (indoors) off of a raspberry pi. It records all the sensor readings every 10 minutes and registers them to various plots in my garden. And then, if there are any big issues (no light for 2 days, lower than average soil humidity or soil temperature, etc), it texts me.
Eventually I'll connect it to my irrigation system, but I don't trust it enough yet!
I have the exact same problem with soil humidity sensors that you mentioned. I even sprung for some fancy ones (http://bit.ly/2sMNRnD) that claim to be waterproof. I cannot make them read useful information and, once it rains or I water outdoors, the sensors read 99% for the next few days. It's very frustrating and the missing piece to make all of this work.
Like you, this started as a quick, month-long project and now it's become something a lot bigger :)
I think eventually I'd like to build this out to be a vegetable garden planner, so I can plan my vegetable garden at the start of the season, monitor what's happening with them, and automatically trigger my irrigation system if needed.
Anyway - it was great to read this! I'd love to hear how this project evolves and would be happy to share any of my experiences as I've put this together.
P.S. And, it's a long shot, but if you (or anyone is reading this) figures how to accurately measure soil humidity temperature in a waterproof environment, I would be forever grateful!

mtlynch#
Thanks for reading.

Your project looks really cool! Is your code open source? I'd love to check it out.

jbeales1 reply#
That looks cool. Does having your electronics enclosed in a greenhouse bring them close to any temperature limits?
nrs26#
Probably! But I haven't had any issues yet.
faster1 reply#
Soil moisture measurements can be scientific if you have enough money. Look up Time Domain Reflectometry and Soil Moisture Tension.

I don't understand TDR well enough to explain it, so I will let you search for your own info. The cheapest usable TDR sensor is about $350.
Tension has a simple analogy; a Slurpee (is that trademarked?) is easy to drink through a straw in the beginning, but it gets harder to pull the liquid up the straw as you drink more of it. That's tension and plants also struggle to pull the water from the soil depending on lots of factors including the composition of the soil, the amount of water present, drainage, etc.
There are several sensors that can be used to measure tension but none are accurate in all conditions, so people who want to measure tension tend to use multiple sensors of different types and triangulate on a useful number.
Large scale farming (in dirt across thousands of acres) is where the complex sensors are needed because the soil attributes are not uniform.
When you're gardening in a pot indoors or in a greenhouse with the same soil everywhere (because you bought bags of it), you can use those $0.43 resistance probes and just calibrate your watering amounts and intervals over time. Pump on for X units of time, ignore for Y units to let the water move through the soil, then sample every Z units until it needs more.

kaybe#
It should be possible to hack together a basic TDR device, especially if you can calibrate it.

Then one needs a/two metal piece of defined length, and a high-frequency oscilloscope, that can also give a pulsed signal (ideally of high frequency).
The biggest issue I see is that you'd need something like at least 0.5 GHz resolution in the oscilloscope with a metal piece of 25cm (quick mental math and some guesses, don't hold me to it). Probably better to have at least 2 GHz. I don't think computers and software alone is up to it after a quick search. Maybe one can increase the travel time in the probe (metal stick) somehow to lower the needed resolution, but not by orders of magnitude.
https://electronics.stackexchange.com/questions/268333/ghz-c...

zfunk1 reply#
Love this. I went down a similar path last year, using a Raspberry Pi to water an outdoor vegetable patch. In the end I used a package [1] to control a remote controlled plug socket. I also hit similar problems with soil moisture, so went down the route of pulling a weather feed - pump water if it isn't going rain. Easy if you are watering outside!

[1] https://github.com/dmcg/raspberry-strogonanoff

mtlynch#
Oh, that's awesome! Doing it outside is interesting because there are a whole different set of challenges. I like your project name.
grw_2 replies#
A raspberry pi is the wrong choice for this project from my perspective, complexity is far too high for a simple project. I looked at building the same thing (minus watering) because it seemed commercial products were way too expensive (Parrot Flower Power is $60!).

The cheapest DIY solution I could think of was ESP8266 ($2), Vreg ($.5), moisture sensor ($.5) and LiPo battery (i have many of these..) but I decided I didn't have time or inclination to write the software.
I continued looking for commercial products, and ordered one of these: https://www.aliexpress.com/item/Chinese-Version-Original-Xia...
Pros- Cheap ($15). Has temperature, light and 'fertility' (capacitance?) sensor. Cons- Logs to phone app (in chinese) via BTLE instead of WiFi.
After a few weeks it seems to be working satisfactorily and I will probably order a few more units.

kingosticks1 reply#
It's only wrong if you are optimising for cost, which they are not.
grw_#
You are right, i edited my comment. I think it's wrong for most perspectives- cost, power use, complexity, security, but it's a good choice if you need high-level programming environment or extensibility.
urethrafranklin1 reply#
Come on. Maybe unless you live in India or Africa (and even then, still), $60 is nowhere near as expensive as designing and building your own device.

Not that there's anything wrong with building your own device. Just don't lie about it.

grw_#
True, I had discounted my time spent on DIY as 'hobby time', which I do for fun and learning. Had I included this then of course it would have been far greater.

I have a few plants I wanted to monitor, so price is more relevant- $300 is more than I'm willing to pay. I think you underestimate how much of the world thinks $60 is unreasonable for such a device, but i don't suppose there's a way to know which of us is right :)

lloydjatkinson2 replies#
Hmm. A MOSFET for a motor switch might be overkill. Also, there's no flyback diode. So your Pi pretty much will let its blue smoke out when you get a flyback voltage, or at least the MOSFET.
mtlynch4 replies#
That sounds... undesirable. Electronics is definitely not my area of expertise, so I'm very open to feedback. What do you recommend?
motardo#
When MOSFETs get hot, that usually means the gate voltage is too low. It looks like your driving the MOSFET gate through a resistor voltage divider. It would be better to drive the gate straight from the PI's GPIO pin. Also a flyback protection diode would be a very good idea.
Jaruzel1 reply#
Wouldn't a relay be easier to integrate? and also keep the pump power circuit isolated from the pi power circuit?
lloydjatkinson1 reply#
Anything involving collapsing magnetic fields, eg solenoids, relays, motors, absolutely simply has to have a flyback diode.

So your suggestion is actually introducing a second magnetic field, so now you've doubled the chances of blowing up your Pi and or the MOSFET.
Whether you're using a transistor/MOSFET directly with a motor or instead with relay + motor you need the flyback diode.

Continue this thread — 1 reply

lloydjatkinson#
Read up on flyback diodes. There are additionally numerous motor driver IC's specifically for this purpose.

A flyback is critical in anything involving a magnetic field, especially a collapsing magnetic field from a motor that stops spinning. The field collapse induces a relatively huge current which will be many many many times greater than anything a normal component is designed for.
Not having one is like driving your car down the highway without any breaks. The only way to stop is to crash.

nerdponx2 replies#
I haven't done much electronic stuff in a good seven years, but this is typically what you would use a relay for, right?
dhartsfield2 replies#
You'd still want a flyback diode, as the voltage spike will arc across the contacts of a relay as well, shortening their life.
lloydjatkinson3 replies#
Yep was going to say exactly this. Anything involving collapsing magnetic fields, eg solenoids, relays, motors, absolutely simply has to have a flyback diode.

Continue this thread — 3 replies

cr0sh#
Something that also exists (but are mainly used on pure or nearly pure electrical systems - think old-school, pre-microcontroller/cpu ladder logic relays and controllers) are "quencher resistors"; these were resistors placed across the coil to absorb the voltage spike. You sometimes see them on automobiles, mainly older vehicles.
kefka#
Long and short, motors store power in magnetics when electricity is flowing. When its not, the coil loses its magnetization and turns back into electricity.

Now think of all the electricity as one big wave. Cause that's what it is. If you were running 12v , you can see upwards of 30v surge. This is bad.
The key is to equalize the power on the motor. And that's done by putting a diode in the reverse flow across the terminals. So that big flow of electrons can equalize itself BEFORE hitting other silicon (like the MOSFET or your RasPi).
Ideally, you want to do this for motors, electromagnets, solenoids, and inductors(well, unless you're doing an L-based filter , but aside the point). They all have this magnetic energy->electricity->surge thing going for them.

Load more comments