Code to keep it alive
Maintaining optimal living conditions for a plant inside a greenhouse using codable digital sensors and outputs. Using information about the plant’s environment, such as light, temperature and moisture, learners are challenged to code a microcontroller so that it provides the plant with enough water, heat and light for it to grow and develop.
By using Arduino controllers in this hands-on and relevant activity learners can develop coding skills to solve a real life multidisciplinary challenge.
Abstract: In this activity learners will use an Arduino microcontroller to sense and react to changing environments inside a small greenhouse in order to maintain optimal conditions for a plant inside the greenhouse to thrive. The Arduino connects with sensors for light, temperature and soil moisture inside the greenhouse, and can respectively turn on a plant light if the ambient light becomes too dark, open a window if the greenhouse becomes too hot and water the plant if the soil becomes too dry. The aim is for the learners to understand how they can edit the code for optimal plant growth.
Keywords: Microcontroller, Arduino, ecology, sensors, conditions for life, multidisciplinarity, sustainability, coding
The resource list:
- A greenhouse with sensors and outputs to measure light, soil moisture and temperature and relevant devices to counter relevant changes in these environmental variables – this pdf describes how to construct such a greenhouse.
- An Arduino microcontroller
- A suitable tablespace in the classroom, close to a window and an electrical outlet.
- A laptop to connect to the Arduino
- Free Arduino IDE software to manipulate code and communicate with the Arduino.
The background and importance of the topic
Coding or some sort of algorithmic thinking has in the recent years been included in most national curriculas. Teachers need concrete and simple ways of challenging learners to learn how to use coding for relevant and hands-on challenges. Microcontrollers are small computers that are often used in educational context, as they can be cheap and easily accessible. The Arduino is such a versatile pocket-sized microcontroller that can be integrated into all sorts of projects, making it suitable for children of any age.
The Arduino comes with a simple Arduino IDE software that allows for a host of sensors and outputs, easy coding, has a rich and lively online user community and a multitude of code-snippets and real-life examples are freely available for download.
The extraordinary number of sensors and output-devices allows the Arduino to sense and interact with its environment, thus making it very well suited for small-scale classroom projects.
Very often simple classroom coding assignments can appear as very theoretical and abstract to learners. Microcontrollers, with their ability to sense and interact with the reality surrounding them, provide excellent ways of working with coding in manners that appear relevant and concrete to students.
Integrating coding projects with a clear and concrete challenge in the classroom can increase learner involvement and engagement. Furthermore, by making the project revolve around a living organism such as a plant, the project can appear more meaningful to the learner.
Also, such a project challenge provides the learner with a multidisciplinary challenge, as knowledge and competences within coding, basic engineering, electronics and biology are needed to solve this challenge. This is in accordance with many new national curricula, where multidisciplinarity and more open problem solving is an emerging feature.
Activity description
In this training module learners will learn how a simple microcontroller can be used to sense information about the environment, how it can be coded to evaluate this information and, finally, be made to provide a relevant output.
The activity does not include the construction of the greenhouse with the sensors and Arduino connections, but assumes that the teacher/staff has constructed this setup somewhat along the lines of the above mentioned Greenhouse.
Step 1 through 3 can be conducted on day 1, when the greenhouse and the project is introduced to the class. Step 4 and out are long term steps that might have several iterations.
Step 1: The activity starts with learners familiarizing themselves with the greenhouse, the plant, the sensors and the various outputs in the greenhouse.
Step 2: Connecting a laptop and viewing the sensor readings and how the code interprets these readings. Allow the learners to influence the sensors to see the output. For example, touch the temperature sensor, so that its temperature increases, and see if the hatch opened. Alternatively, pull the soil moisture sensor out of the plant dirt, and see if this makes the watering system start.
Step 3: Explain the code, and indicate where the various threshold values are defined. Allow the students to play with manipulating these to experience how the greenhouse handles these changes. Return the greenhouse to its initial settings.
Step 4: Over the next week, connect the Arduino to a laptop daily to read and discuss the values for light, temperature and soil moisture. Discuss whether any of these should be adjusted to provide for more optimal conditions for the plant.
End of project: the project has no real end, and can run in the classroom as long as the pupils have an interest in the project, and as long as the teacher can maintain and expand (see below) the challenge.
Figure 1: An example of sensors and outputs that should be available for this activity to work: A light sensor that can indicate whether or not the plant light should be turned on, a soil moisture sensor which indicates when to open water valve for watering and a temperature sensor to give information on whether the hatch should be opened for cooling to take place.
Activity solution
The aim is to maintain the plant alive in the greenhouse using instructions coded into the Arduino. This will require the learners to adjust the threshold values and perhaps do some adjustments to the initial code.
The main challenge then, is for learners to observe (over a longer period of time) how well the plant is doing, and tweak the three outputs to suit the plant the best.
The project doesn’t necessary have a clear cut end, but can last as long as it appears to be useful in the classroom, from a few weeks to the whole school year.
A video demostration
Enhancing the Activity
The challenge is to keep a plant alive inside the greenhouse by coding the Arduino in such a manner as to maintain the plant’s life conditions.
It is a long term project that can be expanded to include new sensors and outputs, as the learners develop familiarity and interest in the setup.
How can this greenhouse be expanded to include other sensors? What other environmental factors influence the life of a plant? Can we add sensors to monitor this, and outputs to influence these? For example:
- can a fan be added to the greenhouse, if opening a hatch isn’t enough to cool the greenhouse down on sunny days?
- can a sensor be added to measure the water level in the reservoir and light a small indicator when it needs to be refilled?
- can the system be modified to run off a solar charged battery?
The knowledge test
What is a microcontroller?
Why should the wires in the greenhouse be a little bit above ground?
Special needs’ learners
To simplify the learning process it is possible to give the learners more time and follow the step-by-step guidelines together with the teacher. The learners could also be organized with different responsibilities and more limited operations, as mentioned above. The Code-to-keep-it-alive concept offers a rich environment for participation, and invites learners of any interest and ability to find an area of the setup where they can contribute with competence and effort. Some learners can focus on the coding, while others work on the programming more specifically, and a third group can focus on the biology aspect of the project. Then they can work together when the system is established. It is also possible for the teacher to pre-arrange most of the coding with the microcontrollers.
Alternative activity
This project can be simplified and reorganised in many ways. A very simple alternative version is to just have a potted plant in the classroom with a watering system and soil humidity sensor, skipping the whole aspect of the greenhouse and the other sensors. In essence, any codable sensor & output setup providing support for a plant would be a useful alternative activity.
Conducting a Workshop
This STEAM learning activity workshop is addressed to primary school teachers who wants to create a physical workshop adding simple design, mechanics, electronics and computing skills and coding to it.
This activity could be designed in five phases:
- Introducing a working example of the greenhouse, with all the sensors, outputs and a microcontroller installed. Allowing the participants to explore the setup and try to make sense of it in small groups. Groups then present to each other what they think this greenhouse is and how it works. Instructor supplements the groups’ explanations & understasndings when needed, so that at the end of this phase the participants understand the general layout and function of the greenhouse. (~20 minutes)
- Introduce the participants to plant biology and the requirements of the plant in this setting (~10 minutes)
- Introduce the participants to the pairs of sensors/outputs (light sensor & plant light, soil humidity sensor & water valve, temperature sensor & window opener), and how they are connected to the Arduino microcontroller. (~15 minutes)
- Introduce the participants to the Arduino code, go through each segment and finally focus on the part of the code describing the adjustable variables that decides the border values for responses. Allow participants to discuss and adjust the values to see how the system responds to such changes. (~60 minutes)
- Opening up a discussion on how to maintain and expand such a system in a classroom. (~30 minutes)
References
Barrett, S. F. (2012). Arduino Microcontroller: Processing for Everyone!. Synthesis Lectures on Digital Circuits and Systems, 7(2), 1-371.
Cira, N. J., Chung, A. M., Denisin, A. K., Rensi, S., Sanchez, G. N., Quake, S. R., & Riedel-Kruse, I. H. (2015). A biotic game design project for integrated life science and engineering education. PLoS biology, 13(3), e1002110.
Pachina, N., Evdokimova, A., Zharikova, E., Grigorieva, L., & Pachin, G. (2022, May). Development and Implementation of the «Smart Greenhouse» Project in the Educational Process of an Educational Institution. In 2022 2nd International Conference on Technology Enhanced Learning in Higher Education (TELE) (pp. 92-96). IEEE.