| Date | |
|---|---|
| 27 March 2026 | Assigned |
| 3 April 2026 | Due |
| Progress |
For this lab, you'll collaborate with a teammate to develop a thermometer using the on-board temperature sensor on the Raspberry Pi Pico. This project should use the LEDs to display the relative warmth (hot, warm, cold) the surrounding environment.
This assignment addresses the following course learning objective(s):
- Apply Python programming fundamentals to execute and explain computer code that implements interactive, novel solutions to a variety of computable problems.
- Implement code consistent with industry-standard practices using professional-grade integrated development environments (IDEs), command-line tools, and version control systems.
- Analyze and suggest revisions to existing Python language code to add functionality or repair defects.
- Evaluate the practical and ethical implications of writing computer code and discuss the contexts, perceived effects, and impacts exerted on and by computer code as a cultural force or artifact.
- Design, describe, and implement original projects incorporating industry-standard practices and Python language fundamentals.
Note
This is similar to the Stoplight lab, with the substitution of a blue LED.
The above graphic is a pinout diagram: a description of how to wire a physical computing project. Match the above diagram with the following components:
- push button
- Raspberry Pi Pico
2wires- breadboard
3resistors3LEDs
| Pins | Purpose |
|---|---|
15 |
Button |
16 |
Blue light† |
17 |
Yellow light† |
18 |
Red light† |
Important
The above writing is critical to the code. We address specific parts during our programs. Make sure it matches. If you have questions, ask a TL or the instructor!
†: indicates that a resistor must exist between the light and the pin.
Important
In order to run the program in this lab, you'll need to do the following when you've made the appropriate changes:
uv run mpremote cp src/Thermometer.py :
uv run mpremote cp src/Sensor.py :
As you will make changes in this file to create a functional Thermometer and Sensor, you'll need to do this each time the file changes!
Note
In order to test this lab, you may need to be a bit creative about temperature surrounding the device. However, keep in mind that you should not expose it to open flame or another very hot heatsource (i.e., put it directly in an oven or microwave).
As part of this lab, you'll need to figure out how to test this device!
The lab consists of three (3) parts:
- a
Sensorobject which captures the value of the Pico temperature sensor - a
Thermometerobject that determines relative warmth and displays results usingLEDs - a
main(driver) file that controls the interaction between theSensorandThermometer, while guiding the flow of the program
main operates a loop until the power_off button is pressed, at which time the apparatus turns off. On startup, the main should instruct the Thermometer to go through the reset cycle described below.
This object has one purpose: read the internal sensor. We set this sensor up using the following approach (the necessary imports are already in the file):
ADC(4)One might think that reading a temperature sensor results in a temperature. Here, that's not the case. The sensor reports a relative voltage which we need to calculate using the following formula:
This should result from a method of Sensor named read_sensor_voltage called in main.
Now that we have the reading of the voltage of the sensor, we convert to a Celsius temperature using the following conversion:
From there, we can calculate the temperature in Fahrenheit, which we'll use to determine relative warmth:
The functions that do this work should be named, respectively:
convert_temp_to_cconvert_temp_to_f
However, rather than return a value, each should set properties of the object called temp_in_c and temp_in_f. We'll use these to operate the LEDs.
LEDs should be controlled using the following functions and approach:
| Function | Description |
|---|---|
reset |
Turns all LEDs on for 1 second, then off |
lights_out |
Turns all LEDs off |
set_led_output |
Turns on the appropriate light for temperature conditions (see below) |
This table describes use of the LEDs:
LED |
Designation | Meaning |
|---|---|---|
Red |
Hot | Temperature greater than 70 degrees |
Yellow |
Warm | Temperature between 32 and 70 degrees |
Blue |
Cold | Temperature lower than 32 degrees |
The hardware (the Raspberry Pi Pico) relies on some fundamental structures:
PinsPin.INPin.OUT
sleep
Pins represent physical pins on the Raspberry Pi Pico device which can be either inputs or outputs. Our button is an input: Pin(16, Pin.IN); our LED is an on-board output: Pin("LED", Pin.OUT).
As a general rule, 0 indicates a press, and 1 indicates the button is not being pressed.
LEDs (lights) required Pin.OUT modes. For example, to program the RED light. To turn these on and off, use the on and off methods of the Pin.
# Turns light ON
self.lights[light].on()
# Turns light OFF
self.lights[light].off()Important
As a team assignment, this repository does not allow direct commits to main. Here you'll have to use branches and reviews to ensure that the project functions and is generally well understood by the team.
In practice, this means that everyone must branch their changes and that each Pull Request requires 2 reviews before it can be merged.
Note
To grade this lab, use the uv run gatorgrade command.
Labs in this course are each worth 5 points. You are awarded different levels of points using the following rubric:
| Component | Value |
|---|---|
| Programming | 2 |
| Code Review | 2 |
| Writing | 1 |
| Total | 5 |
Your programming will be evaluated on the following characteristics:
- Program reflects startup expectations in
main - Program reads correct temperature
- Program displays relative temperature correctly using
LEDs
The output for this program relies on external LEDs to validate outputs/outcomes.
Either a Technical Leader TL or the instructor can perform a code review with you. This must be done before the due date for the assignment. You may accomplish this during a lab session, TL office hours, or during the instructor's office hours. Successful completion of this review (and an accompanying successful outcome) will earn points toward the code review portion of the assignment.
Even though this assignment is collaborative, each student must complete the code review on their own.
Students are expected to finish a summary document. This is a Markdown file containing questions. All questions must be answered fully. Typically, this means a word count is assessed.
For this assignment, the minimum required word count is 150.
.png)