CSC231-aa Software Description

From CSclasswiki
Jump to: navigation, search

Groduino Software Description

The Arduino-powered prototype for a semi-automated terrarium that monitors various environmental inputs and displays alerts on the computer screen.

Arduino Sketch

This will essentially be arduino loop sketch we've already used in previous assignments. When commands are sent by the assembly program, the arduino will switch the appropriate pins on/off to power the appropriate hardware circuits, or will read in pins designated as inputs.

  • setup():
    • Set pins analog 1 (relay) and 2 (soil moisture probes) as output.
    • Set pins 3 (LDR) and 4 (thermistor) as input.
  • loop():
  1. When certain weather and time conditions are met, the Arduino will switch the relay on.
  2. The Arduino will constantly read in input from the LDR (to determine whether or not it is night; cross-reference this with system time), thermistor (for temperature), and soil moisture probe (determine the level of moisture in the soil.)

Driver.c

A mixture of both driver.c program we've used before to relay commands to the arduino and the c program detailed in the comments to get the system time. The driver.c program will also employ the wget command to retrieve a web page detailing the current weather.

Assembly code

The assembly code will run several processes simultaneously. On a user-level, it will maintain a status report, reading in the system time and updating itself either every half-hour, or every minute for the purposes of the demo, or else when the moisture level status changes. The status reports will read something like such:

<8:30 AM> SYSTEM ON. 60° CLOUDY NEEDS WATER.
<8:40 AM> SYSTEM ON. 62° CLOUDY NEEDS WATER.
<8:43 AM> SYSTEM ON. 62° CLOUDY PLANT WATERED.




The assembly code will parse a simple html page, locating the current weather of the day between certain tags; simultaneously, it keeps track of the time. If it is night-time, after 6:30 PM, the system shuts off; the light relay will not turn on, and temperature and moisture will not be monitored. If it is before that time, and after 7:00 AM, then the system is on; if the weather is cloudy, then the light will be turned on. If the weather is clear, the light will remain off, as it is assumed that the plant will receive sunlight.

It will simultaneously keep track of moisture levels. If the soil is dry, it will play a wav sound ("Please water the plant!") and display an alert in the status update telling the user of the plant's predicament. If a change in moisture is detected, that is, that the user has just recently watered the plant, a different wav sound will be played ("Thank you!") and the status will be updated. If the plant is over watered, the appropriate wav file will play, and the status will update itself accordingly.