I'm completely new to RPi, and I'd like to make a garden project, at first I would like to measure the soil moisture.
I purchased one of these sensors https://www.amazon.com/Analog-Capacitive-Moisture-Corrosion-Resistant/dp/B07N11R8MD and also an ADS1015 ADC.
I followed the tutorial on this page, so I know my ADC is working properly https://learn.adafruit.com/adafruit-4-channel-adc-breakouts/python-circuitpython , after that I connected my sensor to the setup. VCC of the sensor is connected to the 3V3 of the RPi, GND to RPi GND, AOut to ADC A0.
In this case I don't get the right value since when it's dry i get 0 and when wet also 0 ( when i touch the sensor i get some value not 0).
After that i connected the vcc of the sensor to the 5V of the RPi. In this case I get right values as when dry 30000 when the sensor is in a glass of water it's 16000.
I read something about having to be careful with the 5V Pin, but I don't really understand if it's allowed to use the 5V Pin as a power source for the sensor?
My setup looks like this: https://banasiak.com/blog/wp-content/uploads/2019/09/pepperbot2_bb3.png
import board import busio import adafruit_ads1x15.ads1015 as ADS import RPi.GPIO as GPIO from time import sleep i2c = busio.I2C(board.SCL, board.SDA) from adafruit_ads1x15.analog_in import AnalogIn ads = ADS.ADS1015(i2c) chan0 = AnalogIn(ads, ADS.P0) chan1 = AnalogIn(ads, ADS.P1) while True: print('Channel 0 is:',chan0.value, chan0.voltage) #print('Channel 1 is:',chan1.value, chan1.voltage) sleep(1)
Later on I would like to expand my project with more Soil moisture Sensor and a Relay controlling a pump. Thanks for any help.