Arduino · Grade 5 · Guided practice
How to code this project
What you will make: Display an average temperature reading and turn on the built-in LED above a chosen temperature.
This complete starter selects the temperature-only option using a TMP36. It does NOT measure air quality, humidity, CO₂ or whether a room is safe. The Serial Monitor is the display; an external display needs its own driver and wiring.
Before you start
- Reference build only: Arduino Uno R3 (5 V, 10-bit analog input), TMP36 temperature sensor, breadboard and insulated jumpers. This sketch is NOT for a DHT, thermistor, CO₂ sensor, Uno R4 or a 3.3 V board without adaptation.
- Disconnect power. An adult checks the exact TMP36 package pin diagram: connect +Vs to 5 V, GND to GND and Vout to A0. Follow the manufacturer’s decoupling guidance. Do not identify pins from a generic picture or another sensor’s wire colors.
- Use a teacher-approved USB supply and dry work surface. Open Serial Monitor at 9600 baud. Check a plausible room-temperature reading before building an enclosure.
Opening and saving: In the teacher-installed Arduino IDE, open a new sketch, replace its entire contents with the starter, and save it with a project name. Select Arduino Uno and the connected port, click Verify (check mark), then Upload (arrow). Disconnect power before wiring. If uploading fails, check the board, USB data cable and port with the teacher. These starters still require an adult bench test on your actual hardware.
Build it one step at a time
- Run Blink first to check upload. Disconnect power before the adult wires the TMP36.
- Paste the full sketch, verify and upload. Open Serial Monitor at 9600 baud.
- Read five samples: the for loop adds them; dividing by five gives their mean. The label C means degrees Celsius.
- Wait for stable readings; compare with a classroom thermometer. Stop and check wiring if readings are implausible.
- The 28 C threshold is just a classroom demonstration choice, not a ventilation recommendation. Test the LED by temporarily choosing thresholds just above and below the observed temperature.
- Collect readings at equal intervals in three teacher-approved locations. Label the sensor and units on your graph.
Complete starter sketch
float readC() {
float volts = analogRead(A0) * (5.0 / 1023.0);
return (volts - 0.5) * 100.0;
}
const float alertC = 28.0;
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
float sum = 0;
for (int sample = 0; sample < 5; sample++) {
sum += readC();
delay(20);
}
float meanC = sum / 5.0;
Serial.print("Temperature C: ");
Serial.println(meanC, 1);
digitalWrite(LED_BUILTIN, meanC > alertC ? HIGH : LOW);
delay(1000);
}Predict, test and record
Write your name and date on the printed page. Run every test, note the actual result, and retest after one change.
| Try this input | Expected result | Actual result / retest |
|---|---|---|
| Room-temperature start | Plausible labeled C readings roughly every 1.1 seconds | ________________ |
| Upload threshold above observed reading | Built-in LED off | ________________ |
| Upload threshold below observed reading | Built-in LED on; restore chosen threshold afterwards | ________________ |
If it does not work
- Unreadable serial characters? Set monitor baud to 9600.
- Extreme or jumping values? Power off; adult checks sensor model, pinout, loose leads and board type.
- A different sensor? Stop and use its manufacturer’s wiring/library example; this formula is TMP36-specific.
Make one change
Compare one reading with a five-reading average under the same conditions; explain whether averaging reduced variation, not whether it made an uncalibrated sensor accurate.
We changed __________. We predicted __________. Our test showed __________.
Teacher pacing: Use a 45-minute coding session: 5 minutes to predict, 10 to model a first working response, 20 for paired building, 7 for tests and 3 to save and explain. Continue in another meeting if setup or debugging takes longer; do not rush hardware checks.
Grade 5 support: Start with the working reference version, then explain each condition or state. Keep an input/expected/actual test log and change only one variable at a time.
Teacher learning resources
Preview resources before class. Follow this page’s specified reference build; another tutorial may use different hardware.
Print support: The lesson’s Print button includes this guide, recipe and test table.
For teachers
Engineering standards
This shows how the lesson connects to the national NGSS engineering standards and what student work you can collect.
3-5-ETS1-1
Teams define who needs the classroom air monitor and set measurable performance, safety, material, and time limits.
What students show: User-centered problem statement with criteria and constraints.3-5-ETS1-2
Teams compare at least two circuit, code, or enclosure ideas against the success criteria.
What students show: Labeled system diagrams and a recorded design choice.3-5-ETS1-3
Teams run a repeatable test—take readings for equal time intervals at three approved locations—then change one variable and retest.
What students show: Test table, code or build revision, and evidence-based explanation.Materials
- Cardboard, paper, craft sticks, tape, reusable building pieces, and student-proposed materials
- Project platform: Arduino + 3D printer
- Breadboard, paper-circuit supplies, or low-voltage power when needed
- temperature, humidity, or classroom air sensor input component or student-designed substitute
- display and status LED output component or student-designed substitute
- LEDs, resistors, jumper wires, copper tape, switches, and clips as needed
- 3D Printing materials for an optional case, sign, mount, or model
- Computer with approved coding or simulation tools when needed
- Planning sheet, ruler, and test-data table
Teacher preparation
- Build and test one possible reference solution without making it the required design.
- Prepare a basic-materials table plus optional electronics and fabrication stations.
- If coding is used, prepare a starter option for sensor sampling, averaging, and display logic; students may propose another workable control method.
- Prepare optional fabrication templates and a file rule beginning G5_11.
- Mark adult approval points before power-on and machine fabrication.
Step by step
How to teach it
Meet the user and define success
- Introduce the application: Help a classroom compare environmental conditions in different locations and explain patterns responsibly.
- Identify the user, need, criteria, and constraints.
- Draw a system map with input → code → output.
Build a first solution
- Choose basic, electronic, and fabricated materials based on the team's idea.
- Build with power disconnected whenever electronics are used.
- Complete an adult check, then troubleshoot one connection or physical feature at a time.
Create the behavior
- Create the first working control using sensor sampling, averaging, and display logic.
- Predict what one rule, connection, or code change will do before testing it.
- Make the system understandable with labels, diagrams, comments, or coding blocks.
Test and improve
- Use the same procedure each time: take readings for equal time intervals at three approved locations.
- Record at least three results.
- Change one code, circuit, or physical-design variable and retest.
Fabricate and present
- Design a 3d printing part that protects, mounts, or explains the electronics.
- Adult reviews and operates fabrication equipment where required.
- Connect the finished system and demonstrate how the evidence improved it.
Assessment
- Problem statement names a real user and measurable need.
- Circuit matches the team diagram and uses components safely.
- Program connects the intended input to the intended output.
- Test conditions remain consistent and include recorded evidence.
- Revision addresses a documented failure or user need.
Supports & extensions
- Use color-coded wires and a photograph of each breadboard step.
- Provide block coding or partially completed code with one change at a time.
- Assign roles: circuit builder, coder, tester, and recorder.
- Let students explain findings orally or with labeled diagrams.
- Extension: add a second sensor, output, data display, or operating mode.
Safety & responsible use
- Use only teacher-approved low-voltage classroom electronics; never connect projects to wall current.
- Disconnect power before changing wires or components.
- Use the correct resistor with every standard LED and stop immediately if a part becomes hot.
- An adult handles soldering, laser cutting, printer setup, blades, and final power approval.
- Keep liquids away from boards unless a sealed, teacher-approved sensor activity specifically requires them.
No-machine alternative
Build with cardboard, paper mechanisms, paper circuits, or a free on-screen simulator. Students may invent another safe way to model the same function, then compare ideas, test one variable, collect evidence, and revise.
Printable student design brief
The challenge
Create a working classroom air monitor for this need: Help a classroom compare environmental conditions in different locations and explain patterns responsibly.
Success criteria
- Displays stable, labeled readings
- Enclosure allows airflow while protecting parts
- Claims match what the selected sensor can actually measure
Constraints
- Not a medical or certified safety device
- Collects no personal data
- Uses the same sampling interval in every location


