Embedded thermostat controller implemented in C using Code Composer Studio and TI Drivers.
The system reads temperature data from an I2C temperature sensor, compares it to a user-adjustable setpoint, and controls a heating indicator while reporting system status over UART.
This project demonstrates core embedded systems concepts including interrupts, timers, I2C communication, GPIO handling, and periodic task scheduling.
- I2C temperature sensor communication
- Adjustable thermostat set-point using hardware buttons
- Periodic temperature sampling using hardware timers
- UART serial output for system monitoring
- GPIO interrupt-driven user input
- Basic thermostat control logic
- TI LaunchPad development board
- TMP temperature sensor (I2C)
- Onboard LED used as heater indicator
- Two push buttons used to adjust temperature set-point
The firmware performs the following tasks:
-
Initializes system peripherals
- UART
- I2C
- Timer
- GPIO
-
Detects the connected temperature sensor over I2C
-
Starts a 1-second periodic timer
-
Every timer cycle:
- Reads the temperature sensor
- Compares temperature to the set-point
- Activates the heater indicator LED if needed
- Outputs system status over UART
The system periodically prints status messages via UART in the following format:
<currentTemperature,setPoint,heatOn,seconds>
Example:
<21,22,1,0045>
Meaning:
| Field | Description |
|---|---|
| currentTemperature | Measured temperature (°C) |
| setPoint | Desired thermostat temperature |
| heatOn | Heater state (1 = ON, 0 = OFF) |
| seconds | System runtime counter |
Two push buttons adjust the thermostat set-point.
| Button | Function |
|---|---|
| Button 0 | Decrease temperature set-point |
| Button 1 | Increase temperature set-point |
Button presses trigger GPIO interrupts to modify the set-point.
The program uses a simple event-driven embedded architecture.
A hardware timer generates a periodic callback every second.
timerCallback()
This callback sets a flag used by the main control loop.
The main loop waits for the timer event and then executes the thermostat control logic.
while(1)
{
wait for timer flag
read temperature
compare to set-point
control heater LED
send status over UART
}
| Module | Purpose |
|---|---|
| GPIO | Button interrupts and LED control |
| I2C | Temperature sensor communication |
| UART | System monitoring output |
| Timer | Periodic scheduler |
Buttons → GPIO Interrupts
↓
Setpoint Control
Temperature Sensor → I2C → Thermostat Logic → Heater LED
Timer → Scheduler → Status Output → UART
- Interrupt-driven input handling
- Peripheral driver configuration
- I2C device communication
- Periodic scheduling using timers
- Embedded control logic
- UART debugging output
- Code Composer Studio
- TI Drivers
- NoRTOS
- Embedded C
Michael Berry
B.S. Computer Science – Software Engineering