What you will learn
  • Record measurements with timestamps and units.
  • Fit a short linear trend without claiming a reliable forecast.
  • Separate observed values from modeled values.
  • Treat sensor errors as unavailable data.

Before you begin

Use the calibrated TMP36 circuit and working sensor-reading bridge from AARD03.

A dashboard should answer a specific question

A display full of numbers is not automatically informative. For this project the question is: what is the temperature now, how has it changed during this short run, and when was it measured? A small regression model adds an estimated trend, but the measured data remain the primary evidence.

A dashboard can mislead while every line of code works. Displaying an old reading as if it were live, omitting units or showing many decimal places from an approximate sensor all create false confidence. We will label capture times, keep one decimal place and stop on measurement failure instead of quietly substituting zero.

The Arduino reads the sensor; the computer records data, fits a line and writes a local HTML report. The report is a snapshot, not a live website or a cloud service. That scope makes the first dashboard easy to inspect and avoids network setup while you learn the data flow.

TMP36 → Uno ADC → USB → timestamped CSV
                         → fitted trend → local HTML → reader

Reuse the measurement circuit, not its assumptions

Keep the AARD03 wiring: TMP36 supply5V, outputA1 and groundGND, plus a100nF bypass capacitor. Uno USB power, a data cable and the computer are the remaining parts. No motor or external actuator is used. READ returns three fields; only the temperature channel matters.

Use the measured supply reference in the conversion if available. A value called temperature_c should always contain Celsius, and one row should represent one successful observation. Choose a one-second interval for this exercise. Faster sampling cannot create independent thermal changes if the sensor and room vary slowly.

Install NumPy in your environment with python -m pip install numpy, and keep bridge.py beside the script. NumPy provides array-based numerical tools; polyfit calculates coefficients of a fitted polynomial. Degree1 is a straight line. This is a small regression model fitted from data, not a language model explaining your room.

Create a reproducible snapshot

The script takes30 readings, stores them in CSV and creates dashboard.html. The horizontal coordinate is elapsed time in seconds, and the fitted slope therefore has units°C/second. Multiply by60 only when labeling it°C/minute. A snapshot should say when the run ended.

Python
import csv, time
from datetime import datetime, timezone
from pathlib import Path
import numpy as np
from bridge import Bridge

rows = []
start = time.monotonic()
with Bridge('/dev/ttyACM0') as board:
    for _ in range(30):
        _, raw, _ = board.read()
        rows.append((time.monotonic() - start, (raw * 5.0 / 1023 - 0.5) * 100))
        time.sleep(1)
with open('readings.csv', 'w', newline='') as output:
    writer = csv.writer(output)
    writer.writerow(['elapsed_seconds', 'temperature_c'])
    writer.writerows(rows)
slope, intercept = np.polyfit(*zip(*rows), 1)
finished = datetime.now(timezone.utc).isoformat()
report = (f'<html lang=en><meta charset=utf-8><title>Temperature snapshot</title>'
          f'<h1>Temperature snapshot</h1><p>Run ended: {finished}</p>'
          f'<p>Latest measurement: {rows[-1][1]:.1f} °C</p>'
          f'<p>Fitted trend: {slope * 60:.2f} °C/min during this run.</p>'
          '<p>This is a saved snapshot, not a live monitor.</p></html>')
Path('dashboard.html').write_text(report, encoding='utf-8')

monotonic measures elapsed duration without depending on clock adjustments. UTC marks the run's end for the reader. CSV preserves the original numeric observations. polyfit estimates a slope and intercept; the dashboard labels only the slope during this observed period, avoiding an unsupported future prediction.

Expected result: After approximately30seconds plus communication overhead, readings.csv and dashboard.html appear. Open the HTML file in a browser. Values depend on the actual sensor; a stable room should usually produce a small fitted trend.

Check the model against the plot you could draw

Open the CSV in a spreadsheet and plot temperature against elapsed seconds. A nearly straight change supports a linear description over this interval; jumps and curves warn that one slope hides important behavior. A trend can be numerically fitted to any suitable points without being a useful explanation.

To forecast ahead, first define the horizon and test earlier runs by predicting later measurements you have withheld. Compare with ‘the next value equals the latest value.’ If the regression cannot beat that baseline, do not add a forecast badge merely to make the dashboard look intelligent.

If you later serve the report over a network, distinguish the data timestamp from page refresh time and show a stale state after missed updates. A browser reload does not mean the sensor was sampled. Keep credentials and private addresses out of downloaded reports.

Important terms

Timestamp
A recorded time associated with an observation or event.
Snapshot
A saved view of data at a particular time.
Regression
Estimating numeric relationships from examples.
Slope
The change in fitted output per unit of input.
Stale data
Measurements too old to represent the current state reliably.

Mini project: Inspect a trend rather than trust its label

  1. Collect a stable30-reading run with the sensor untouched.
  2. Plot the saved CSV and compare it with the fitted slope.
  3. Repeat a run after changing only the sensor's location.
  4. Write one reason why neither run proves what temperature will be tomorrow.

Common mistakes and debugging

  • Showing a saved report as live: label its capture period.
  • Reporting slope without units: seconds and minutes differ by a factor of60.
  • Replacing failed readings with zero: missing is not0°C.

Independent challenge

Add the minimum, maximum and number of successful measurements to the report, then explain why those summaries complement rather than replace a plot.

Check your understanding: 10 questions

  1. Which device fits the trend?

  2. What is the slope's initial unit?

  3. Does refreshing the HTML collect a new measurement?

  4. What baseline should a forecast beat?

  5. Why keep the CSV?

  6. In your own words, what does “Timestamp” mean?

  7. In your own words, what does “Snapshot” mean?

  8. In your own words, what does “Regression” mean?

  9. In your own words, what does “Slope” mean?

  10. In your own words, what does “Stale data” mean?

Quiz answers

Reveal all 10 answers after your attempt
  1. The computer running Python, not the Uno firmware.
  2. Degrees Celsius per second, because elapsed seconds are the input coordinate.
  3. No. The file is a saved snapshot.
  4. For example, predicting the next value equals the latest observed value.
  5. It preserves the actual measurements so the report and model can be inspected or reproduced.
  6. A recorded time associated with an observation or event.
  7. A saved view of data at a particular time.
  8. Estimating numeric relationships from examples.
  9. The change in fitted output per unit of input.
  10. Measurements too old to represent the current state reliably.

Summary

A trustworthy dashboard identifies what was measured, when it was measured and what a model merely estimated. Saving raw data and testing against simple baselines is more useful than decorating uncertain outputs with precise-looking numbers.

Continue learning

Use these explicit data and output boundaries when designing a small home-automation controller.

Choose a connected learning path

Sources and further reading

Prepared 2026-09-18. Editorial draft. Primary documentation checked; hardware, camera and audio behavior still require a physical test.

GO DEEPER

Extra reading & source documents

Optional reading alongside the lessons. These sources do not add to your course lesson count.

Explore the AI model guides →