RETO MEIER: Welcome to "Build Out," where real engineers face
off building fake products.
Today's challenge, the smart garden.
I'm Reto Meier, the inevitable winner, which means this is--
COLT MCANLIS: Colt McAnlis, the only one of us
who has actually done any real engineering.
Whose thumb is the greenest?
Find out now on "Built Out."
RETO MEIER: And Colt lost the coin toss,
so now he has to go first.
He'll have four minutes to describe his smart garden
solution, including one arbitrary VP requirement.
I will then have three minutes to respond.
COLT MCANLIS: This week, our VP of engineering
has mandated that we use--
RETO MEIER: The Tasks API.
COLT MCANLIS: Yes, the Google Cloud Tasks API.
RETO MEIER: Yes, the Google Tasks API.
We know that YouTube comments solve all known problems.
So when we're done, you get to decide which one of us
solved the problem better by adding a comment of your own
to our video.
COLT MCANLIS: I've got the winning solution,
and I'm about to prove it.
Real gardeners know that it's not a passive hobby.
It requires daily maintenance, water, sunlight, and attention
to make sure that those plants are growing and yielding
fruit in the optimal ways.
As such, when I think of a smart garden,
I want something that optimizes this process
and creates less work for me, which means
I want an upgraded CNC machine.
The trick here is that instead of a drill bit on the motorized
head, our smart garden is fitted with a water spout, a UV light,
and a camera to take pictures.
We'll also hook it up to some nutrient tanks,
so we can use that to spray the plants with extra food.
We could replace the cutting area with a plant bed
where the plants are placed in trays.
Each tray has a sensor in it to detect the moisture
and nutrient levels, as well as the general weight.
Because as the plant grows, the trays are going to get heavier.
Now, most DIY CNC arms are controlled by a Raspberry Pi.
But for a smart garden, we need something
that has easier interfaces to internet connectivity
and sensors.
So I'd like to add an Android Things hub, which,
besides defining the logic on driving the arm,
can also collect sensor data from the plant nutrient tanks
and communicate that with the internet.
The hub also gives us a client-side end point
to receive logic blocks that define the behavior of the arm.
See, there's always a default behavior client side.
But based upon the weather data or plant information,
we'll want to push down updates to that behavior over time.
Now, once a day, the client will go into an analysis mode
where the arm moves around to take photos and sensor readings
for each of the plants.
This data is then uploaded to the cloud for analysis.
And here is the important part.
Once the content is done being uploaded in its entirety,
we need to signal our cloud applications to start analysis.
One way to do this would be to set a cloud function that
fires off once a new GCS bucket gets
new analysis sets uploaded.
But there's a problem with that in that currently the max
duration for a cloud function is 540 seconds, which feels
a little constrained to me.
This is where the Tasks API comes into play.
Once the data is done uploading, the Android Things hub
will ping an App Engine front end,
which is responsible for pushing requests to the Task API, which
sometime later will spin up an App Engine instance
to handle the work.
These tasks can run for up to 24 hours.
So plenty of time for us to do our analysis.
Now we've got the photos of the plants,
so we want to recognize things like decay, bugs, fruit,
and the size of the leaves.
To do that, we're going to train a set of TensorFlow models
for each of these scenarios and run our pictures through it
in order to gain information about the size, health,
and growth of each plant.
But here's the complication-- we can't get to TensorFlow
from App Engine standard, which means
we need to switch over to App Engine Flex
and upgrade from the regular App Engine Tasks API
to the Cloud Tasks API.
Once the analysis is done, the results
are then pushed to data sort, which
it can be accessed by the admin console, built with Polymer,
and adhere to material design principle.
This allows our smart garden admin
to check out the status of everything,
and then see the trend lines in a nice consistent manner.
Now, in the case that something goes wrong
or an action needs to be taken by the farmer,
we leverage Pub/Sub to send messages to registered Android
devices for creating alerts.
Finally, the analysis results will
be combined with local weather, day and night cycles,
and sensor data to create and update new behavior patterns
for the arm.
This will allow our smart garden to optimize sunlight, watering,
and nutrients for each unique plant
that it's responsible for, guaranteeing
the best growth, health, and fruit yield possible.
And that, my friends, is a smart garden.
RETO MEIER: Not bad, not bad.
There's some good stuff there.
COLT MCANLIS: Well, are you ready to respond, then?
RETO MEIER: Have the Perth Wildcats
appeared in 31 consecutive NBL finals series?
COLT MCANLIS: I don't know and I don't care.
RETO MEIER: Of course they have, because they're from Perth,
so they're winners.
Let's so this.
There's a lot to like about Colt's CNC death harvester.
It's a good start, but it's lacking in imagination.
My design sets your garden free.
We take the head off the arm and replicate it
to plant dozens of independent devices,
each with its own dedicated water spout, nutrient system,
and sensor array around our garden,
one alongside each plant, tree, and flower pot.
We also incorporate some toys to help with garden maintenance,
like an autonomous lawnmower.
We still need his Android hub, which
collects sensor data from all our devices
and connects to the internet.
But rather than controlling a single arm,
it now monitors and controls the device added to each plant.
The garden devices connect to each other and the hub
using a BTLE mesh.
I'm going to take advantage of my unique Android experience
here to add an Android app.
Now normally, the whole system will
be driven by a cloud service, just like Colt's design.
But I want a local peer-to-peer override
for modifying the schedule, toggling the sprinklers.
The Android app is also how we add new plants to the garden.
You take a photo of the plant you want to add, and then
use TensorFlow to recognize it.
Now I have to admit, most of Colt's client implementation
is pretty solid.
But again, he's lacking imagination.
Colt's system performs an analysis once a day.
Let's expand that to continuously monitor
each plant.
We'll use Pub/Sub to reliably deliver
the real-time readings from every sensor up to [? run. ?]
Next, I'll upgrade the Android hub
to use the Firebase real-time database as a way
to store the watering and fertilizing schedule that'll
sync between the hub server and Android app, while still
working offline.
While we're doing databases, we'll add data [INAUDIBLE]
[? to run ?] and populate it with the care instructions
for every plant in the world.
We can adapt Colt's TensorFlow model
to adjust those baseline care instructions based
on each plant's health readings.
Now, Colt's model is static, though, so we'll
collect all of this water in Bquery
and use it to train new and more powerful models over time.
Now the Google Tasks API--
I'm not sure why Colt missed it, but I'll
use it here to handle all the gardening work that
can't be handled automatically.
Pruning trees, raking leaves, it all goes into the task list.
The task is synced on your Android app,
and you can check them off as they're done.
We use the app to replace Colt's web-based status [INAUDIBLE]
and use Firebase cloud messaging to keep it all up to date.
Then we can finish off by using Data Studio to visualize
our garden stats and add Google Assistant actions to allow us
voice controls for local updates and overrides.
COLT MCANLIS: Not bad, not bad.
I mean, not good, but not bad.
RETO MEIER: Now you've seen both of our pitches--
Colt's utilitarian farmer's plant box, and my response,
a peaceful garden where you're freed
from the manual burdens of garden maintenance
to relax and enjoy nature.
COLT MCANLIS: Now here's the really important part--
you decide which of our builds is better by leaving comments
below the video.
RETO MEIER: And don't forget to check out our companion
podcast, "Build Out Rewound," also linked in the description
below, where we'll discuss our implementations
and explain some of our decisions.
Thank you for watching this episode of "Build Out."
As always, I'm Reto Meier.
COLT MCANLIS: And I'm Colt McAnlis.
And always remember, PerfMatters.
[MUSIC PLAYING]