Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Ashwini kumar sinha
Published © CC BY

Smart Intelligent Agriculture

A smart automated agriculture system using Ultra96 that can water the plant according to its need and automatically provide fertilizers.

AdvancedFull instructions provided10 hours1,603
Smart Intelligent Agriculture

Things used in this project

Hardware components

Ultra 96
×1

Software apps and online services

Android Studio
Android Studio
python

Story

Read more

Schematics

connections

Code

python code

Python
import mraa
import time

u = mraa.Uart(0)

u.setBaudRate(115200)
u.setMode(8, mraa.UART_PARITY_NONE, 1)
u.setFlowcontrol(False, False)

valve = mraa.Gpio(27)
valve.dir(mraa.DIR_OUT)
valve.write(0)

pump = mraa.Gpio(29)
pump.dir(mraa.DIR_OUT)
pump.write(0)

moisturesensor = mraa.Gpio(33)
moisturesenaor.dir(mraa.DIR_IN)

while True:
	senvalue = int(moisturesensor.read())
	if u.dataAvailable():
       
        data_byte = u.readStr(1)
        print(data_byte)
        
	if(moisturesensor == 1 && data_byte == "F"):
		valve.write(0)
		pump.write(0)
		time.sleep(12)
		valve.write(1)
		pump.write(0)
		
	else if(moisturesensor == 0 && data_byte == "F")
		valve.write(1)
		pump.write(0)
		time.sleep(12)
		valve.write(1)
		pump.write(1)
    else if(moisturesensor == 1 && data_byte == "L"):
		valve.write(0)
		pump.write(1)
		time.sleep(12)
		valve.write(1)
		pump.write(1)
		
	else if(moisturesensor == 0 && data_byte == "L")
		valve.write(1)
		pump.write(1)
		time.sleep(12)
		valve.write(0)
		pump.write(0)
    else if(moisturesensor == 0 && data_byte == "M"):
		valve.write(1)
	else if(moisturesensor == 1 && data_byte == "m"):
		valve.write(1)
	else if(moisturesensor == 1 && data_byte == "V"):
		valve.write(1)
	else if(moisturesensor == 1 && data_byte == "v"):
		valve.write(0)
		
	

Credits

Ashwini kumar sinha

Ashwini kumar sinha

31 projects • 76 followers
Ashwini kumar sinha a Robotic lover and electronics hobbyist. Works at EFY-I

Comments