smart irrigation system

68
SMART IRRIGATION SYSTEM Scott Francy Gaurav Shah

Upload: ciel

Post on 24-Feb-2016

95 views

Category:

Documents


2 download

DESCRIPTION

Smart irrigation system. Scott Francy Gaurav Shah. Introduction. Modern irrigation system Prediction and real-time input based system Deisgn goals: Helps reduce waste Prevent under watering Prevent over watering Easy to configure and operate. Outline. Project Status Tasks Completed - PowerPoint PPT Presentation

TRANSCRIPT

Smart irrigation system

Smart irrigation systemScott FrancyGaurav Shah

IntroductionModern irrigation systemPrediction and real-time input based systemDeisgn goals:Helps reduce wastePrevent under wateringPrevent over wateringEasy to configure and operate

OutlineBackgroundHistoryMotivationDesign SummaryOverviewWorkflowDetailed DesignInputProcessOutput

Project StatusTasks CompletedTasks in ProgressTasks not StartedRisksBudgetDivison of LaborQuestions

Background

HistoryWater timers

Water controller

Water controller with advanced programming, user interface

Internet enabled controller

MotivationMany controllers today still not efficient enough

Existing controllers do not take advantage of all information sources

Existing controllers use sensors or weather data

Comparison

Design Summary

design

Platform

Xilinx Virtex-4 FX12 Mini Module with VCU Reference BoardFPGAXilinx PowerPCEthernet InterfaceFlash Memory76 user defined I/O pinsOn-board clockWorkflowThe system workflow is broken into 3 categoriesInputProcessOutput

System InputsEmbedded LinuxNTP clientProgram InputDownload weather data using Weather Underground APIUpdate user settings from web interfaceAcquire sensor values from hardwareTemperatureMoistureSystem PRocess

System Output

Sprinkler on or off

Detailed designInputs

user defined SettingsWeb based form usedExternal website user will accessWeb server may not run on FX12 with limited space availableEasier to work with external web serverUser defines base watering scheduleLocation, sprinkler and coverage areaWatering schedule

user defined SettingsUser defines additional settingsZone selectionGPM rating of sprinklersSurface area of zonesGenerates xml file on web serverAfter user clicks submitAccessible by program on FX12

User Defined SettingsParse XML data and assign to program variablesstruct userProgram{ string watering_days; // int day Sun to Sat (0 - 6) string watering_time; // user input as char hh:mm int duration; // duration to water in min string watering_zone; // watering zone ex. 1,3 int sprinklerGPM; // sprinkler GPM rating int surfaceArea; // zone surface area ft2 time_t updatedOn; // when data was updated time_t integerTime; // conv time since epoch};

weather forecastWeatherChannel (wunderground) APIBest option of three different APIs considered (Yahoo, OpenWeatherMap.org)Provides forecast including rain in inchesProvides historySend a fixed URL from the programXML response file generated and downloaded to board using wget

system("wget http://api.wunderground.com/api/63ea9ff4ff38eafa/conditions/q/VA/Richmond.xml -O forecastrss.xml");

weather forecastParse XML data and assign to program variables

struct weatherData{ int dayOfWeek; // day of the week int highTemp; // high of the day int lowTemp; // low of the day bool chanceOfRain; // % chance of rain int humidity_avg; // % of humidity float qpf_in; // predicted rainfall in time_t epochTime; // int time since epoch time_t updatedOn; // last time updated string conditions; // string check condition};sensorsUse SPI to interface with ADCFX12 connected to ADC through reference boardADC supports SPI

SPI InterfaceSPI interface builtUsing 256 bytes

ADCBoth sensors will use ADC through SPIIN0: TemperatureIN1: Moisture

ADCOutput 16 bits (last 12 bits hold converted voltage)

Temperature SensorUsing TMP36 sensorOutput is in degCConvert to degF-40 degC to 125 degC

Analog sensor selected for simplicityOther digital sensors proved problematicProprietary interfaces1-wire interfaces

Temperature SensorMatch scales10 mV / degCRange 100mV to 2000mV750mV at 25 degC

-40 degC -> 0000 0000125 degC -> 0110 0111

Temperature SensorSensor will be inside enclosureNeed to compensate for additional heat inside enclosureDetermine outside ambient temperature

Moisture SensorUsing SEN0114 moisture sensorPasses current through soilReads resistance to determine moisture

Analog sensor selectedAll moisture sensors found were analogInexpensive alternative to rain sensorNot suitable for outdoor use as isPlace in soil where sprinklers do not water

Moisture SensorOutput voltage 0 4.2VMatch scales0 300 0 1.4V : Dry Soil300 700 1.4 2.8V : Humid Soil700 950 2.8 4.2V : Wet Soil

0 value -> 0000 0000 0000950 value -> 1101 0111 0000

Software InterfaceSensors are checked continuously12-bit binary value converted to real valueNot critical to system functionality but critical to efficiency

struct fieldData{ int rawMoisture; // reading is an int representing voltage float moistureValue; // converted moisture value int rawTemp; // reading is an integer representing voltage float tempValue; // converted temperature value bool moistureHigh; // determines whether ground is wet};NTP ClientInstall NTP package in Embedded LinuxConfigure NTPserver 0.rhel.pool.ntp.orgserver 1.rhel.pool.ntp.orgserver 2.rhel.pool.ntp.orgSet service to run automatically# /etc/init.d/ntpd start

Detailed designProcess

System Logicvoid getWeather();// get weather forecast from wundergroundvoid getUserProgram();// get user defined program from websitevoid getSensorValues();// read sensorsreal calc_water_output();// calculates water volume in inchesvoid isStartTime();// determine if SIS should start wateringvoid check_water_stop();// determine if SIS should stop wateringvoid start_water();// start the wateringvoid stop_water();// stop the wateringint dayOfWeek(string);// returns the day of weekint enumerate(string);// converts string to integerFunctions included in wateringAPI class

Program Operation

On FX12 power-on, Linux image loads

NTP client synchronizes with pool.ntp.org

Launches weather program

Program operation

User defined settings and watering schedule fetched from website

void WateringAPI::getUserProgram(){ . . .}Program operationWeather data fetched from wundergroundXML file parsedData stored into program variables

void WateringAPI::getWeather(){ . . .}Program operationRaw sensor values readRaw values converted to real values

void WateringAPI::getSensorValues(){ . . .}

Program operationQuick WaterAt high temperatures above 95 degFIf no watering scheduled todayOne-time water for half the user defined duration

void WateringAPI::isStartTime(){ . . .}

Program operationDetermine if watering should commenceRequirements to start waterDay and time in user defined schedule has occurredIt is not rainingNo rain is forecast for todayThe weekly watering limit has not been reached

void WateringAPI::isStartTime(){ . . .}

Program Operation

Starts the watering sequencevoid WateringAPI::start_water(){ . . .}Program OperationDetermines if the user specified watering interval has occurredChecks if it has started raining

void WateringAPI::check_water_stop(){ . . .}

Program OperationStops the watering sequenceCalculates the water run time and adds it to the totalizer for water runtimevoid WateringAPI::stop_water(){ . . .}

Program OperationTotal water volume is also calculatedTwo conflicting formulas found1) Water run time * GPM rating of sprinkler * 96.3 / sprinkler coverage area ft22) Water run time * GPM rating of sprinkler * .62 gallons / 1ft2Result is amount of water dispersed in inchesThis value is added to the downloaded rainfall volumefloat WateringAPI::calc_water_output(){ . . .}Detailed designOutputs

outputOutput of system is turning the sprinklers on or offControlled by start_water() and stop_water() functionsStatus maintained by bool isWatering variable

LEDs will be used to simulate sprinkler valve open / closed10mm Green LED (COM-08861)Actual system would require relays and solenoid valvesNot required for prototype

outputDefine GPIO, map pin locations in UCFBUF_OUTPUT0 -> DO Header Pin 18BUF_OUTPUT1 -> DO Header Pin 17BUF_OUTPUT2 -> DO Header Pin 16BUF_OUTPUT3 -> DO Header Pin 15

Map virtual memory addresses to digital output hardware address

Write to virtual memory address

outputRolling 7 day totalizer of watering volume in inchesIf system resets, water volume tracking would be lostSave calculated values to file after every updateUse persistent storage in flash (newfs.bin)Save value for each day to maintain rolling 7 day totalizer

LCD DisplayLCD Display16x2Serial Interface9600 to 38400 baud8-N-1Used to show current system statusActive / InactiveWhile wateringZone indicationTime LeftWhile idleNext water timeTotal water dispersed over last 7 days

EnclosureNEMA-4 Enclosure (PN-1341-C)Snug fit for reference boardFix standoffs on bottom for ref boardCutout for LCDHoles for external inputsPowerMoisture Sensor

Project Status

Tasks completedProcurementMoisture sensorTemperature sensorLCD displayWiresHardwareSPI build in EDKSynthesis

SoftwareArchitecture, classesData types / structsFunction implementationgetWeather()getUserProgram()start_water()stop_water()dayOfWeek(string);enumerate(string);

Tasks In Progress (Active)SoftwareMemory address mappingSPI ADCFunction implementationgetSensorValues()calc_water_output()isStartTime()check_water_stop()

Not StartedProcurementEnclosureMounting hardware

HardwareLCD interfaceUARTDigital OutputsSynthesisConstruction

SoftwareNTP clientPersistent IP addressFile OutputLCD output

Execute Test Plan

System Documentation

scheduleTaskDue DateFix SPI ADC address mapping problemMarch 14Complete function implementationMarch 14Build UART and DO in EDKMarch 14NTP clientMarch 21Output to LCDMarch 21Milestone: Hardware Interfaces CompleteMarch 21Order enclosure and mounting hardwareMarch 21Persistent IP addressMarch 28File OutputMarch 28Milestone: Initial Implementation CompleteApril 4Develop test program, demo mode April 4Execute full system test April 4Construction April 4

Schedule cont.TaskDue DateRefine program accuracy from test resultsApril 11Execute full system testApril 11Milestone: Testing and Analysis CompleteApril 11Build EXPO displayApril 11Senior Design EXPOApril 18System DocumentationApril 18Build system demonstration programApril 25Milestone: Implementation CompleteApril 25System DemonstrationApril 29Final Design ReportMay 6

Testing - inputsSensorsCollect samples at various temperature / moisture levelCheck % ErrorWateringAPI ClassWrite test codeCheck individual components of the class, compare to expected outputCheck data types (Structs)Write data and read backUser InputWeb based form validationData parsed properlyTesting Process (Algorithm)Dynamic testing with various weather conditionsFast forward time for faster program testingFeed in dummy input from defined input setUser input stays sameSensorsTemperature: Normal, HighMoisture: Low, Normal, HighWeather APIChance of rain: None, % Chance of RainTesting log Write input and output to file to document test resultsTesting - OutputsVerify output pins high when watering is activeUse LEDsVerify LCD screen displaying correct dataCompare to expected output during testingVary rain volume for totalizer validationCompare rainfall totalizer to manually calculated weather historyManually compare runtime * GPM * area formula to totalizer

Risks

RisksNTP ClientKnown to work on LinuxUnknown if any problems will exist with this embedded Linux imageAlternative is to use a time APIhttp://www.timeapi.org

Rain Volume CalculationTwo conflicting formulas found to calculate watering volumeNeed to research furtherBudget

Original Budget10mm Green LED (COM-08861)$1.50Qty 4Waterproof Temperature Sensor (DS18B20)$9.95Qty 1Soil Moisture Sensor (SEN0114)$4.80Qty 1NEMA-4 Enclosure (PN1341-C)$37.00Qty 14 x 8 Plywood for demo display$35.00Qty 1Misc. wire, screws, standoffs$10.00Signage$25.00

Latest Budget10mm Green LED (COM-08861)$1.50Qty 4Temperature Sensor (SEN-10988) $1.50Qty 2Soil Moisture Sensor (SEN0114)$5.95Qty 1Wires (40 count)$5.63Qty 1LCD (LCD-09067)$24.95Qty 1NEMA-4 Enclosure (PN1341-C)$37.00Qty 14 x 8 Plywood for demo display$24.12Qty 1Misc. wire, screws, standoffs$10.00Signage$25.00

Division of Labor

Gaurav ShahClass definitionsUser Web InterfaceXML ParsinggetWeather() functiongetUserProgram() functiondayOfWeek() functionEnumerate() function

NTP clientPersistent IP addressPersistent file storageTest Plan

Scott FrancyStruct definitionsgetSensorValues() functioncalc_water_output() functionstart_water() functionstop_water() functionProcurement

SPI ADCDigital OutputsUARTSynthesisLCDConstruction

Shared TasksDesign ReportCDR slidesisStartTime() functioncheck_water_stop() functionCDR ReportTest plan executionDocumentationFinal Design Report

Q&A