0

Use I2C STEMMA soil sensor w/ analog inputs?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Use I2C STEMMA soil sensor w/ analog inputs?

by sethpetryjohnson on Tue Apr 06, 2021 8:21 pm

Hi there! Not sure if this is the right forum or not; feel free to redirect me if appropriate!

I am working on an irrigation project with a RPi and a custom irrigation HAT from BC Robotics (https://bc-robotics.com/shop/raspberry- ... assembled/). The HAT comes with four analog inputs designed for soil sensors.

I originally bought some analog capacitive soil sensors from Amazon but they're terrible and don't work well. I just placed an order for the STEMMA Soil Sensor from Adafruit (https://www.adafruit.com/product/4026) as a replacement.

However, the Adafruit sensor is an I2C sensor with 4 wires, and I only have three pins per input on my HAT. This is pushing the limits of my understanding, but AFAIU the I2C sensor provides a digital signal while my HAT is looking for analog. Is that right?

If so, is there a DAC that I can use so that I can connect the Adafruit sensors to my HAT? I'm really trying to get away with a single board for this project, but the BC Robotics HAT doesn't give me access to any of the GPIO pins, and I'm not sure what to do next.

If I have to I can use RPi Zeros to do the moisture reading and use the BC Robotics HAT to simply drive my pumps, but that just seems so wasteful.

Any help would be appreciated!

sethpetryjohnson
 
Posts: 2
Joined: Sat Apr 03, 2021 5:24 pm

Re: Use I2C STEMMA soil sensor w/ analog inputs?

by dastels on Tue Apr 06, 2021 10:28 pm

Yes, the hat has 4 analog inputs along the righthand edge. The Adafruit sensor you have is an I2C sensor, hence 4 wires: clock, data, power, and ground.

You can connect the I2C sensors to the Pi's I2C bus that is made available on the hat behind the power screw terminal block. The UART connections are between the power terminals and the I2C. It's all clearly labelled.

Dave

dastels
 
Posts: 6456
Joined: Tue Oct 20, 2015 3:22 pm

Re: Use I2C STEMMA soil sensor w/ analog inputs?

by sethpetryjohnson on Wed Apr 07, 2021 6:28 am

Yeesh, that's painfully obvious now that you point it out ;)

I'm my defense the board in already in an enclosure, and when I built the enclosure I didn't even know what I2C was or why I'd care about those pins, but still obvious in hindsight.

Thanks for the quick reply, you were a big help!

sethpetryjohnson
 
Posts: 2
Joined: Sat Apr 03, 2021 5:24 pm

Re: Use I2C STEMMA soil sensor w/ analog inputs?

by dastels on Wed Apr 07, 2021 10:04 am

My pleasure.

Wiring might be a nuisance. I see plenty of STEMMA-QT hubs, but haven't found a larger STEMMA hub. Remember that they will need unique addresses set using the solder pads on the back. That'll let you use 4 without any extra circuitry. Beyond that you'll need an I2C multiplexer.

Dave

dastels
 
Posts: 6456
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.