App Controlled Poinsettia Covering System

SmartSettia provides remote control and monitoring for the commercial production of poinsettias and other greenhouse plants using a web connected device. The system strategically controls timed covering and uncovering of poinsettias to control exposure to light, and allows for monitoring of other ambient properties.
== Project Overview (2018) ==
=== Background ===
The 2017 Smartsettia design team created a front-end environment to interface with the University of Idaho Greenhouse poinsettia covering system. With this front-end users were able to remotely manage and monitor that system through the use of a raspberry pi. This system was sufficient for the Plant and Soil club. It was later decided, however, that more features needed to be added or changed. The system needed a more restrictive access control policy, motion detection and video streaming for security and monitoring, a handle for I2C and SPI sensors, and improved error handling. 
=== Problem Statement ===
Make improvements and add functionality to the existing Smartsettia environment. Transform the specific greenhouse application into universal automated system.
=== Goals ===
Modify the existing web and unit application that will:
 Modify existing database structure to support new access control
 Modify pages to enforce the access control structure
 Detect motion, record, and give a report the site managers
 Be able to stream video from the unit to monitor the covering system
 Receive I2C and SPI sensor data, and upload it to the server
 Add a simplistic scripting interface for managers to control the system when certain conditions are met
 Create a desktop application to download recorded videos and sensor data
 Improve the error system and email appropriate staff
== Project Overview (2017) ==
=== Background ===
A 2016 senior design team developed a poinsettia covering system for the University of Idaho Greenhouse. The covering system uses a garage door motor that is controlled using a preconfigured schedule that is programmed into an Arduino. The current system doesn't include a way to allow users to remotely manage or receive vital feedback about the covering system. So, our senior design team called SmartSettia was tasked with modernizing the system to allow for in-depth automation and remote management.
=== Problem Statement ===
Controlling poinsettia photo-period is essential in preparing them for a specific market date and final height. The Sixth Street Greenhouse has streetlights as well as internal lighting that invades the room where the poinsettias are stored. To mitigate the effect of this stray light, the students of the Plant & Soils Science Club have an automated poinsettia covering system (created in 2016) that opens at 8am and closes at 5pm. The problem is there is no feedback for if system is open or closed other than physically going on site and verify the unit is operating as it should. The covering system's schedule is hard coded so the system can't be used on other plants that have different photo-periods. Lastly the system can't be remotely controlled in case of an emergency.
=== Goals ===
Developing a web based application that will:
 Run on Windows, iOS, and Android
 Be simple to use on both mobile and desktop devices
 User based access control 
 Use an IP camera for video monitoring
 Include the ability to remotely control the poinsettia covering system
 Allow for custom schedules
 Receive real time system notifications
 Log all actions and sensors
 Operate in a hot and humid environment
== Final Product (2018) ==
Access Control: The new website features a more robust management system which allows mangers and administers to assign permissions per device. This means instead of a user or manager having access to all devices at a location, they will only have access to devices assigned to them. Administrators can assign devices to both managers and users; managers assign to users. Administrators are able to delete other administrators.
Front-End Refactor: While ultimately the look and feel of the Smartsettia application was not changed, several files which make up the Laravel application were refactored to be easier to work with both for our benefit and any future developers. 
Streaming: Before the only confirmation that the device was working properly was a status message and an image that updates fairly infrequently. If something went wrong and the status was not updated appropriately, greenhouse operators might not know if the cover closed/open as expected. The simple fix was to implement live video streaming from the device.
Motion Detection: To add a sense of security to the project motion detection was used to record video in the case of unexpected intrusion. Using the OpenCV library, the device captures video from the raspberry pi camera, converts it to a matrix which OpenCV uses to detect 'motion' between images. 
Real Sensor Data: Before the device page had charts populated by static data on the device. The device now uses its SPI communication capabilities to convert analog output to usable data which can be monitored live from the devices page. The current sensors connected to the device range from temperature, light, humidity, and moisture which are applicable to any greenhouse needs.
== Final Product (2017) ==
The final product that is SmartSettia is shown below, demonstrating the outcome from a year of development.
	The Home Page The home page all visiting users will first come to upon entering www.smartsettia.com. This page gives users details into what this software is capable of and how the software actually operates.
	The Dashboard The dashboard is the main page users use to interact with their connected devices. The dashboard displays many pieces of import info including the currently selected site, selected location, selected device details, and the device list. Some of the most important features on the dashboard include the ability to open and close the covering system remotely, view a live feed of the plants, see if the device is online and functioning or is currently offline, and the ability to change the covers schedule.
	The Device The Raspberry Pi 3 handles all device side computation and monitoring. Above the Pi is a relay module that activates the garage door opener and is activated by the GIPI pins on the Pi. There are two limit switches wired to the Pi for monitoring the covering system. There is also a button wired up to the Pi so users can open and close the covering system locally. The entire system is enclosed in a 3D printed case to provide protection in the greenhouse environment.
	The Hardware This picture displays all the installed hardware located at the covering system. Located at the top beam is the outdoor web cam that monitors the poinsettias. One limit switch is installed on each side of the covers pivoting arm that detects if the cover is open or closed. The main device displayed in the previous picture can be seen in its custom 3D printed waterproof case on the right of the picture.
	The Technology Stack This picture showcasing the major pieces of technology used to create SmartSettia. First, we have Nginx which we use for our server and is hosted on Digital Ocean. Laravel framework is built using PHP and allowed for quick and efficient development. Laravel was also used to be able to send email notifications to users for when the device encountered issues and we use MySQL for our database. The connections for SmartSettia are secured by the use of SSL and the certificates are auto-renewed every three months. This is possible with the use of OpenSSL and Let's Encrypt. Lastly the Raspberry Pi 3's software is built using Python.
== Design (2018) ==
	Redesigned Use Case The use case diagram had to undergo a slight alteration to implement device level control.
	Database Design Update This updated database design shows an example of the required additions to implement the new use case.
	Sensor Pin Layout This diagram created in Fritzing shows an example of how sensors can be connected to the device.
== Design (2017) ==
Mock-ups and Prototypes of the interface of SmartSettia are shown below, demonstrating the progression of the design.
				Hand Drawn Mock-ups Hand drawn mock-ups ranging from system design to webpage design.
 	System Design Each covering system uses a Raspberry PI 3 that connects directly to a USB camera and connects to the server over WiFi. At set periods of time the PI will request an update from the server and upload its local data. The data it receives may include a new configuration file or simply remote control commands to open or close the unit. The server will serve our users a simple and user friendly webpage for both desktop and mobile browsers. Allowing users to send commands at the click of a button.
 	Use Case Diagram This use case diagram demonstrates what each user defined role are capable of carrying out.
 	Website Home Page Prototype The home page all visiting users will first come to upon entering www.smartsettia.com. This page gives users details into what this software is capable of and how the software actual operates.
none|400px|alt=.| About page prototype.	Website About Page A simple page that displays the SmartSettia team and gives users some insight into the people behind the software.
== 2018 Smartsettia Team Information ==
Members
Nicholas Blackburn Computer Science 	Dakota Jackson Computer Science 	Maxwell Thornburg Computer Science
Bio: I am graduating computer science major at the University of Idaho. I have interests in artificial intelligence, evolutionary computing, and security. That being said I'll take on any project that gives me a chance to do something new or just straight up code.	Bio: I'm a senior computer science student. I started coding my freshman year of college and only recently discovered where my interests in CS. I enjoy working on large scale data communication, game development, and AI. I currently work for Kochava as a developer and plan on graduating in May 2019.	Bio: I'm a senior computer science student who plans to graduate in May 2019. I have interests in application development and am currently working for the Navy in China Lake, CA.
== 2017 Smartsettia Team Information ==
Smartsettia Members Group Photo 
Group photo of the members of team SmartSettia.
Members
150px|left Brandon Jank Computer Science 	150px|left Nick Krenowicz Computer Engineer	150px|left Robert Breckenridge Computer Science
-Bio: I'm a senior Computer Science student at the University of Idaho in beautiful Moscow, Idaho. I have a passion for everything electronic. From the capacitor to the cloud, I have been designing and coding things for the web for over a decade. I enjoy volunteering my computer experience for local non-profits, tinkering with emerging technologies, mountain biking, snowmobiling, writing, and traveling.	Bio: I’m a senior Computer Engineer student at the University of Idaho. I love creating systems through embedded microprocessors revolving around robotics, home automation and other gadgets. 
My latest hobbies involve robotics, 3d printing, and creating custom home automation devices.
When I have the chance, I like to go, hiking, and mountain biking through mountain trails.	Bio: I'm a senior Computer Science student at the University of Idaho. My main focus and interests are cyber security and databases. In my free time I like to work on side projects ranging from mobile app development to video game development.
== Documents ==
* 
* 
* 
* 
== Previous Team's Poinsettia Covering System ==
2016 Project hardware we will be building upon.
	Design of Covering System A simple design to demonstrate the hardware of the covering system.
	Completed Covering System The system covers all the plants located inside the device upon physical button press or GPS clock hard coded 8am and 5pm schedule.