During the lesson, students learn the basics of physical programming.
The objective: create a simple system that will inform us about the condition of the soil in houseplants.
Hardware:
Software:
Learning objectives:
Some of the concepts were challenging for students of this age. Despite this, the lesson successfully transitioned students from passive data reading to active system design. By removing the screen and relying on two LEDs, students were forced to determine “healthy soil” logically, rather than simply by reading a number. The most important takeaway was the students’ understanding that human-defined context (calibration) is essential for sensors to operate effectively.
Objective: Discussion on basic Arduino knowledge.
Discussing and introducing questions:
Objective: Building and programming a single LED circuit. The Task: Connect a single LED to Pin 13 and Ground (GND).
Safety First: Explain why we use resistors (to prevent the LED from “blowing up” from too much current).
Polarity: Teach students that LEDs have a long leg (Positive/Anode) and a short leg (Negative/Cathode).
The Code: Introduce the Blink sketch.
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // Turn LED on
delay(1000); // Wait 1 second
digitalWrite(13, LOW); // Turn LED off
delay(1000);
}
Activity: Students must successfully make their LED blink before moving to the main project.
Constructing the Plant Saver full system.
1. The Hardware Setup
Students will now expand their circuit to include:
2. The Logic (Programming)
Explain the if/else logic: If the soil is dry, then turn on the Red LED. Otherwise, turn on the Green LED.
const int sensorPin = A0;
const int redLED = 3;
const int greenLED = 2;
void setup() {
Serial.begin(9600);
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
}
void loop() {
int sensorVal = analogRead(A0);
Serial.println(sensorVal);
if( sensorVal > 450) {
digitalWrite(redLED, HIGH);
digitalWrite(greenLED, LOW);
}
else{
digitalWrite(redLED, LOW);
digitalWrite(greenLED, HIGH);
}
}
Having trouble? Let us know by completing the form below. We'll do our best to get your issues resolved quickly.
"*" indicates required fields