Labs / Sensors · Beginner · 25 min
Temperature sensor
Convert ADC counts to degrees.
Engineering instrumentation: This lab includes an instrument-style virtual test setup and parameter-driven waveform. For physical measurements, use the Practical Bench.
Parts
- LM35
- ESP32
- Jumper wires
Steps
- Connect LM35 pins to 3.3 V, GPIO 34 and GND.
- Read the ADC.
- Convert: T = mV / 10.
- Warm the sensor with your finger.
Safety: check polarity and power off before changing the circuit.
ESP32 code (Arduino IDE)
void setup(){ Serial.begin(115200); }
void loop(){ int raw=analogRead(34); float mV=raw*3300.0/4095;
Serial.println(mV/10); delay(500); }Viva questions
LM35 output?
10 mV per degree Celsius.
ADC resolution?
12 bit, so 0 to 4095.
Why noisy readings?
Average several samples and add a small capacitor.