Soil moisture with raspberrypi 3


#1

I am new to this platform , so can anyone help me in how to get data from soil moisture using raspberry pi 3
when i tried to add widget it doesn’t gave any option in connectivity and channel.


#2

Hi
You must have added ADC converter to Raspberry Pi because Raspberry Pi does not have an ADC converter.
Then connect the analog sensor to the ADC.


#3

I am using soil sensor with a adc sbt4447 which has 2 input pins which is going to sensor and 4 pins in which two are for power i.e vcc and gnd and other two are a0 and d0.


#4

RaspPi - Sensor
3.3V - Vcc
Gnd - Gnd
Digital pin - D0

A0 must connect to ADC converter.


#5

Thank you tad.dvor


#6

Hello, I was wondering if it is a good idea to use an Arduino pro mini 3.3 etc to take readings from the sensor every so often? I was reading on some of the instructions with the soil sensors that leaving them powered on all the time could cause them to corrode? would it be possible to use a Arduino pro mini 3.3 volt, a Sparkfun SEN-13637 and then send the readings to Cayenne through a RaspberryPI 3 that is already running some other temp sensors relays etc? Code from Sparkfun:

/* Soil Mositure Basic Example
This sketch was written by SparkFun Electronics
Joel Bartlett
August 31, 2015

Basic skecth to print out soil moisture values to the Serial Monitor 

Released under the MIT License(http://opensource.org/licenses/MIT)

*/

int val = 0; //value for storing moisture value
int soilPin = A0;//Declare a variable for the soil moisture sensor
int soilPower = 7;//Variable for Soil moisture Power

//Rather than powering the sensor through the 3.3V or 5V pins,
//we’ll use a digital pin to power the sensor. This will
//prevent corrosion of the sensor as it sits in the soil.

void setup()
{
Serial.begin(9600); // open serial over USB

pinMode(soilPower, OUTPUT);//Set D7 as an OUTPUT
digitalWrite(soilPower, LOW);//Set to LOW so no power is flowing through the sensor
}

void loop()
{
Serial.print("Soil Moisture = ");
//get soil moisture value from the function below and print it
Serial.println(readSoil());

//This 1 second timefrme is used so you can test the sensor and see it change in real-time.
//For in-plant applications, you will want to take readings much less frequently.
delay(1000);//take a reading every second
}
//This is a function used to get the soil moisture content
int readSoil()
{

digitalWrite(soilPower, HIGH);//turn D7 "On"
delay(10);//wait 10 milliseconds 
val = analogRead(soilPin);//Read the SIG value form sensor 
digitalWrite(soilPower, LOW);//turn D7 "Off"
return val;//send current moisture value

}

Thanks, Adam