Digital Thermometer

This lab consists in building a Digital Thermometer using a microcontroller, a thermistor, LEDs, and a buzzer. The main loop monitors the thermistor through the ADC, switching more LEDs on as the temperature increases and activating the buzzer if a given threshold is passed.

Pseudo code

Let's begin with a pseudo code (actual coding is up to you):

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
int main() {
    while(1) {
        temp = adc->read();
        if(temp > 15%) {
            led1->on();
            if(temp > 30%) {
                led2->on();
                :
                :
                :
                if(temp > 90%) {
                    led7->on();
                    buzzer->on();
                } else
                    led7->off();
            } else
                led2->off();
        } else
            led1->off();
        delay();
    }
    return 0;
}

The pseudo-code is self-explaining: an infinite loop reading the ADC channel to which the thermistor has been connected and a composed conditional to switch on the LEDs and the buzzer through the respective GPIO ports. The delay at the end of the loop is a good practice in terms of energy, since a tight loop, checking the thermistor faster then it actually can vary would be useless. A well implemented delay could put the MCU in a low-power mode while keeping a timer counting.

Schematic

Part List

For this lab, you'll need the following components:

Assembly

Solutions

Tools