Lab set Program-9
Weather Station Readings Using Arduino (Tinkercad)
Objective
To develop a simple weather-station prototype using Arduino that measures temperature, humidity, and light intensity using simulated sensors in Tinkercad.
(DHT sensor is not available in Tinkercad, so we will use two potentiometers to simulate Temperature & Humidity and a photoresistor to simulate Light level.)
Learning Outcomes
By the end of this experiment, students will be able to:
-
Understand the concept of a basic weather-monitoring system.
-
Simulate unavailable sensors in Tinkercad using analog components.
-
Read multiple sensor inputs and process them in Arduino.
-
Display combined weather readings using the Serial Monitor.
-
Implement simple decision logic for weather classification.
Components (from Tinkercad Palette)
-
Arduino Uno
-
Potentiometer – 2 Nos. (as Temperature & Humidity sensors)
-
Photoresistor (LDR) (as Light sensor)
-
10kΩ resistor (for LDR voltage divider)
-
Breadboard
-
Jumper wires
Circuit Wiring (Exact)
1. Temperature Sensor (Potentiometer-1)
-
Outer pin → 5V
-
Other outer pin → GND
-
Middle pin → A0
2. Humidity Sensor (Potentiometer-2)
-
Outer pin → 5V
-
Other outer pin → GND
-
Middle pin → A1
3. Light Sensor (Photoresistor / LDR)
-
One leg → 5V
-
Other leg → A2 AND also to GND through 10kΩ resistor
(LDR + 10kΩ forms a voltage divider.)
Arduino Sketch
int tempPin = A0; // Temperature sensor (Potentiometer)
int humidPin = A1; // Humidity sensor (Potentiometer)
int lightPin = A2; // LDR sensor
float temperature = 0.0;
float humidity = 0.0;
int lightValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
// Read sensor values
int tempRaw = analogRead(tempPin);
int humidRaw = analogRead(humidPin);
lightValue = analogRead(lightPin);
// Map values to realistic ranges
temperature = map(tempRaw, 0, 1023, 10, 45); // Simulated °C
humidity = map(humidRaw, 0, 1023, 20, 90); // Simulated %
int lightPercent = map(lightValue, 0, 1023, 0, 100);
// Print weather information
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.print(" C | Humidity: ");
Serial.print(humidity);
Serial.print(" % | Light: ");
Serial.print(lightPercent);
Serial.println(" %");
delay(700);
}
How It Works
-
Potentiometer-1 simulates temperature. Turning it left/right changes the analog reading representing cool or hot conditions.
-
Potentiometer-2 simulates humidity.
-
LDR gives light levels—covering it reduces the reading, shining light increases it.
-
Arduino reads all three sensor values through A0, A1, A2.
-
Values are scaled to human-readable units:
-
Temperature (10–45°C)
-
Humidity (20–90%)
-
Light (0–100%)
-
-
The Serial Monitor displays live weather readings like a small weather station.
Common Mistakes & Quick Fixes
| Problem | Cause | Fix |
|---|---|---|
| Temperature or humidity always 0 | Middle pin of pot not on A0/A1 | Reconnect jumper properly |
| Light values not changing | Wrong LDR wiring | Ensure 10k resistor goes from A2 to GND |
| Readings jump too fast | Pot is loose | Turn slowly or adjust delay |
| No Serial Monitor output | Serial.begin missing | Confirm Serial.begin(9600) is in setup |
Viva / Check-Your-Understanding
-
Why did we use potentiometers instead of real sensors?
-
How does a voltage divider work for LDR?
-
What environmental factors can be measured in a weather station?
-
Give examples of real sensors used for temperature and humidity.
-
What is the purpose of converting analog readings into meaningful units?
Extensions (Mini-Tasks)
-
Display the readings on an LCD (16×2).
-
Add a buzzer to alert when temperature crosses 40°C.
-
Log weather data using Serial Plotter.
-
Publish readings to an IoT dashboard (Thingspeak or Blynk).
Lab Record (Suggested Headings)
-
Title
-
Objective
-
Components Used
-
Circuit Diagram (Tinkercad Screenshot)
-
Arduino Code
-
Output (Serial Monitor readings)
-
Explanation
-
Learning Outcomes
-
Viva Questions
-
Extensions
Comments
Post a Comment