Build it step by step
0 of 6 doneBuild the three sensors
LDR divider on A0, pot on A1, TMP36 on A2.
Upload and open the plotter
Choose Tools, Serial Plotter and set 115200 baud.
Watch the three traces
Each appears in its own colour with its name.
Play
Turn the knob, cover the LDR with a hand and warm the TMP36 between your fingers.
Compare ranges
Light and knob run from 0 to 100, temperature from about 25 to 35.
Scale for clarity
Try dividing or offsetting values so they fit the same range.
How do you build a serial plotter sensor lab?
Plot an LDR, a pot and a temperature sensor live on the Arduino serial plotter. You need Arduino Uno R3, LDR Photoresistor, Potentiometer 10 kΩ, TMP36 temperature sensor, Resistor 10 kΩ, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data). It takes 6 steps and about 30 minutes.
- Level
- Beginner
- Time
- About 30 min
- Parts
- 8
Parts list
- Development BoardsBuyArduino Uno R3 × 1
- SensorsBuy
- PassivesBuy
- SensorsBuy
- PassivesBuyResistor 10 kΩ × 1
- PrototypingBuy
- PrototypingBuy
- Cables & WiresBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| LDR | Uno 5V and A0, with 10 kΩ from A0 to GND | Light divider, brighter reads higher |
| Pot outer pins | Uno 5V and GND | Reference |
| Pot middle pin | Uno A1 | Knob |
| TMP36 pin 1 (left, flat side to you) | Uno 5V | Supply |
| TMP36 pin 2 (middle) | Uno A2 | Output |
| TMP36 pin 3 (right) | Uno GND | Ground |
Code
Arduino IDE, board "Arduino Uno". No libraries. Open Tools, then Serial Plotter, and set the baud to 115200. Scaling Light and Knob to 0 to 100 puts them on the same range as the temperature in degrees.
Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
void setup() {
Serial.begin(115200);
}
void loop() {
int ldr = analogRead(A0);
int pot = analogRead(A1);
float mv = analogRead(A2) * 5000.0 / 1023.0;
float tempC = (mv - 500.0) / 10.0; // TMP36: 500 mV at 0 C, 10 mV per degree
// The plotter reads name:value pairs separated by commas, one line per sample
Serial.print("Light:"); Serial.print(ldr * 100.0 / 1023.0); Serial.print(','); // scaled to 0 to 100
Serial.print("Knob:"); Serial.print(pot * 100.0 / 1023.0); Serial.print(',');
Serial.print("TempC:"); Serial.println(tempC);
delay(50);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Uno with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Light:50.05,Knob:50.15,TempC:200.24 Light:50.05,Knob:50.05,TempC:200.24 Light:50.05,Knob:49.95,TempC:199.76 Light:50.05,Knob:49.95,TempC:200.24 Light:49.95,Knob:49.95,TempC:200.24 Light:50.05,Knob:49.95,TempC:200.24
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Turn the pot | Knob trace rises and falls with the position |
| Cover the LDR | Light trace drops |
| Hold the TMP36 | Temperature climbs by a few degrees |
| Room temperature | About 22 to 30 °C |
If it does not work
Temperature reads strange
TMP36 is wired backwards. Check which side the flat face is on.
Plotter shows one line
The output is not in name:value format or the line ends are missing.
Noisy traces
Add 100 nF across the sensor supply and keep wires short.
Nothing shown
Wrong baud rate on the plotter.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the serial plotter sensor lab?
Arduino Uno R3, LDR Photoresistor, Potentiometer 10 kΩ, TMP36 temperature sensor, Resistor 10 kΩ, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data).
How long does the serial plotter sensor lab take to build?
About 30 minutes for a beginner maker, in 6 steps.
How do I know the serial plotter sensor lab works?
Turn the pot: Knob trace rises and falls with the position. Cover the LDR: Light trace drops. Hold the TMP36: Temperature climbs by a few degrees.
Temperature reads strange: what should I check?
TMP36 is wired backwards. Check which side the flat face is on.
Plotter shows one line: what should I check?
The output is not in name:value format or the line ends are missing.
Noisy traces: what should I check?
Add 100 nF across the sensor supply and keep wires short.
Nothing shown: what should I check?
Wrong baud rate on the plotter.
