Greenhouse Automation System Project
Greenhouse Automation System Project
UNIVERSITY OF TECHNOLOGY
FACULTY OF COMPUTER SCIENCE & ENGINEERING
MULTIDISCIPLINARY PROJECT
Contents
1 Introduction to the topic 4
2 Requirements 4
2.1 Functional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 Internet-of-Things aspect . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2 Mobile application aspect . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Non-functional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.1 Internet-of-Things aspect . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.2 Mobile application aspect . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Devices 6
3.1 DHT11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Soil moisture sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.3 Light sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.4 Relay circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.5 Mini-pump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.6 RC servo 590 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.7 Single 2-colour LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.8 Microbit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.9 Expansion circuit board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.10 Adapter 5V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5 Work distribution 15
6 General design 15
6.1 Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.2 Business logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7 Mockups 17
7.1 Login and Registration screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.2 Home screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.3 Statistics screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.4 Environmental regulation settings screens . . . . . . . . . . . . . . . . . . . . . . 20
7.5 Reminders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
8 Technical diagrams 23
8.1 Deployment View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.2 Implementation View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.2.1 Activity Diagram: Subsystem functionality . . . . . . . . . . . . . . . . . 24
8.2.2 Activity Diagram: Reminder . . . . . . . . . . . . . . . . . . . . . . . . . 26
9 Database Overview 28
10 Finished product 29
Document History
2 Requirements
2.1 Functional
2.1.1 Internet-of-Things aspect
• Automatically irrigate greenhouse plants according to current soil moisture and plant type.
• Maintain ideal climatic conditions including temperature, venting, and lighting via different
means: manually, automatically or periodically by schedule.
• Report issues that need manual intervention, such as inability to maintain conditions within
threshold due to extreme external conditions.
• Provide live climate reports to the user via some form of display (graph view and log view).
• Periodically remind user to tend to manual tasks, such as checking water supply and
cleaning windows.
2.2 Non-functional
2.2.1 Internet-of-Things aspect
• Run 24/7 with minimal scheduled downtime and preferably no unscheduled downtime.
• Scalable and efficient database system that has a capacity of at least 500MB.
• Simple user manuals and interactions via LCD screen or device buttons.
3 Devices
3.1 DHT11
• Application: Measure temperature and report to the IoT server (its atmospheric humidity
data is not used in our system). Temperature is a vital statistic for many greenhouse
maintenance operations, including, but not limited to, whether to irrigate or not, how
much to irrigate, whether to deploy sunscreens, etc.
• Input: Air temperature - the sensor is mounted above-ground, preferably suspended under
the volumetric centre of the greenhouse.
• Output: Temperature value, reported to the controller, which relays to the IoT server.
3.5 Mini-pump
• Application: Pumps water to irrigate the greenhouse.
• Input: None (runs as long as there is electrical power).
Figure 2: Example of an extremely power-efficient grow lamps setup on the International Space
Station. Far-red wavelengths are vital to plants, the others less so [Dem+16].
• Application: Serves as a mimic for real grow lamps. In our system, it emits red light.
• Input: 0-2 as control signal. 0 is off, 1 is red, 2 is blue. Here we will only input either 0
or 1.
• Output: None (electronically). Emits red light.
3.8 Microbit
• The hub for all sensors. It receives sensor readings through the expansion circuit board
and perform preliminary processing (such as unit conversion, threshold and the like).
• Pre-processed data are then sent to the server for logging and broadcasting to all smart-
phones currently connected to it.
3.10 Adapter 5V
This is a continuously-operated and stationary system. As such, a stable continuous power
supply is preferred over batteries.
Use case ID 1
Use case name Multi-mode irrigation
Actor User, server, and devices (moisture sensor, pump)
Description The system provides three modes of irrigation - a fully automatic mode in
which the system takes care of maintaining a preset level of soil moisture, a
scheduled mode that follows a user-specified daily, weekly or monthly sched-
ule, and a fully manual mode that allows the user to explicitly start and stop
the irrigation. In addition, a fallback mechanism can effect a stronger cor-
rection if measurements fall into the danger zone while in any of the three
modes, if enabled.
All modes provide moisture level warnings and correction notifications to the
user.
Preconditions The system is running normally, and is equipped with at least a pump, a
soil moisture sensor, and a water source, preferably one that does not need
manual refilling.
Normal flow The expected course of actions would be for the user to delegate the irrigation
to the system.
1. User opens the mobile application.
2. User selects ”Irrigation” from the list of features on the main screen.
3. User selects ”Automatic” in the Mode section.
4. User specifies the target moisture level, according to an on-screen table
of recommended values or a slider for custom values.
Exceptions At step 5, if the system detect abnormal changes (or a lack of change) in soil
moisture while irrigating:
(a) System does not detect slower than expected change in water moisture
while irrigating, or no detected changes.
(b) System sends a push notification to the smartphone application, warning
that there are problems with the water source (exhausted or clogged) or
the pump.
(c) If the fallback mechanism is enabled, system triggers a stronger action (a
20-second pump).
(3.4) User specifies when to irrigate within that schedule and how much water
to dispense (i.e. how long to pump for this task).
(3.5) System irrigates on that schedule’s basis. In case automatic actions
are enabled, system monitors soil moisture every time it receives new
measurement and might raise warnings to the user through notifcations.
Use case ID 2
Use case name System report and statistics
Actor User
Description The application allows user to view recorded data in the form of summary
report (over a time period) with aggregate calculations and graph overview
of past recordings.
Preconditions The mobile app is connected to the database and the system is still actively
recording statistics.
Normal flow
5. System provides a detailed calendar for user to choose the starting and
end date for report.
6. User selects his/her preferred time period and presses ”Confirm”.
7. System reloads the report page with proper graph view and action track-
ing of the specified time period.
Postconditions None
Exceptions Exception 1: at step 4, the time period that user specified is not in the database
system.
(5.1) System shows Error window and propose user to choose an appropriate
time span.
Alternative flow At step 3, if the user chooses ”Statistics to report” on the option bar:
(3.1) System presents a list of data for recording (by default, every option is
checked) for user to choose what to report.
(3.2) User checks/unchecks items accordingly and presses ”Confirm”.
(3.3) System saves the configuration, and only reports the specified items
next time.
Use case ID 3
Use case name Temperature regulation
Actor User, server, and devices (DHT11, RC servo)
Description With temperature control, the system also provides 3 options: an automatic
mode where the system tries to maintain the temperature of the greenhouse
at an ideal level, a scheduled mode that follows a user-specified daily, weekly
or monthly schedule (with or without a safety fallback to automatic mode),
and a fully manual mode that allows the user to explicitly open or close the
sunscreens, which are opaque ceiling-mounted covers (here we use the motor
to simulate a rolling sunscreen), whenever the user wish to.
If the user chooses to go with the scheduled mode, it is preferred that a safety
fallback is always available. Storms or unpredictable weather fluctuations
may unmitigable and usually violent fluctuations in greenhouse temperature.
The manual mode provides optional temperature warnings to the user. The
examples above may change as research and development proceeds.
Preconditions The system is running normally, and is equipped with a the DHT11 sensor,
optionally with sunscreens connected to actuators(for deploying and retract-
ing).
Normal flow The expected course of actions would be for the user to delegate the temperature
control to the system.
1. User opens the mobile application.
2. User selects ”Temperature control” from the list of features on the main
screen.
6. User selects his/her preferred time period when the sunscreens are open
or closed.
Details regarding the application’s user interface may change as development
proceeds.
Postconditions Temperature (measured by the sensor) and sunscreen condition is logged on
a periodical basis into the system’s database. Furthermore, actions on mod-
erating the temperature level (either by user or system) is also tracked and
kept in the history log.
Use case ID 4
Use case name Light level regulation
Actor User, server, and devices (traffic light, light sensor, two-colour LED)
Description Similar to temperature control, we can moderate the light level in the green-
house with 3 options: automatically, with proper configuration on how system
should react to environmental settings; on scheduled, usually based on time
period in day and/ or days in week; or manually, where user can control the
grow lamps directly. Sunscreens may be advisable in case the greenhouse
requires an upper limit to light level during daytime.
The system may also warn user on extreme cases such as broken lighting
equipment or unfavourable light levels that are outside of the system’s regu-
lation capabilities.
Preconditions The system is running normally, and is always equipped with a light sensor
and a relay circuit attached to the plant lighting source.
Normal flow The expected course of actions would be for the user to delegate the light
control to the system.
1. User opens the mobile application.
2. User selects ”Light level regulation” from the list of features on the main
screen.
6. User selects his/her preferred daily time period during which the grow
lamps are on.
Details regarding the application’s user interface may change as development
proceeds.
Postconditions Light level (measured by the sensor) and lighting configuration is logged on
a half-hourly basis into the system’s database. Furthermore, actions on mod-
erating the light level (by either user or system) is also tracked and kept in
the history log.
Alternative flow At step 3, if the user chooses ”Automatic”:
(3.1) User specifies the target light level range.
(3.2) System starts checking light level every unit of time every time new
data is received. If the light level does not fit in the configured target
range, the system will act until the sensor records suitable measure-
ments accordingly.
At step 3, if the user chooses ”Manual”:
(3.1) User specifies whether the system should warn of exceptions, like low
light level or potential broken lighting system.
(3.2) If warnings are enabled, system monitors light level regularly and may
warn via local notifications.
Use case ID 5
Use case name Customisable periodic user reminders
Actor User and server
Description Offer various reminder functionality to keep user in a scheduled check routine
as well as proper awareness of the greenhouse system. The default reminder
system notifies user of garden checking twice daily at 6A.M and 19P.M. May
be customised to remind on different to-dos and status update.
Preconditions The mobile app is running normally and the time system is functioning prop-
erly
Normal flow
Exceptions Exception 1: at step 6, user presses ”Confirm” without having filled in the
title and/or time scheduled.
(6.1) System automatically fills with current time, ”Untitled” for title, and
”No description given” for description.
System
Temperature
sensor
<<device>>
Regulate
Usetemperature
case
Traffic lights
<<device>>
View
Usestatistics
case
Remind
Useperiodically
case
5 Work distribution
• On Quan An: Reminders UI/backend, scheduling UI.
• Huynh Thien Khiem: UI head, scheduling logic and other assorted backends.
• Bui Minh Kiet: Backend head, SQLite database design/implementation and MQTT.
• Nguyen Hoang Long: Statistics export logic, administrative tasks.
6 General design
Here we use the term ”server” and ”broker” interchangeably.
6.1 Authentication
To enable flexible MQTT configurations, we propose a local-profile design in which greenhouses
are given locally-stored profiles. Each profile contains server authentication data (of which there
might be more than one server) and device-server pairings. This design enables all possible
combinations of server-device distributions, such as X devices on server A, Y devices on server
B, etc. There are at most six servers, which in that case, would be arranged as one for each
device that we use.
Each profile is self-contained. All gathered sensor readings and activity records are stored per-
profile. This has multiple benefits, such as added partitioning and security in the case that the
mobile device (Android smartphone, tablet, smart fridge or Chromebook) is shared by multiple
family members for their own greenhouses.
• The Irrigation subsystem reads from the soil moisture sensor and controls the pump’s relay
accordingly.
• The Lighting subsystem reads from the light sensor and switches grow lamps (the 2-colour
LED) on and off.
• The Temperature subsystem reads from DHT11 and controls the servo connected to the
foldable sunscreen.
Subsystems share the same MQTT and database backends. The MQTT backend takes care of
all connections to MQTT servers (concurrently) and abstracts this from the rest of the logic by
exposing a simple per-device subscription data streams and publish functions, i.e. the irrigation
subsystem upon receiving data from the moisture sensor’s data stream (from the backend) will
act by calling the publish function of the backend, specifying which device and what data to send.
7 Mockups
Note: Some of these mockups no longer reflect our current design and are only kept for archival
and comparative purposes.
9:41 9:41
Password
Sign In
API Key
Create profile
Figure 4: The registration screen. User is Figure 5: The login screen. User need to en-
prompted to enter their local profile username, ter Adafruit server username and their created
preferred password, confirmed password, and password. Upon logging in, the username to-
the actual API key that is used to login to ken will be used to connect to Adafruit server
MQTT server and other online services.
The login and registration provides basic security and persistence option for user. The user-
name and API key used must be a legitimate Adafruit credentials, since we intend to make it
consistent with the IoT server for convenience. However, user can used their preferred password
(which is more easily memorized than the API key), which is used as a second authentication
factor in the mobile app. This password can be text that is at least 7 characters long, and is
going to be hashed and stored in the database for confidentiality.
37
171
Grow lights on
between manual action (if that subsystem is in manual
17:00 - 6:00 mode). Gestures allow one widget to serve mul-
tiple functions, and the reduction in the num-
W/m2 Settings ber of widgets on screen at a given moment al-
lows each widget to be larger and more legible
under typical working conditions (such as out
in the field under direct sunlight).
Temperature MANUAL In case the device has a shorter aspect ratio,
25
Alerting if
this screen could be scrolled vertically. How-
outside ever, we expect most modern smartphones in
10 - 35 0C all market segments to have at least a 18:9 as-
pect ratio, which would fit our entire screen
0C Settings
without scrolling.
Also in this screen is a link to the client set-
HOLD TO TOGGLE SUNSCREEN tings page (which allows the user to adjust the
address of the MQTT server and the related
client-side settings), and a button to the statis-
CLIENT SETTINGS tics screen.
9:41 9:41
Showing data between Jan 1 - Feb 12. Showing data between Jan 1 - Feb 12.
THRESHOLD +
Temperature 250C
THRESHOLD -
Light 171W/m2
TARGET
Figure 7: The statistics screen, showing its Figure 8: The statistics screen, showing its logs.
graphs. Each subsystem’s graph carries their
indicative colour schemes, allowing for visual
intuition without needing to read the titles.
The graphs tab is currently designed to contain one graph for each subsystem, coloured in
that subsystem’s colour scheme so as to be visually intuitive, i.e. allowing the user to instantly
identify which subsystem a graph belongs to just by glancing. Normal textual titles are still
provided.
The graphs presented here may not represent our final vision of how the application should
look like. Ideally, it should also contains tick marks, grids and/or other visual guides to help
better interpret the graphs. The logs screen also shows data within the specified range. Each
logged event is displayed in the list with a leftmost icon denoting type (scheduled, warning, and
manual events are depicted in this mock-up, in that order), a log index, a brief description, a full
timestamp and a button to display detailed information in a pop-up. The topmost is the latest.
the temperature goes out of limit range. Sys- mental variables, other safety detection can
tem would then adjust the sunscreen as well be set: energy-overload for light sensor, water
as send user some warning indicating the inci- source depletion for moisture, and so on.
dents. Moreover, depending on the environ-
7.5 Reminders
9:41 9:41
Add new reminder
Label
Reminders
Upcoming (4)
MARK AS DONE
07:00
# 1302 Turn off lighting
May 2021
MARK AS DONE
SUN MON TUE WED THU FRI SAT
# 1301 Check garden
1 2 3
4 5 6 7 8 9 10
MARK AS DONE
11 12 13 14 15 16 17
Scheduled tasks
Cancel Save
Figure 10: The reminders screen. Figure 11: How adding a new reminder looks
like.
The Reminders function’s main purpose is to help user check what they should do in that
day. It could be reached via the corresponding button on the home screen. It comes with an
alarm that notifies user at preset day and time. On the main screen, there are divided in 3 sub
tasks so user can remember and prepare themselves:
• Upcoming: This section tells user what they will need to finish in near future so they can
arrange time, prepare tools. This will help a lot in scheduling time for user.
• Unfinished tasks: This displays tasks that user should finish on the given day. Each task
has a label to describe what should be done and at what time. Then user can tap ”Mark
as done” after he has finished it.
• Scheduled tasks:
When new tasks appear and need to be done soon, user can use this feature to push a notification
on the day and time they set. For this feature, it can be divided into 3 part:
1. Labelling: It is the title of the reminder. User can edit it such that when it shows
notification, he will remember what need to be done. For this label, it should be short,
descriptive text.
2. Set time and date: The app use 24-hours model, which is very familiar in eastern
countries. User choose preferred time and date in the calendar.
3. Choose options: These options help user to set the notifications as their will. It has
option to allow vibration or even snoozing.
8 Technical diagrams
8.1 Deployment View
This section portrays our system as a package diagram. The illustrated deployment is presented
here, involving two main modules: System and Server / Internet.
deployment Grassquitto
System
<<device>>
:AndroidDevice
<<SystemModule>> <<ImportedPackages>>
<<ControllerLayer>>
<<platform>> <<package>>
AndroidOS cron <<component>> <<component>>
:MyAppController :Navigator
<<package>> <<SystemServiceLayer>>
mqtt_client <<UserServiceLayer>>
<<storage>>
LocalStorage <<use>> <<component>>
:DatabaseHelper
<<use>> <<component>>
<<package>> :AutomaticProcessor
fl_chart <<PresentationLayer>> <<component>>
<<device>> <<component>> :AppMqttTransactions
RTC <<component>> <<component>> <<component>> :NotificationService
:MainPage :LoginPage :StatisticsPage
<<package>> <<component>>
depend
sqflite :ProfileSettings
<<component>>
<<component>> <<component>> <<component>> :Scheduler
:TemperaturePage :LightingPage :IrrigationPage
<<component>>
<<component>> :ProfileUtils
<<package>> :Export
csv <<component>> <<component>> <<component>>
<<use>> :ReminderPage :SettingsPage :...more pages
<<component>>
:Subsystems
<<package>>
share
<<package>>
flutter_local_notifications
HTTPS UDP
Internet
<<broker>>
MQTT
<<component>> <<component>>
bk-iot-light bk-iot-servo
<<component>> <<component>>
bk-iot-temp-humid bk-iot-relay
<<component>> <<component>>
bk-iot-moisture bk-iot-led
In the System module, we deploy all packages inside our Android Device, which is expected
to be a Flutter mobile app project. First and foremost, the project uses available System
Modules such as the Android Operating System, Local Storage, Real-Time Clock, etc. These
are integral for the Flutter framework and its related Imported Packages. We have utilized
a number of Flutter packages, most importantly including utility ones like cron for scheduling
tasks, mqtt_client for handling MQTT connection, fl_chart for scaling data into graphs, sqflite
for Database management, csv for local file export, flutter_local_notifications for mobile app
reminders and warnings. Furthermore, there are also various different UI libraries to improve user
experience, notably day_night_time_picker, animations, google_fonts, flutter_circular_slider.
Now, for GRASS app, the central logic controller will reside in the ControllerLayer, which
includes the main App Controller and the Screen Navigator. This layer depends on two other
implementation layer, which are:
• UserServiceLayer, which contains back-end utilities, such as notification service, schedul-
ing, file export and automatic data processing. Note that this layer depends on the services
provided by a deeper SystemServiceLayer that handles transactions in the background,
such as the Database Helper, the MQTT Transactions, the Profile Settings / Utilities and
the environment-specific Subsystems.
• PresentationLayer, which provides front-end UI/UX states of the app widgets. More-
over, the Presentation Layer is indeed supported by the device’s screen, which forms the
actual User Interface and Experience in deployment. The main screens are as listed in the
use cases, which are the main page, the login/registration page, the statistics/log page, the
environment-setting pages (temperature, lighting, irrigation), the reminder page and the
settings page. There are also auxiliary pages and supporting transition screens that form
the basic presentation of the app
,
These system modules can communicate and control the online servers we intend to imple-
ment, which is indeed the MQTT broker on Adafruit. The MQTT Transactions will connect
to necessary feeds located on the server, which as detailed by our device listing will consist of 6
major input/output feeds:
• bk-iot-temp-humid
• bk-iot-soil
• bk-iot-light
• bk-iot-servo
• bk-iot-relay
• bk-iot-led
Our system is fully implemented in Dart, which has a sometimes-asynchronous model of ex-
ecution. For ease of understanding, we have separated all possible execution threads into their
own swim lanes, although they in practice might not have a full thread (they might instead be
concurrent functions via preemptive multitasking).
The smartphone application is designed to be run headless most of the time (in the back-
ground, without the UI). There are two ways of exiting the application: by tapping Back on the
home screen, or by tapping Return anywhere. Tapping Return simply exits the UI and allows
the application to continue running in the background. Tapping the Back button indicates that
the application is to end monitoring and log out of the current session.
setToCurrentProfile
Logs in init(name) subscribeTopics
load tasks
set(<subsystem> on<data>Received()
process<Subsystem>
-last-measurement) callback
cron
custom actuation
callback
Mode =
idle Auto?
No
Yes
enter
subsystem build(context) get(setting-keys) within auto
settings Yes
threshold?
change No
idle
settings
within fallback
Yes normal actuation
set(setting-keys, threshold?
setState()
values)
No
Fallback
No
!= 2?
Yes
within fallback
Yes
tap back threshold?
No
displayBasicNotification
Fallback == 0? Yes
strong actuation
No
publish()
log action
Done
Enter name of
task
Check tasks
Cancel
Choose date,
time, options
Mark as done
Save
Create new
reminder
As the start, when users open Reminder screen, it displays Reminder’s main screen which has
multiple tasks in different categories. When a task is done, user can choose ”Mark as done”
button to remove it from ”Unfinished tasks”. Also, a user can add new reminder by choosing add
more reminder button, and is navigated to new screen. In the create new reminder screen, users
need to choose date and time of reminder, edit the name as descriptive as possible so they can
easily be reminded to the task, choose some options of reminder and finally press save to finish
or cancel to drop new reminder.
Open Statistic
function
Show Statistic's
main screen
Choose time
interval of
inspection
Graphs Logs
Choose details
button
Details of an action
between Jan 1 to Feb 12 in our mock up of Week Four). Users can also choose to view the logging
records by pressing the Logs button and logs of past actions will be displayed. In addition, if
users wish to see further information, the Details button will show all details they ought to see.
9 Database Overview
We will also outline our database design using the familiar Enhanced Entity-Relationship Dia-
gram (EERD). The diagram will illustrate the major entities stored in our database, as well as
its respective attributes and relationships among each other.
Time IsDone
Description
Username
N 1
ID Reminder Has User
Password
Has Username
Description Mode
N
GID
N 1
LID ActivityLog Stores ServerRecord
APIKey
Category Time
Address
1
Sensors
Moisture N
MoistureRecord
Measure
RID
Temperature
Measure
TempRecord d Record
Time
Light
LightRecord
Measure
As we can see here, there are core strong entities in User (the account created for each
person, which identifies his gardens and reminder lists on the app), Garden (which represents a
Greenhouse garden, maintained by a unique Adafruit topic, and belongs to one user), Activity-
Log (which stores the activities performed over the garden since beginning, namely irrigation,
sunscreen adjustment, light switching and safety fallback actions), Record (which is further
divided into MoistureRecord, TempRecord, LightRecord, each of which store data sub-
scribed from the Adafruit topic of a specific garden). Furthermore, each user also has a list
of Reminder, which is a weak entity dependent on User ID and is a representation of User’s
current reminder list.
In the mobile application, we will implement this EERD using SQLite (as represented before
in the deployment view), which captures fairly well the ideas in the diagram, along with some
module-specific adjustment.
10 Finished product
We have implemented our Android application using Dart and Flutter. Below are screenshots of
the product, demonstrating a typical workflow:
Figure 15: The login screen. It also allows the user to create a new profile if they so wished.
Figure 16: The main screen. Note how the design has changed from the mock-up. The numbers
here are partly transparent with loading spinners next to them, denoting that they are
the last values retrieved from the previous session and not real time numbers (as is the case
when first starting up the application). Multiple elements in this screen are animated: the
propeller blade next to ”Irrigation” would turn while the pump is running. The light bulb next
to ”Lighting” switches between its outlined and filled version to denote whether the grow lamps
are off or on, respectively. The sun icon next to ”Temperature” denotes that the sunscreen
is currently retracted (the sun is shining through) and switches to a cloudy symbol when the
sunscreen is deployed. If in manual mode, these tiles serve as manual buttons, all requiring long
presses to avoid accidental activations. When long-pressed, each tile grows in size and brightens,
signifying that the action has been published to the MQTT broker. Their icons will only change
when a reply has been received, denoting a successful activation. Lastly, note how the ”Client
settings” section has been moved to the top-right, now appearing as a green button with an
avatar symbol.
Figure 17: When the small cog icon at the top right of the ”Irrigation” tile is pressed, the
tile morphs to fill the entire screen and fades into this settings screen, visually signifying a
”containing” or ”internal” relationship. Note how the colour scheme matches that of the tile.
The list of recommended moisture levels are also denoted with small symbols of typical plants
of that category. A slider would appear if Custom is selected. The only item in the Scheduled
mode settings (not visible here) section leads to the next screen.
Figure 18: Task list for the scheduled mode of the irrigation subsystem. This list is sorted firstly
by period duration (monthly, to weekly, to daily), then by first activation within that period (a
monthly task with its first trigger on the 2nd day of a month would be placed above that with
the first trigger on the 3rd, for example), followed by pumping duration (ascending). A small
Floating Action Button (FOB) at the bottom right allows adding new tasks. It expands to three
smaller buttons for daily, weekly and monthly task creation.
Figure 19: Adding a new monthly-type scheduled task. The user must select a time within a day
to activate, as well as which days of the month this task is applicable for. The slider defaults
to five seconds and can reach up to sixty (if scrolled all the way around). The Add button is
currently disabled due to the user not having selected the time-of-day.
Figure 20: The statistics screen, showing its graphs tab. Each graph is automatically trimmed
x-wise to the maximum extent of the available data that fits within the selected time frame (for
example, if we only have data starting from 7AM of Tuesday, then the graph will begin at 7AM
instead of daybreak even if the selected time frame is simply ”From Tuesday till now”). Note how
the graphs are coloured to represent their subsystem’s theme for direct visual correspondence
and legibility.
Figure 21: The statistics screen’s logs tab, showing actions taken. Each entry has two icons, the
first denoting which type of action it was (scheduled, manual, or safety fallback) and the second
denoting which subsystem it originated from (temperature, moisture or lighting). Descriptions
are automatically generated depending on these two icons.
Figure 22: Settings screen for current profile. We are most interested in the server & device
setup option.
Figure 23: Tapping that option leads to a two-step wizard, of which setting up server authen-
tication is the first step. Here the user is prompted to add, edit or remove servers from their
profile. These servers will be linked to devices later on.
Figure 24: Adding a server requires its domain (for example, [Link]), your username
(for example, CSE-BBC1) and API key.
Figure 25: The second step of the wizard. Here each device is linked to the server that hosts
their feed. For example, in this screenshot, all six devices are hosted on one server. This design
allows for all server-device splits, such as for running on the CSE-BBC test servers.
Figure 26: The reminders screen. Reminders are automatically filtered into three categories:
Upcoming (due within a day or two), overdue (self-explanatory) and scheduled (the rest of the
reminders, far away into the future). As is with the other editable list screens, the FAB at the
bottom-right allows adding entries.
Figure 28: On Android 10+, our application follows system-wide dark mode. Significant work
has been done to ensure that the widgets continue to look legible and consistent with their light-
mode counterparts, while also preserving eyesight in darker environments. Here is our main
screen when the device is in dark mode.
Figure 29: Our lighting subsystem settings screen in dark mode. Again note how the colour
scheme matches that of its tile in the main screen.
References
[Dem+16] Sabine Demotes-Mainard et al. “Plant responses to red and far-red lights, applica-
tions in horticulture”. In: Environmental and experimental Botany 121 (2016), pp. 4–
21.