Design Project

 Software OverviewYear: 2021 Semester: FallTeam: 3 Project: Automated GreenhouseCreation Date: September 8, 2021 Last Modified: September 10, 2021Author: Preston RahimEmail: prahim@purdue.eduAssignment Evaluation:ItemScore (0-5)WeightPointsNotesAssignment-Specific ItemsSoftware Overviewx2?Description of Algorithmsx2?Description of Data Structuresx2?Program Flowchartsx3?State Machine Diagramsx3?Writing-Specific ItemsSpelling and Grammarx2?Formatting and Citationsx1?Figures and Graphsx2?Technical Writing Stylex3?Total Score?5: Excellent 4: Good 3: Acceptable 2: Poor 1: Very Poor 0: Not attemptedGeneral Comments:Relevant overall comments about the paper will be included here1.0 Software OverviewThe Automated Greenhouse features a myriad of sensors and actuators to collect data about an environment and then make changes to that environment. Sensors include a soil moisture sensor, a CO2 sensor, and a temperature sensor. The onboard microcontroller, which is intended to be an STM32L0, will need to read and interpret data from each of these sensors at frequent intervals in order to maintain a stable environment. From the soil moisture sensors we are currently choosing from, we know that we will most likely be communicating that information over a serial connection which the microcontroller will read from. The CO2 sensor will also communicate its data over a serial connection. The temperature sensor will be able to communicate with the microcontroller over an I2C bus.Onboard the microcontroller will use this input data to determine what actuators to turn on. For many actuators such as the heating coils, fans, water pump, and UV lights will be activated by a binary on/off signal for a certain duration of time until optimal levels are reached.Operation of the Automated Greenhouse will be accompanied by a telemetry and initialization system in the form of a bluetooth connection. A bluetooth module, potentially an HC-05, will be responsible for taking UART data sent by the microcontroller and sending it out to a smartphone connected to it. It will also take incoming commands from the smartphone and send it over UART to the microcontroller for it to interpret. On the smartphone side, we will develop an Android application that will receive the bluetooth telemetry data from the Automated Greenhouse and display it on an aesthetically pleasing user-interface. In the other direction, the app will maintain a database of optimal environment values for different crops and when the user wants to grow one of those crops, the user will use the app to select that crop and communicate over bluetooth what environment values to maintain.2.0 Description of AlgorithmsAlgorithmic control should be straightforward. Rather than act as a state machine, the Automated Greenhouse will spend most of its time in a control loop. On first powerup via a button or switch, the Automated Greenhouse will be in an Idle state where the bluetooth module is on and available to be connected to, but the microprocessor is not loaded with any environment values to maintain, nor does it scan data from sensors or attempt to activate any of the actuators. The system will stay in this state until it has received bluetooth communications and a set of environment values to maintain. These values will be loaded into an EEPROM so that they may persist after a power outage. During nominal operation, the microcontroller will run the following pseudocode loop:while(1)if temperature < optimal_temperature:if heating_pad is off:turn heating_pad on;else:turn heating_pad off;if CO2 > optimal_CO2:if fans are off:turn fans on;elseturn fans off;if (soil_moisture < optimal_soil_moisture) and (current_time - time_since_last_watering > 5 minutes):activate water pump for a few seconds;water_level--;time_since_last_watering = current_time;One can see that the pattern in the logic of:Grab sensor dataIf beyond optimal levelProvide necessary stimuliThis applies to almost all of the sensors with the slight exception in watering the plants. We will not continuously provide water to the plants until an optimal value is reached because this will potentially lead to overwatering.The second important piece of software will be the Android application running on the user’s smartphone. The flow of the application can be modeled by the following state diagram that shows the navigation between pages:The Menu will have buttons that go to each sub-page. Each sub-page will also have a back button to return to the Menu. The Add New Plant page will have a form with 4 fields on it for Plant Name, CO2, Temperature, and Soil Moisture. The user may fill out these fields and push an “Add” button to store a custom preset for a new plant. This preset will be stored on the phone’s memory. The Plant Selection will be a page with both pre-loaded plant presets as well as any user-defined presets. Upon selection, the phone should communicate to the Automated Greenhouse over bluetooth. It will communicate the environment values to maintain and the greenhouse will begin monitoring sensor data and providing stimulus as necessary. The Environment Monitoring page will show real-time data of the 3 environment values within the Automated Greenhouse. Additionally, if the estimated water level is below a given threshold, it will display an alert on the page.3.0 Description of Data StructuresThere is not an important need to maintain many complex data structures such as trees or queues on either the microprocessor’s software or the smartphone application. To organize plant presets, both predefined and user defined, we will maintain a “class” or rather “structure” that will hold the Plant Name, CO2 level, Temperature, and soil moisture for a given preset all in one addressable memory location. A pseudocode style example is given below:Class Plant_Preset {string name;double co2;double temperature;double soil_moisure;}Additionally, when sending environment data over bluetooth from the Automated Greenhouse to the smartphone, we predict it may be efficient to package that data in a similar format:Class Greenhouse_Status {string name;double co2;double temperature;double soil_moisure;double water_level;}4.0 Sources Cited:Appendix 1: Program Flowcharts*Pseudocode for main runtime loop*while(1)if temperature < optimal_temperature:if heating_pad is off:turn heating_pad on;else:turn heating_pad off;if CO2 > optimal_CO2:if fans are off:turn fans on;elseturn fans off;if (soil_moisture < optimal_soil_moisture) and (current_time - time_since_last_watering > 5 minutes):activate water pump for a few seconds;water_level--;time_since_last_watering = current_time;*Pseudocode for preset classes*Class Plant_Preset {string name;double co2;double temperature;double soil_moisure;}*Pseudocode for environment value package*Class Greenhouse_Status {string name;double co2;double temperature;double soil_moisure;double water_level;}Appendix 2: State Machine DiagramsUse this space to provide a state machine diagram of your proposed software. Categorize the operating states that your microcontroller will be in, as well as what conditions cause the microcontroller to transition between states. Feel free to use the Mealy or Moore state machine models, as is appropriate for your design.*Page Navigation Diagram for Companion Android Application* ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download