Moisture sensor integration

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Moisture sensor integration

Post by liquidsquid793 »

Hi all,

Because I have a tendency to kill plants due to neglect in my office while concentrating/obsessing over work, I decided to get a Clue board as the "brains" of a project, and 4 capacitive moisture sensors, and 4 of the better brass valves among some Stemma cables. I have a bunch of spare little supplies, jumper wires, soldering iron, etc. However, being new to Adafruit (I resisted for years) I am uncertain of how to handle the following questions:

1. The solenoids for the 4 valves require significant current to reliably open and close. My plan is to use rated 12V @2A to assure they open well. I have been unable to find a ready-made PCB with FET or BJT switches for activating the solenoids and DC loads, so I think I may be forced to develop one myself. I don't want to breadboard it for heat and current reasons, and some of the better parts are SMT. Does anyone know of an off-the-shelf means to individually control 4x these big old valves? I only plan on opening one at a time to keep total consumption down, and address them via I2C on an expander if I make my own board. (Is there any interest, should I make more than one? What Stemma connector should I use, the 2mm?)

2. The I2C bus, I see most sensor boards only have a single connector on them, so I cannot feed through from one board to another easily. What is normally done? Using the I2C muxing board to distribute? Custom Stemma cables I would bridge together myself? I know I can only access so many I2C devices on a single bus before the drivers wont deal with the capacitive load.

3. It looks like the moisture sensor boards have two pads for address changes on the I2C bus. It is unclear if they support 4x unique addresses. How many does it support?

4. I see two types of Stemma, 2mm and 1mm systems. I assume the JST-PH is the 2mm connector on the sensors, yet the Clue seems to have a JST-SH? From the picture it looks like the Stemma on the Clue has no power pin, I only see three pins. I have not been able to find further details on this Clue connector yet. Does this mean it does not supply power to external sensors over the cable?

5. Does Clue have a graphics library in the distribution for creating bar-graphs and charts on the display? I have not dug into the code at all yet. Curious what would need to be done to enable that (have written graphics libraries in the past, don't care to ever do that again).

6. My plan is to "conformal coat" the sensors (not the probe) with clear Krylon paint. Is there something better to use to keep them from not corroding long-term in a plant pot?

This is the first at home project I have done in years, being a normally over-worked engineer. Fairly excited about developing something for myself for a change. Long history in the hobby industry before moving to a more complex job.

Thanks for any support!
Mark W.

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

Well, found an answer for point #4. Looks like I need to purchase some adapter cables (at least one)

https://learn.adafruit.com/introducing- ... comparison
Bummer.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Moisture sensor integration

Post by adafruit_support_mike »

liquidsquid793 wrote:Does anyone know of an off-the-shelf means to individually control 4x these big old valves?
The DRV8871 breakout can handle two 2A signals:

https://www.adafruit.com/product/3190

Officially it's a motor driver, so each half is an H-bridge: the connections can send current either way through a coil. That won't be much use for relay control, but won't hurt.
liquidsquid793 wrote:The I2C bus [ . . . ] What is normally done?
I2C networks normally use a star topology. There's a single main cable for power, GND, SDA, and SCL, with taps for each device. Sparkfun's Qwiic adapter provides those connections if you want to use STEMMA cables and direct wiring to specific boards:

https://www.adafruit.com/product/4527

And the Multi Port makes it easy to tap in with cables:

https://www.adafruit.com/product/4861
liquidsquid793 wrote:3. It looks like the moisture sensor boards have two pads for address changes on the I2C bus. It is unclear if they support 4x unique addresses. How many does it support?
Four: each pad is one bit in the I2C address. Connecting them to VCC sets the bits high, and connecting them to GND sets the bits low.
liquidsquid793 wrote:Does Clue have a graphics library in the distribution for creating bar-graphs and charts on the display?
Not per se, but it does have graphics primitives like text, lines, and rectangles.
liquidsquid793 wrote:6. My plan is to "conformal coat" the sensors (not the probe) with clear Krylon paint. Is there something better to use to keep them from not corroding long-term in a plant pot?
That would probably be a polyurethane, which can be brittle. Electronics are usually potted in epoxy or silicone, which are more durable and waterproof.

User avatar
kevinjwalters
 
Posts: 1026
Joined: Sun Oct 01, 2017 3:15 pm

Re: Moisture sensor integration

Post by kevinjwalters »

Andreas Speiss talks about the issues with the edges of the capactive soil sensors in a video mentioned on STEMMA soil (capacitive) sensor longevity.

I've been temporarily scuppered by Texas weather (Mouser has a warehouse there) but will eventually get to try out his plastic bag idea.

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

adafruit_support_mike wrote: The DRV8871 breakout can handle two 2A signals:

https://www.adafruit.com/product/3190

Officially it's a motor driver, so each half is an H-bridge: the connections can send current either way through a coil. That won't be much use for relay control, but won't hurt.
Thanks, I wound up finding an opto-isolated clunker on Amazon. A bit disappointed in the quality of the boards and the fact they do not have an I2C expander at the heart of it, but they are cheap. If this all works fairly well, I may spin a board that has the drivers and a position for the CLUE directly on it to minimize wires.
adafruit_support_mike wrote:
liquidsquid793 wrote:The I2C bus [ . . . ] What is normally done?
I2C networks normally use a star topology. There's a single main cable for power, GND, SDA, and SCL, with taps for each device. Sparkfun's Qwiic adapter provides those connections if you want to use STEMMA cables and direct wiring to specific boards:

https://www.adafruit.com/product/4527

And the Multi Port makes it easy to tap in with cables:

https://www.adafruit.com/product/4861
Again thanks. That would be a cleaner way to do it rather than simply soldering wires together as I am planning. I am now considering running signals across the front of the porch when we put up hanging plants in the spring. I always forget to water them, so I am considering some options for a more sturdy noise resistant longer range communications than low voltage I2C. For now, just getting things running before I "harden" it.
adafruit_support_mike wrote:
liquidsquid793 wrote:3. It looks like the moisture sensor boards have two pads for address changes on the I2C bus. It is unclear if they support 4x unique addresses. How many does it support?
Four: each pad is one bit in the I2C address. Connecting them to VCC sets the bits high, and connecting them to GND sets the bits low.
Thanks, perfect. For now... until I crank up the amount of sensors using an I2C mux.
adafruit_support_mike wrote:
liquidsquid793 wrote:Does Clue have a graphics library in the distribution for creating bar-graphs and charts on the display?
Not per se, but it does have graphics primitives like text, lines, and rectangles.
More than adequate! My fear was having to come up with my own line/circle/poly fill routines again. *shudder*. I made the mistake of using a COG display once, it has zero support other than a font table and a memory map with a few pages. Ugh.
adafruit_support_mike wrote:
liquidsquid793 wrote:6. My plan is to "conformal coat" the sensors (not the probe) with clear Krylon paint. Is there something better to use to keep them from not corroding long-term in a plant pot?
That would probably be a polyurethane, which can be brittle. Electronics are usually potted in epoxy or silicone, which are more durable and waterproof.


Krylon make a good poor-man's conformal coat, even having a little bit of UV resistance and slight flexibility, but a bit brittle over time as you suggest. It is really hard to get PCBs at home clean enough from soldering flux to make the other two work effectively. Just a thin layer of flux after not washing enough is an avenue for water/corrosion. Organic flux is a nightmare for moisture intrusion. Krylon actually seems to dissolve it away somewhat. Weird, I know.


Thanks for your time and help! Much to learn in this maker community.

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

kevinjwalters wrote:Andreas Speiss talks about the issues with the edges of the capactive soil sensors in a video mentioned on STEMMA soil (capacitive) sensor longevity.

I've been temporarily scuppered by Texas weather (Mouser has a warehouse there) but will eventually get to try out his plastic bag idea.
A simple solution would be to use clear nail polish along the edges. Even better would be to produce the PCBs using a moisture-resistant laminate. For something that will be stuck in wet corrosive soils, these really need some kind of treatment from the factory.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Moisture sensor integration

Post by adafruit_support_mike »

liquidsquid793 wrote:It is really hard to get PCBs at home clean enough from soldering flux to make the other two work effectively. Just a thin layer of flux after not washing enough is an avenue for water/corrosion. Organic flux is a nightmare for moisture intrusion.
Yeah, cleaning PCBs is kind of technical. There are three parameters of interest: polarity (water versus oils), branching (in nonpolar solvents), and hydrogen bonding. This page has a good overview of the subject:

https://cool.culturalheritage.org/coola ... 03-04.html

For rosin-based solder, I've found that a mix of 60% toluene, 20% acetone, and 20% ethanol dissolves both the volatiles and the waxes, then evaporates well. Soak the board in a closed container for several minutes to keep the fumes down, let it dry for a few seconds, then let it soak in a hot solution of mild sodium hydroxide (lye) for 10 minutes or so. The sodium hydroxide breaks down any remaining organic film, and leaves an activated surface ready to bond with just about anything.
liquidsquid793 wrote:Krylon actually seems to dissolve it away somewhat. Weird, I know.
The chemistry is mostly the same as the above, without the NaOH bath. The paint solvent dissolves volatiles and oils, then they mix into the polymer that makes up the bulk of coating.

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

One last favor please before I leave you alone:

The Clue and other boards have this interesting edge connector. What connector/series does it mate to, and does Adafruit supply the connector? I see some mating boards, but I just didn't spend a lot of time digging up the specific part. I am thinking of my peripheral electronics being put onto a single board in which the Clue plugs into rather than just terminals and wires which would be a little clunky. That way I can shove the majority of it into a small enclosure with a clean appearance.

Thanks

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

Right on the product page for Clue. What I am having trouble with is the manufacturer/part number or datasheet so I can draw a symbol/footprint for the device (Altium, 3D step, etc.)

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

liquidsquid793 wrote:Right on the product page for Clue. What I am having trouble with is the manufacturer/part number or datasheet so I can draw a symbol/footprint for the device (Altium, 3D step, etc.)
Yikes. Trying to find already drawn parts in whatever reference designs have turned into a chore. I should have just spent my time drawing one from scratch, except the only 3D model I can find is for a through-hole version of the connector that I cannot find the part/datasheet for on the manufacturer site. What manufacturers I can find (that don't have an alignment pin) are hopeless for supplying data apart from a simple datasheet.

So I guess what I am looking for is a reference design that includes this mating connector, preferably Altium/Circuit Studio as KiCAD importer is not working to lower implementation risk. I am expecting that is asking for a bit much. I will not try to be critical of design choices here but winding up pretty frustrated.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Moisture sensor integration

Post by adafruit_support_mike »

The Clue has the same connection layout as the BBC's micro:bit. We have datasheets for the straight and right-angle versions:

http://www.adafruit.com/product/3888
http://www.adafruit.com/product/3342

https://cdn-shop.adafruit.com/product-f ... asheet.pdf
https://cdn-shop.adafruit.com/product-f ... asheet.pdf

More generally, they're 40-pin single-row, 1.27mm-pitch, board edge connectors. Digikey has a selection in different colors:

https://www.digikey.com/en/products/fil ... iE4eY0aJAA

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

Thanks,
I should be more specific in that I was looking for an importable footprint/symbol for my tool chain to save time. None of the parts in DigiKey have a model associated with it, and there are no models in the public libraries associated with Altium, which is unfortunate. Not a huge deal, but drawing up new footprints takes time. Doing it as a day job doesn't leave a lot of patience for in the evening.

BTW some of my parts arrived and they fired right up! Smaller than I pictured... going to need my reading glasses on this one. No longer young.

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

A timely article on keeping circuits dry:

(From Altium)
https://resources.altium.com/p/keeping- ... nt=article

User avatar
kevinjwalters
 
Posts: 1026
Joined: Sun Oct 01, 2017 3:15 pm

Re: Moisture sensor integration

Post by kevinjwalters »

I've just noticed this article but it doesn't cover sealing the edges: Waterproofing a Capacitance Soil Moisture Sensor.

The edge sealing comes up in the comments.
ivanhoe011
Nail polish to the rescue... or superglue or epoxy, which btw can be used to seal the whole thing (and epoxy being clear you can still see inside, to know if there's corrosion or anything else funky going on, so it's even better IMHO)
diy_bloke
I can't vouch for all nail polish as i had some that dissolved after a few days. PlastiDip wirks [sic] great

User avatar
liquidsquid793
 
Posts: 25
Joined: Sat Feb 27, 2021 4:16 pm

Re: Moisture sensor integration

Post by liquidsquid793 »

Well, this is turning into a bit larger project than expected.

I received the moisture sensors from Digikey, and connecting a single one to the Clue board. The board detects and returns a weird version number on startup (when the serial port decides to work as the turn-around time from programming it is too fast for Windows). However, on the next access, the seesaw driver hangs up and wont return. I cannot get the touch or temperature out. It is difficult to track down this issue where things are going astray when I have no JTAG to work with.

Version returned: 0xFBA278F

I have tried the soil_sensor demonstration, and re-used that code on the plotting Clue example as my baseline app. Both do the same thing with lockups.

In the case of the soil_sensor app, I can get temperature and moisture out once by unplugging and re-inserting the soil sensor onto the stemma cable, then it hangs up again. Because of this behavior, I think boards and connectivity is correct. Detaching the board creates the "ack" event.

I am fairly certain I don't have an address conflict as I get no detection without a sensor, and a version result (but incorrect) with it installed.

I haven't dug in too deep, but I am curious if the pull-ups on the I2C bus are not low enough in value to deal with all of the devices connected to the I2C bus and this has pushed timing over the edge? It appears an ack isn't seen so the I2C communications is waiting forever for it.

Are these boards from Digikey old and have a buggy image on them?

Has anyone else had success with the soil moisture devices on the Clue?

Thanks in advance.

-Mark

Locked
Please be positive and constructive with your questions and comments.

Return to “CLUE Board”