RETO: Welcome to Build Up, 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: Colt McAnlis, the only one of us
who's actually done any real engineering.
Who's thumb is the greenest?
Find out now on Build Up.
RETO: Colt lost the coin toss, so now he has to go first.
He'll have four minutes to describe
his mock solution, including one arbitrary VP requirement.
I'll then have three minutes to respond.
COLT: This week our VP of engineering
has mandated that we use--
RETO: The Tasks API
COLT: Yes, the Google cloud Tasks API
RETO: 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: I've got the winning solution
and I'm about to prove it.
RETO: Colt's from Las Vegas, and well,
I put Las Vegas landscaping into Google
and it's just rocks, cactus, and mesquite bushes.
Did anyone show Colt a picture of a garden?
COLT: Real gardeners know that it's not a passive hobby.
It requires daily maintenance, water, sunlight, and attention,
to make sure those plants are growing and yielding
fruit in the optimal ways.
RETO: Yielding fruit?
Oh does Colt think a garden is an orchard?
COLT: 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.
RETO: OK, so no to the "Does Colt know what a garden is,"
question.
COLT: It's a freaking CNC machine for God's sake.
That's amazing.
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.
We can use that to spray the plants with extra food.
We can replace the cutting area with a plant bed
where the plants are placed in trays.
RETO: Wait, is he still talking about plants?
Did any of these diagrams indicate scale?
All I see is a six, is it feet or inches?
Feet or inches?
You know, Colt, has anyone confirmed
this thing isn't for people?
COLT: Yes, yes of course it's designed for fruit.
Although, you probably could be used for something else.
RETO: Well?
COLT: Like flowers.
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.
RETO: Oh, could we get some pie?
COLT: No, a Raspberry Pi.
P-I. The small, single board computer.
RETO: This is really good pie.
COLT: 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.
RETO: Oh an automated machine for planting and harvesting,
driven by self-learning AI.
Why does every solution Colt proposes
sound like the cause of salvation
in an apocalypse movie?
COLT: See, there's always a default behavior client side,
but based upon the weather data or plant information,
will 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.
RETO: Not many people know this, but every Saturday, Colt
methodically photographs and measures
every tomato in his garden.
COLT: "Toe-may-toe."
This state 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.
RETO: Carry the one.
Yeah that's nine minutes.
COLT: Which feels a little constrained to me.
This is where the Tasks API comes into play.
The Google cloud Tasks API 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 Tasks API, which sometime later will spin up an app
engine instance to handle the work.
These Tasks can run for up to 24 hours.
RETO: Or, you know, 86,400 seconds.
COLT: 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.
RETO: On Sundays, he measures tomato leaf sizes.
COLT: "Toe-may-toe."
To do that, we're going to tray 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.
And I have access to it and Reto does not.
RETO: I don't think any of Colt's code
has ever gone into production, so I
guess he's more comfortable with alpha software.
COLT: Once the analysis is done, the results
are then pushed to DataStork, which
can be accessed by the admin console built with polymer
and adhere to material design principle.
RETO: Oh, a web based admin console, huh?
I guess Colt's still not that comfortable with Android.
You know, I do have some extra copies of my book,
if he needs one.
COLT: Are, are you ser--
I was an advocate on the Android team for God's sake.
I know how to build an Android app.
RETO: What's the problem?
Did he want me to sign it?
COLT: 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.
So, I think I missed an opportunity here.
I should have also used TensorFlow
to control the arm in a more fine grained manner.
It would have been really useful to have
it do things like move the arm to remove weeds
from the garden.
You know, actually if I increase the speed of the CNC head
I bet I could engineer it to catch bugs or even
small animals.
RETO: Yes, I am interested in your deluxe edition panic
bunker.
Yeah, that's apocalypse proof, right?
Yeah, I'll hold.
COLT: 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.
Listen, I got to tell you, I'm happy with my design.
The point of a smart garden should
be to alleviate some of the work so that I don't have to do it.
This gives me way more time to do other stuff,
like write books on data compression.
RETO: Well, it's good that Colt tried.
You can really see the effort he's putting here imagining
what a garden must be like.
It's a little utilitarian for my taste
and the dystopian overtones are frankly terrifying,
but it's a worthy first effort from Colt,
and it shows that he's really trying.
Not bad, not bad.
There some good stuff there.
COLT: Well, are you ready to respond, then?
RETO: Have the Perth Wildcats competed in 31 consecutive NBL
final series'?
COLT: I don't know and I don't care.
RETO: Course they have, because they're from Perth,
so they're winners.
Let's do 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,
deploying dozens of independent devices,
each with its own dedicated water spout, nutrient system,
and censor 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.
Yeah, they're a thing.
We have one at work.
His name's Bob.
He hangs out with the self-driving cars.
Nice guy, studying to be a web developer.
COLT: So, wait a minute.
How exactly are you going to mow a lawn that
has IoT devices over it?
Seems like it would just sound like [WHITE NOISE]..
RETO: We still need his Android hub, which
collects sensor data from all devices
and connects to the internet, but rather than controlling
a single arm, it now monitors and controls
the device added to each plant.
And Bob.
The garden devices connect to each other and the hub
using a BTLE mesh.
COLT: There is an engineer somewhere
whose personal version of hell is
configuring all of Reto's 1,000 IoT devices
to work with Bluetooth.
RETO: I'm going to take advantage of my unique Android
experience here to add an Android app.
COLT: I did like 100 Android videos.
Why does no one remember this?
RETO: Now, normally the whole system will be driven
by our cloud service, just like Colt's design,
but I want a local peer-to-peer override for modifying
the schedule, toggling the sprinklers,
or in case Bob figures out how to cut my network cable
and begins his inevitable uprising to ultimately ens--
[BEEPING]
[STATIC]
Right, sorry.
The Android app is also how we add new plants to the garden.
Take a photo of the plant you want to add
and then use TensorFlow to recognize it.
COLT: Listen, this is classic Reto engineering.
Using machine learning to complete a task
you could do twice as fast, twice as accurately,
and 10 times more easily by just typing the name
of the plant into the app.
RETO: Check it out!
I built an app that controls the lights,
based on my facial expression.
I frown to turn them off and smile to turn them back on.
It may need some work.
Now I have to admit most of Colts clean implementation
is pretty solid, but again, he's lacking imagination.
To start, I've named my service Ronald the app engine.
COLT: I think it might.
I think it might.
Yeah, I'm pretty sure my design's still better.
RETO: 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 Ron.
Next, I'll upgrade the Android hub to use the Firebase
realtime 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 are doing databases, we'll add datastore to Ron
and populate it with the care instructions
for every plant in the world.
The only thing is, who can we trust to create that database?
COLT: [LAUGHS] That sounds like a job for an intern.
RETO: It feels like maybe this is a Colt sized job.
We can adapt Colt's TensorFlow model
to adjust those baseline care instructions based
on each plants health readings.
Now, Colt's model is static though,
so it will collect all of this data in BigQuery
and use it to train newer, more powerful models over time.
Now, the Google Tasks API.
COLT: Google cloud Tasks API.
RETO: 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.
COLT: The restriction was clearly referring to the cloud
Tasks API which lets you schedule and defer work
for a later date.
I don't really know what he's talking about here,
but that's not what the task API is for.
RETO: I think Colt was thinking about the cloud Tasks API.
It's an easy mistake to make.
Let's let him off the hook this time.
COLT: No, nononono.
I am not losing points because the Aussie use the wrong API.
RETO: The Tasks are synced on your Android app
and you can check them off as they are done.
We'll use the app to replace Colt's web based
stratosphere 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 overwrites.
I'm really happy with that.
I'll admit my response added a little complexity,
but it's worth it for the flexibility.
COLT: This is classic Reto over engineering.
It's over complicated, expensive, and half of it
doesn't even work.
You'd get the same result if you printed out
the top titles of Hacker News, force fed them to a platypus,
and waited two hours for the result.
Now to be fair, though, Bob is actually really cool.
He invited us out on his boat this weekend.
I'm really looking forward to that.
Not bad.
I mean, not good, but not bad.
RETO: Now you've seen in both of our pitches,
Colts utilitarian [INAUDIBLE] 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: Now here's the really important part.
You decide which of our builds is better by leaving comments
below the video.
RETO: 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: And I'm Colt McAnlis.
And always remember, perf matters.
PRODUCER: Colt, we heard back from the review judges
and you're right, it's not supposed
to be the Google Tasks API.
COLT: Haha, in your face.
PRODUCER: Yeah, or the cloud Tasks API.
RETO: Wait what?
PRODUCER: It says here you were meant
to use the Firebase Tasks API.
Aren't you supposed to be Android experts?