• Temperature Measurement Exercise | ACE-Lab

    Temperature Measurement

    This exercise shows how to acquire temperature measurements using a TMP36 analogue temperature sensor, convert the Arduino ADC reading into a voltage, remove the built-in offset, calculate temperature in degrees Celsius, and then improve signal quality with a discrete low-pass filter.

    1. Learning Outcomes

    After completing this exercise, learners should be able to acquire temperature measurements using an analogue temperature sensor, use a component datasheet to configure the measurement conversion correctly, and implement a low-pass filter to reduce measurement noise and improve signal quality.

    Acquire temperature from an analogue sensor

    Use the TMP36 and Arduino analogue input A4 to obtain a 10-bit ADC reading for temperature measurement.

    Implement calibration and filtering

    Convert ADC readings into degrees Celsius using the datasheet and improve signal quality with a discrete low-pass filter.

    2. Requirements

    The exercise has the following primary requirements:

    1

    Connect the TMP36 sensor correctly: terminal 1 to 5 V, terminal 2 to analogue input A4, and terminal 3 to GND.

    2

    Acquire the sensor output using the Arduino 10-bit ADC, 0 to 1023 range, with a defined sampling interval such as 0.01 seconds.

    3

    Convert the ADC reading into a temperature reading in degrees Celsius using the sensor datasheet and display the result using a Scope or Display block.

    4

    Implement a discrete low-pass filter to reduce measurement noise.

    3. Hardware Set-Up

    This exercise involves connecting a TMP36 temperature sensor to an Arduino Uno analogue input and calibrating the reading using the sensor datasheet so that temperature can be measured accurately.

    Required hardware:

    • Arduino Uno board (supported by Simulink)
    • USB cable Type A to B
    • Breadboard
    • Low voltage temperature sensor (TMP36)
    • 3 × male-to-male wires

    TMP36 specifications

    • Analogue temperature sensor
    • Input voltage range: 2.7 V to 5 V
    • Operating temperature range: −40 °C to +125 °C
    • Analogue output on terminal 2
    1

    Connect the analogue output of the TMP36, terminal 2, to analogue input A4 on the Arduino Uno.

    2

    Connect terminal 1 of the TMP36 to the 5 V supply pin on the Arduino Uno.

    3

    Connect terminal 3 of the TMP36, GND, to a GND pin on the Arduino Uno.

    Hardware set-up for the Temperature Measurement exercise
    Hardware set-up for temperature measurement using the TMP36 sensor and Arduino Uno.

    6. Additional Exercises

    After completing the main workflow, extend the exercise by changing the conditions and the output interpretation.

    Exercise 1: Warm the sensor slightly

    Use hand contact or a nearby warm object to observe the dynamic response of both the filtered and unfiltered temperature signals.

    Exercise 2: Add a temperature threshold

    Add simple logic so that an LED turns on if the measured temperature exceeds a chosen value such as 30 °C.

    Exercise 3: Convert to degrees Fahrenheit

    Modify the Simulink diagram so that the output is expressed in degrees Fahrenheit rather than degrees Celsius.

    7. Concluding Remarks

    This exercise demonstrates a complete measurement workflow: analogue sensing, ADC acquisition, voltage conversion, offset calibration, physical-unit conversion, filtering, and display.

    The introduction of a discrete low-pass filter highlights the importance of signal conditioning in practical embedded systems. Raw sensor signals often contain noise, and filtering improves measurement stability and usability for monitoring and control applications.