Arduino Smart Garden Advanced
Environmental ScienceComputing SystemsImpact of ComputingEngineering Design

Arduino Smart Garden Advanced

Grades 9–12
2 hr 30 min
13 steps
Groups of 5
STELGrade 7Grades 11, 12CSTA+6

Standards Alignment

STEL

  • 6-8-1M: Apply creative problem-solving strategies to the improvement of existing devices or processes or the development of new approaches.
  • 6-8-2M: Differentiate between inputs, processes, outputs, and feedback in technological systems.
  • 6-8-2S: Defend decisions related to a design problem.
  • 6-8-7Q: Apply the technology and engineering design process.
  • 6-8-8I: Use tools, materials, and machines to safely diagnose, adjust, and repair systems.
  • 6-8-8J: Use devices to control technological systems.
  • 6-8-8M: Use instruments to gather data on the performance of everyday products.
  • 9-12-2V: Analyze the stability of a technological system and how it is influenced by all of the components in the system, especially those in the feedback loop.
  • 9-12-2W: Select resources that involve tradeoffs between competing values, such as availability, cost, desirability, and waste while solving problems.
  • 9-12-2X: Cite examples of the criteria and constraints of a product or system and how they affect final design.
  • 9-12-4R: Assess a technology that minimizes resource use and resulting waste to achieve a goal.
  • 9-12-7CC: Apply a broad range of design skills to their design process.

Related NC CTE courses

  • Animal Science (ANSC)
  • Equine Science (EQSC)
  • Food Products and Processing Systems (FPPR)
  • Natural Resources (NARE)
  • Plant Systems (PLSV)
  • Power, Structural, and Technical Systems (PSTE)
  • Sustainable Agriculture (SUAG)
  • Drafting Engineering (DREN)
  • PLTW Engineering (PLWE)
  • SREB Aerospace Engineering (AEEN)
  • SREB Clean Energy Technology (CENT)
  • SREB Energy and Power (ENPO)
  • SREB Innovations in Science and Technology (INST)
  • Technology Engineering and Design (TEND)

Showing 12 of 52 standards.

Lesson Steps

1

Before You Begin

Not listed

Before you begin, please clear yourself a workspace, gather your Arduino Workbench, Arduino Smart Garden Add-On, and garden supplies from your teacher, and get your computer. A notebook and writing utensil are recommended, but not required.

Teaching tips

As a note, this project builds on the Arduino Smart Garden Basics Project. If you have not completed that project, you will need to do so before moving on to this project.

Each group needs: (asterisk denotes that the item is included in the Arduino Workbench)

1x Arduino Workbench Organizer with Phasedock Topper *
1x Arduino Uno on Phasedock interface *
1x Breadboard on Phasedock interface *
1x DHT11 Temperature/Humidity Sensor *
1x 470 Ohm Resistor *
Assorted Male-Male Jumper Wires *
AC to 5.5mm barrel connector power adapter (Used to power the greenhouse without a computer. Can be substituted for a battery pack if the location is without AC power, but you will likely replace batteries on a daily basis)
1x Small fan
1x Capacitive Soil Moisture Sensor 
1x 5V Relay Module
1x Submersible Water Pump
1x 1 Meter of Vinyl Tubing
At least 15-20 Male-Female jumper wires
Tiny Phillips screwdriver (PH00) for relay hookup.
Approximately 1" of 3/4 inch adhesive-lined shrink tubing per soil moisture sensor. (I made a video [far below] about shrink-tubing your soil moisture sensor)

Materials for growing the bean plants:

3x 16-ounce party cups
Approximately 2 cups of soil
Approximately 1/2 cup of gravel
3 Pinto Beans

Greenhouse Materials:

Student-sourced greenhouse materials (See note below)
Cutting implements, glue, tape, etc for assembling the greenhouse

 

Students should be instructed that they will be building their own greenhouses. Either you may supply the materials or the students can source their own materials. A good place to start is to get at least one 2-liter bottle or a plastic milk jug per student/student group. It would be good to have them keep the greenhouse in the back of their mind so they can source materials as they think of them! Make sure they bring materials to class when you have step 12 scheduled!

Another note....make sure students wash out their containers. I have had students bring in milk jugs that they saved but failed to rinse out. This particular characteristic was not brought to my attention until the student pierced the bloated milk jug with the tip of a boxcutter. The plume of gas released was less than appetizing and required a few days to get the full stink out of my classroom. 

 

These are notes from the Arduino Smart Garden Basics

Before you begin, you will need to get soil for the project if your kit does not come with soil. Most communities that have a composting program may have soil available. Alternatively, you could have students bring in their own soil samples (perhaps enough to fill a quart-size baggie) to compare the growing capabilities of different soils. 

If you have not completed the Arduino Essentials classbox, parts of this project may be linked to resources from that project. If you have completed that project, feel free to jump over those sections.

If you have not used Arduino Web Editor before, please consult your IT department about installing the Arduino Create Agent so the web editor can interface with the Arduino board.

Video about shrink tubing on your soil moisture sensor

2

Overview

5 min

Welcome to the Arduino Smart Garden: Advanced Course! You will be building off the knowledge you gained in the Arduino Smart Garden Basic Course to:

  • Make a more advanced plant watering and monitoring system
  • Wire and code a temperature and humidity sensor
  • Use a temperature and humidity sensor to control a fan
  • Incorporate the temperature and humidity sensor into the soil moisture and pump/relay system to the circuit built in the Arduino Smart Garden Basics course
  • Design and assemble a greenhouse to grow pinto beans
  • Add temperature, humidity, and soil moisture sensors into the greenhouse to control the fan and pump outputs

We will refer back to this guide for growing pinto beans on what growing conditions the pinto bean needs. 

Why do we care about temperature and humidity? We already set up an Arduino that can water a plant. Isn't that good enough? 

Well, not quite. Your beans could likely grow okay in your classroom. But, a greenhouse is a way to insulate your plant from swings in temperature. And, you want to monitor/regulate temperature and humidity. Too hot and your plants die. Too humid and your plants are at risk for fungal infections.

The key is to keep your plants in the zone where they are most happy and your Arduino is the right tool to optimize the growing environment for your pinto beans!

Teaching tips

In this project, students will:

  • Make a more advanced plant watering and monitoring system
  • Wire and code a temperature and humidity sensor
  • Use a temperature and humidity sensor to control a fan
  • Incorporate the temperature and humidity sensor into the soil moisture and pump/relay system to the circuit built in the Basics course
  • Design and assemble a greenhouse to grow pinto beans
  • Add temperature, humidity, and soil moisture sensors into the greenhouse to control the fan and pump outputs
3

Setting your input: Temperature Sensor Hookup

10 min

Sensors are important to your Arduino smart garden. Without sensors, your Arduino is "blind" and cannot sense what is happening with your plant. In this step, you will learn about how the DHT11 sensor measures temperature and then you will use the Arduino Workbench to hook up the DHT11 sensor.

David Watson, https://www.theengineeringprojects.com/2019/02/introduction-to-dht22.html, 2019

Temperature is monitored with the DHT11 Temperature/Humidity module. Under the plastic (either blue or white) cover, there is a thermistor. A thermistor is a temperature variable resistor (thus "therm-istor"). So when the temperature of the thermistor changes, the resistance changes, and that information is converted into temperature changes.

 

Below here, is a wiring guide and a video wiring guide for your DHT11 sensor!

arcaegecengiz, https://projecthub.arduino.cc/arcaegecengiz/using-dht11-12f621, 2018

 

 

Teaching tips

In this step, students will learn about the DHT11 sensor and use the Arduino Workbench to hook up the DHT11 Temperature/Humidity Sensor.

4

Temperature Sensor Code and Testing

10 min

Now that you have the circuit wired up, you will be uploading code and testing the DHT11 sensor.

Here is the example code:

And here is a video walkthrough of the coding and testing.

Once you have the temperature sensor working, we will move on to the humidity sensor!

Teaching tips

In this step, students will be uploading code and testing the DHT11 sensor.

If you are moving directly onto the humidity steps (Step 5/6), I recommend leaving the circuit assembled since the hookup for the humidity is the same as the temperature. It will safe a little time.

5

Setting your Inputs: Humidity Sensor Hookup

5 min

David Watson, https://www.theengineeringprojects.com/2019/02/introduction-to-dht22.html, 2019

Humidity is the next sensor/input we need to discuss. It is also monitored with the DHT11/DHT22 Temperature/Humidity module. In this step, you will learn about the DHT11/22 sensor and how we can wire it up in a circuit to monitor humidity.

Under the plastic (either blue or white) cover, there is a tiny metal square. This is the humidity sensor. Think of the humidity sensor as a small sandwich. Instead of turkey and Swiss, the sandwich instead has two conductors separated by a third layer which can match the humidity of the surrounding air. As the third layer absorbs or loses water, it changes the amount of resistance between the two conductors.

So, like the thermistor measuring temperature, the humidity sensor also works by changing the resistance! 

You will use this hookup guide.

arcaegecengiz, https://projecthub.arduino.cc/arcaegecengiz/using-dht11-12f621, 2018

The circuit is the same as the temperature sensor circuit. If you have taken it apart, here is a link to that video.

 

Now that you have your circuit wired up, we can move on to coding and testing it!

Teaching tips

In this step, students will be learning about the DHT11/22 sensor. They will also hook up a circuit so they can utilize the humidity sensor. If they did not take apart the temperature sensor circuit in the last step, they should still read up on how the sensor works and then move on to the coding aspect!

6

Humidity Sensor Code and Testing

10 min

Now that you have your humidity sensor hooked up, it is time to code and test to ensure your humidity sensor is functioning correctly! 

 

Here is the code we will be using:

And here is a video walking through the code and testing:

Once we have checked the functionality of the humidity sensor, we can move on to the output for the DHT11 sensor; the fan!

Teaching tips

In this step, students will be uploading code to the circuit they just wired up. They will then test their code to ensure the circuit is running as it should!

7

Setting your output: Fan Hookup

10 min

Now that we have a functioning temperature and humidity sensor, we can move on and add an output; the fan! The fan is just a DC motor, so it can actually spin in either direction depending on the direction the DC current flows. We are just going to be using it in a single direction, but that could be a consideration you could explore for your final greenhouse design!

You may be asking, "Why are we adding a fan to a greenhouse?" Well first, most greenhouses have some form of ventilation. A fan can regulate temperature and humidity through two mechanisms.

First, the fan can bring in air from outside of the greenhouse. The air outside the greenhouse is often cooler and drier than the air inside the greenhouse. This fresh air can help cool the greenhouse and decrease the humidity. Some greenhouse designs use vents at the bottom of the greenhouse and a fan near the top of the greenhouse. This means that the process of convection can help cool off the greenhouse too!

Secondly, a fan can help regulate the temperature in the greenhouse through evaporative cooling. This is the same mechanism that your body uses to stay cool. As you get too hot, your body sweats. That sweat begins to dry and pulls heat away from you as it evaporates. Similarly, as drier air is pulled into the greenhouse, it can help evaporate some of the moisture which lowers the temperature!

Here is the Hookup Guide:

And here is a video walking through the hookup process:

Once you have completed that, we can move on to uploading code and testing!

Extra Test

If you would like to ensure that your fan is functioning properly, here is a quick sketch that will turn on and off your fan (don't worry about the rest of the components hooked up). This will just activate your Pin 2 (Fan Pin) to turn off and on in 2-second intervals. It will let you also check to see which direction your fan is blowing!

Teaching tips

In this step, students will be adding a small fan to the DHT11 Temperature/Humidity circuit they have created. 

In this step, students are introduced to evaporative cooling. When you Google "How does evaporative cooling work?" you get a ton of advertisements for HVAC suppliers. So here is a good, non-advertisement-ridden video showing evaporative cooling in action if you want to show your class.

 

 

8

Setting your output: Fan Code and Testing

10 min

Now that we have our circuit connected, we can look and see how the Arduino can use the input from the Temperature and Humidity to turn on and off the fan.

In the code below, on lines 6 and 7, there are thresholds. Once those values get crossed, that will effect a change. The source material that you got in the Overview step discusses growing conditions for pinto beans. How do you think those thresholds can be used to grow pinto beans in optimal growing conditions?

Remember: if you change any values in the code, leave a comment behind the // so other collaborators or your future self knows what you did! Don't worry, you can always come back and tweak these values as your group chooses!

Here is the code we will use for the DHT11 Temperature/Humidity input and the Fan output:

And here is a video walkthrough of the code and a basic test of the functionality:

Once we have our fan working, we can incorporate the parts from the Arduino Smart Garden Basics (Soil Moisture and Pump) to create a more functional garden setup!

Teaching tips

In this step, students are asked to find what temperature range pinto beans prefer. Students are given this guide for growing pinto beans. If students cannot find the information, have them look in the Pinto Bean Care section under Temperature and Humidity. "Pinto beans are a warm-weather crop, but they have tolerance limits for heat. In extremely hot weather and temperatures over 93 degrees F, they won’t flower and set bean pods."

So, while there is no method to increase the temperature in this project, the temperature should not reach above 93 degrees F (About 34 degrees C). The temperature sensor often uses Celsius so this should be the set point to activate the output (blower fan)

Later, students will set a maximum humidity level for their greenhouses. The source material that we have been using just says, "In high humidity, the foliage is prone to get fungal diseases such as powdery mildew."

Since it doesn't state what high humidity actually is, students will likely need to find another resource for that or intuit what high humidity should look like. As long as students are able to justify their reasoning, I don't really care what number they choose as the highest level of humidity the system would tolerate. But, if you care that the plants don't potentially mold, This link gives some numbers, but not particularly for the pinto bean. This pops up in the first ten or so results when you Google "what is considered too high "humidity" for pinto bean plants." So it should not be inaccessible for your students to find.

Note: Phaseolus Vulgaris is a species that has been grown for thousands of years, thus, it has dozens of cultivars. The second link (above) does not talk about pinto beans, but P. Vulgaris in general. If students are confused by this, give them the example of dogs. All dogs are the same species (Canis Familiaris). But, because an English Mastiff looks different from a toy fox terrier, doesn't mean that they are not the same species. You can interbreed any of these dogs to get new dogs...like the labradoodle or other new breeds.

9

Hookup for Full Arduino Smart Garden

10 min

In this step, you will be wiring up the full Arduino Smart Garden.

The full smart garden works as follows:

  1. The soil moisture sensor will "read" the soil by testing its capacitance. When a threshold of dryness is exceeded, the relay will turn on the pump to water the plants.

  2. The temperature sensor will "read" the air temperature with the thermistor. When the air gets too hot (above the set threshold), the fan will turn on to cool the plants.

  3. The humidity sensor will "read" the amount of moisture in the air with the capacitive plates. If it is too humid (above the set threshold), the fan will turn on to bring in dry air.

  4. This loop continues until the Arduino is shut down

 

The video below covers the full hookup process so you do not need to reference back to the videos from the first project. 

As with the Arduino Smart Garden Basics, make sure the pump is a good distance away from the Arduino (at least 18-24" away). This can be done with M-F Dupont jumpers.

Here is a diagram of the circuit hookup:

And here is a video walkthrough of wiring the circuit up:

Once we have this circuit wired up, we can move on to coding your smart garden!

Teaching tips

In this step, students will be wiring up the full Arduino Smart Garden. The video covers the full hookup process so you do not need to reference back to the videos from the first project. 

The most important thing that can be stressed here is to make sure the pump is a good distance away from the Arduino (at least 18-24" away). This can be done with M-F Dupont jumpers. It is covered in the video, but if the circuit is not functioning properly, 99% of the time, it is because the pump was too close to the rest of the circuit. Isolation via space is key!

10

Coding for Full Arduino Smart Garden

10 min

In this step, you will be uploading code to your complete full Arduino Smart Garden!

Below is the example code we are going to be using. Don't forget, even though this is similar to codes we have used, this is a completely new code, and any changes you have made need to be transposed over here (and don't forget your comments!). For example, if you made changes to the temperature threshold in your fan code, you will need to bring that over here too!

Below is a video walkthrough of the code with some suggestions as to where you can make changes!

Once you have wired up and coded your smart garden, we can move on to testing!

Teaching tips

In this step, students will be uploading code to their complete full Arduino Smart Garden. 

I do recommend having students unplug Pin 8 (the relay pin) when they upload the code. Otherwise, the soil moisture sensor will likely be dry and the relay will turn the pump on. This is kind of annoying (and might damage the pump with extended use without water or "running the pump dry"). When students are ready to test, then they can plug in pin 8.

11

Testing your Full Arduino Smart Garden

10 min

In this step, you will be testing (and possibly troubleshooting) your full Arduino smart gardens.

In the Arduino Smart Garden Basics project, you used the soil capacitive moisture sensor to help determine what the moisture threshold should be for your pinto beans. If you still have that information (possibly in an older Arduino sketch from that project) you should include that in this sketch too. Don't forget to bring over any comments too!

To ensure that all parts are working, you will need:

  1. A way to push the soil capacitive sensor past the threshold to turn on the relay/pump (I used a container of water in the video)
  2. To test the humidity/temperature sensor to make sure that going above the threshold turns on the fan

A quick note: if your relay/pump will not turn off even if you dried off your soil moisture sensor OR your serial monitor freezes up, that is likely caused by EMI from the pump. Use male-female jumpers to add distance between the pump and the rest of the system!

Here is a video walking through testing the full Arduino Garden:

Once your garden is functioning, we can look at designing your greenhouse and incorporating the components into your greenhouse!

Teaching tips

In this step, students will be testing (and possibly troubleshooting) their full Arduino smart gardens.

In the video, I used a small tube of water to test. It just makes things easier than putting the soil moisture sensor in moist dirt and then cleaning it off again. But if they used their cup for the submersible pump and then dipped the moisture sensor in and out, that would be a good test.

In the Arduino Smart Garden Basics project, students used the soil capacitive moisture sensor to help determine what the moisture threshold should be for their pinto beans. If they still have that information (possibly in an older Arduino sketch from that project) they should include that in this sketch too!

12

Design and Build a Smart Greenhouse

30 min

In this step, you will design and build a greenhouse out of sourced materials. 

A greenhouse is its own microclimate. In this semi-isolated environment, you can control moisture, temperature, and humidity. Since you can change the set point values for these variables, you can make a growing environment that can be adaptable for a wide variety of plants. Think, you could even grow a cactus next to an orchid. In the wild, these things could never live in the other's environment (desert vs. rainforest). But, with the ability to give each plant the environment it needs, they can be happy in their own little greenhouse!

You will need to design your greenhouse before you start cutting and taping things. 

 

Some things to consider when designing your greenhouse:

  • Size
    • How big is this going to be? How many plants would you want to grow in your greenhouse?
  • Height
    • How big do pinto beans get? You don't want a container that is 6 inches tall when your plant grows over a foot in height!
  • Color
    • What color do you want your greenhouse to be? In my example, my bottle is green. Do you think that would be better or worse compared to a clear bottle? If you used an opaque milk jug versus a clear bottle, would that have an impact?
  • Materials
    • Materials have a lot of physical properties (like color, discussed above). Thermal resistivity or thermal conductivity are characteristics that discuss how easily heat flows in and out of the greenhouse walls. What about the strength of the materials? Will your greenhouse stay standing during the testing?
  • Ventilation
    • Where are you going to put your fan? Do you think your fan needs more than one opening in the greenhouse to provide adequate ventilation? Make sure you don't add too much ventilation, if your greenhouse looks like swiss cheese, it won't hold in any humidity and heat and would be no different than having your plants out in the open. Make sure to be strategic and deliberate about your vents!
  • Insulation
    • On top of carefully placing your vents, do you need to retain more heat? Some greenhouses use materials like double-hung windows to both keep heat in that also allow light to come in. 
  • Inputs and outputs
    • Don't forget to think about how you are going to be putting your sensors in your greenhouse and make sure you have a way to get your water in from the pump!

 

Below is an example of what your greenhouse design could look like. Do not emulate it, it is not a super great design!

Also, here is a video to watch. It has some good thoughts and considerations on your greenhouse design:

Once you create your greenhouse, hopefully, it will be a good environment for your pinto beans. You may need to monitor your garden for a few days to make sure the plants are getting enough water or are not getting too much water. You may have to tweak your threshold values in your code. If you do this, make sure you comment on these changes!

Congratulations! You now have an automated, low-maintenance growing solution for a plant!

Reflection

You have spent a lot of time around your Arduino getting it to take care of plants. 

What are three other ways you could use an Arduino either around your house or at school (besides just caring for plants)?

1.

2.

3.

What are three things you learned about through your journey with this project?

1. 

2. 

3. 

Teaching tips

In this step, students will design and build a greenhouse out of sourced materials. 

Remind students that safety is paramount and that wildly stabbing a plastic bottle is a surefire recipe to impalement...either theirs or a groupmates. 

Students should design their greenhouses BEFORE they start cutting and gluing their greenhouses. Once you give them the green light on their greenhouse design, then they may start assembly.

At the end is a brief reflection. Feel free to use this as the exit ticket for the class period!

13

Optional Extension: Inquiry and Biomes with Arduino Smart Garden

30 min

Now that you have a functioning Arduino garden, what are you going to do with it? One thing you can do is set up several gardens with the same setup and run them with only one variable changed between each setup.

We would call this a controlled experiment!

In this step, you will set up several Arduino Smart Gardens Greenhouses to grow pinto beans. The setup, location in the classroom, and code will all be the same. You will be changing a single variable (Soil Moisture Threshold) to see how that one variable has an impact on the growth of the pinto beans.

To do this experiment:

  1. In the sketch for the Arduino Smart Garden Final (Found in Step 10) each student group will make a copy of this code. The ONLY line of code we want to modify is Line 15 which establishes the soil moisture threshold. The default is 500.
  2. In your groups, determine what values you will change the soil moisture threshold. They should be values that are evenly spaced. For example, if there are 4 student groups, you could set the value of the soil moisture threshold for Group 1 as 500, Group 2 as 525, Group 3 as 550, and Group 4 as 575. This would mean that the soil would need to get more dry before the pump turns on. This could be similar to growing in a rainforest compared to a temperate forest compared to a desert biome!
  3. Once your group starts the experiment, you will need to monitor and take daily readings of your soil moisture, temperature, and humidity. If you are not leaving a computer hooked up to your Arduino to collect data, you will need to try to collect data at the same time each day.

An example log could look like this:

Group 1 Log Day 1 Day 2 Day 3 Day 4 Day5 Day 6 Day 7 Day 8 Day 9 Day 10 Day 11 Day12 Day 13 Day 14
Soil Moisture                            
Temperature                            
Humidity                            
Growth Height of Bean Plants                            

At the end of the established growing times, how can you compare your data to the other groups? Can you express your data in a graph? Can you perform any statistical calculations to show that there is a significant difference between the different growing conditions?

Beyond this, what other experiments could you devise using this same setup?

 

Teaching tips

In this extension activity, students will use their smart gardens to investigate different growing conditions. These growing conditions can be compared to different biomes or even plant hardiness zones.

This is not directly aligned with a high school NGSS standard, but there is a middle school standard (MS-LS2) that covers biomes. 

In this activity, students will change one variable (which I will designate as soil moisture threshold, but you may modify this variable as you see fit). The student groups will then use the same code (and possibly greenhouse design if you want a controlled experiment) except for the slight change in the soil moisture threshold) and then grow pinto beans for a set number of weeks. Qualitative and quantitative data will be collected daily. Then, the results will be compared and conclusions drawn.

So are we ready to do some inquiry?!

If your school does not have anyone who involves students in inquiry, you may wish to show this video as a primer

Materials

  • Circuit Components Box — 5 per group
  • ELEGOO UNO — 5 per group
  • Phase Dock Workbench — 5 per group

Related Supply Kit

Arduino Workbench

All the hands-on materials you need for this lesson, delivered to your classroom.

Ready to bring this lesson to your classroom?

Sign up to save this lesson, order supplies, and track student progress.