Cnipbotics
Home
CoursesPricingContact
All Projects
Beginner

Weather Station v1.0

Build a two-sensor weather station using an LM35 temperature sensor and an LDR light sensor, reading and printing live analog data to the Arduino Serial Monitor every second.

Arduino Uno R3, LM35 Temperature Sensor, LDR Photoresistor, 10kΩ Resistor, Breadboard, Jumper Wires
Weather Station v1.0

Weather Station v1.0

Learning Objectives

  • Read analog temperature data from an LM35 sensor and convert to Celsius
  • Measure ambient light level using an LDR (photoresistor) voltage divider
  • Display live readings via the Arduino Serial Monitor
  • Understand analog-to-digital conversion (ADC) fundamentals

Overview

Build a two-sensor weather station that measures temperature (LM35) and light intensity (LDR) and prints live data to the Arduino Serial Monitor. This is your first foray into analog sensing — converting real-world physical quantities into numbers a microcontroller can process.

Good to Know

The Arduino Uno's ADC has 10-bit resolution, meaning it maps 0–5 V into 0–1023 discrete integer values. A reading of 512 represents approximately 2.5 V. The conversion formula is: Voltage = (ADC_value / 1023.0) × 5.0


Components Required

ComponentQuantityNotes
Arduino Uno R31Any 5 V Arduino works
LM35 Temperature Sensor1TO-92 package, 10 mV/°C
LDR (Photoresistor)1GL5528 or equivalent
10 kΩ Resistor1Pull-down for LDR divider
Breadboard1Half-size
Jumper Wires8+Male-to-male

Circuit Setup

Step 1
Wire the LM35

The LM35 has three pins (flat side facing you, left to right): VCC – VOUT – GND

  • VCC → Arduino 5 V
  • VOUT → Arduino A0
  • GND → Arduino GND
ACTIVITY

Polarity Check

Before powering on, use a multimeter to verify ~5 V between VCC and GND of the LM35. A reverse-connected LM35 gets hot very quickly and will be damaged — check the flat side orientation carefully.

Step 2
Wire the LDR Voltage Divider

Form a voltage divider: 5 V → LDR → junction point → 10 kΩ → GND

Connect the junction point to A1. As light increases, LDR resistance drops, and the voltage at A1 rises.


Arduino Sketch

// Weather Station v1.0
 
const int TEMP_PIN = A0;
const int LDR_PIN  = A1;
 
void setup() {
  Serial.begin(9600);
  Serial.println("=== Weather Station v1.0 ===");
  Serial.println("Time(s)\tTemp(C)\tLight(%)");
}
 
void loop() {
  // --- Temperature ---
  int rawTemp = analogRead(TEMP_PIN);
  float voltage = (rawTemp / 1023.0) * 5.0;
  float tempC   = voltage * 100.0; // LM35: 10 mV per °C
 
  // --- Light ---
  int rawLight   = analogRead(LDR_PIN);
  int lightPct   = map(rawLight, 0, 1023, 0, 100);
 
  // --- Output ---
  Serial.print(millis() / 1000);
  Serial.print("\t");
  Serial.print(tempC, 1);
  Serial.print("\t");
  Serial.println(lightPct);
 
  delay(1000);
}

Good to Know

map(value, fromLow, fromHigh, toLow, toHigh) is a built-in Arduino function that linearly scales a value from one range to another. Here it converts 0–1023 ADC units into 0–100% for the light reading.


Reading the Data

Step 3
Open Serial Monitor
  1. Upload the sketch to Arduino Uno.
  2. Open Tools → Serial Monitor (or press Ctrl+Shift+M).
  3. Set baud rate to 9600.
  4. Readings print every second in tab-separated format.
ACTIVITY

Data Logger Experiment

Copy 30 rows of Serial Monitor output into a spreadsheet (Google Sheets or Excel). Plot temperature vs. time as a line graph. Cover the LDR with your palm and observe the light% column drop in real time. What happens to temperature if you hold the LM35 between your fingers?


Calibration

The LM35's datasheet accuracy is ±0.5 °C typically. To calibrate:

  1. Place the sensor in ice water (0 °C reference) — read the ADC value.
  2. Place in boiling water (100 °C reference) — read the ADC value.
  3. Use the two points to create a linear calibration formula: T = m × ADC + b
ACTIVITY

Two-Point Calibration

Perform the calibration above. Update the sketch to apply your m and b constants. Compare calibrated vs. uncalibrated readings against a reference thermometer.


Extension: Add an LCD Display

Bonus
Display Readings on 16×2 LCD

Replace Serial Monitor output with a 16×2 I²C LCD (address 0x27). Add the LiquidCrystal_I2C library and display temperature on row 1, light level on row 2. This makes the station truly standalone — no laptop needed.

Explore more projects

View All Projects
Stay updated

Subscribe to
our newsletter

Get the latest curriculum updates, project ideas, and school program announcements delivered to your inbox.

Ready to get started?

Bring structured robotics to your school

Schedule a DemoView Curriculum
200+
Schools nationwide
4.8★
Teacher satisfaction
4
Class levels covered
100%
NEP 2020 aligned
CnipboticsCnipbotics

India's structured robotics curriculum for CBSE schools — Class 7 to Class 10.

CurriculumClass 7 — DiscoveryClass 8 — ExplorationClass 9 — EngineeringClass 10 — InnovationCBSE Chapter Mapping
ProgramsBrowse CoursesPricing & KitsRequest a DemoAbout Us
CompanyAbout UsContactPricing
Get in touch

Questions about curriculum, pricing, or ATL lab setup?

Contact Us

School partnership

info@cnipbotics.com

© 2026 Cnipbotics. All rights reserved.

TermsPrivacyCookiesAccessibility