In air, not touching: ~0
In air, touching: ~1023
In soil,
--very wet: ~900
--optimal: 700-800
--needs water: ~650
--definitely needs water: <625
Leads (moisture sensor) in soil. |
Python code to do something with the values read from serial is given below:
#import libraries
import serial
import math
#open serial communication
arduino = serial.Serial('/dev/ttyACM0', 9600)
if serial.Serial.inWaiting >= 5:
#control corresponds to 100% light transmittance (in absence of any #petri dish); each respective sample reading corresponds to the light #transmittance through that petri dish.
val1 = float(arduino.readline())
val2 = float(arduino.readline())
val3 = float(arduino.readline())
val4 = float(arduino.readline())
val5 = float(arduino.readline())
#calculate soil moisture reading
moistureValue = float((val1 + val2 + val3 + val4 + val5)/5)
if moistureValue < 625:
print("omg so thirsty so thirsty need water")
elif moistureValue > 625 and moistureValue < 700:
print("I'm starting to get thirsty")
elif moistureValue > 700 and moistureValue < 800:
print("I feel so hydrated!")
elif moistureValue > 800:
print("Gross, I feel bloated")
#print out absorbance values in neat table
print "moisture value: " + str(moistureValue)
Can you post a schematic or image of the arduino with wires hooked up? I have a project that I'd like to make with a pallet garden.
ReplyDelete