DHT11: temperature and humidity
The DHT11 combines a humidity-sensitive element, a temperature-sensing element and a small internal controller. The humidity element changes its electrical characteristics as moisture in the surrounding air changes. The temperature element measures the local temperature. Internal electronics convert these measurements into a digital data frame.
The Arduino does not measure an analog voltage from the DHT11. Instead, a library handles the sensor's timed one-wire-style communication protocol and returns numerical readings. The DHT11 is typically specified for approximately 0–50 °C and 20–80% relative humidity, with modest accuracy (commonly around ±2 °C and ±5% RH; check the exact manufacturer's datasheet). It is best suited to demonstrations and general indication, not precision climate control.
Allow the sensor to acclimatize to its environment. Avoid placing it next to a regulator, motor, direct sunlight or warm Arduino components, because local heating can distort the reading. A bare four-pin DHT11 and a three-pin breakout may have different pin layouts, so follow the markings or datasheet for your exact part.
Rain plate and comparator
The common rain sensor has a plate with interleaved conductive tracks. When the plate is dry, the electrical resistance between tracks is relatively high. Water droplets create conductive paths between tracks, changing the resistance. A companion module often contains an LM393 comparator and a potentiometer. The comparator compares the sensor signal with an adjustable threshold and produces a digital output.
This project reads only the module's digital output (DO). The program interprets LOW as rain and HIGH as no rain. That polarity is common, but not universal: some modules or wiring arrangements may behave differently. Test by observing the DO pin or temporarily printing its state to the Serial Monitor. If your module reports the opposite state, reverse the two messages in the sketch.
Rain plates can corrode when left wet or powered continuously. Rinse residue when appropriate, dry the plate after tests, and consider powering the plate only during brief measurements in a more advanced design. Do not expose the Arduino, LCD or breadboard to rain.
I2C LCD: displaying the readings
A standard 16×2 LCD can be controlled using several parallel data and control wires. An I2C backpack adds an I/O expander so the Arduino can send display commands over two signal lines: SDA (data) and SCL (clock). On an Arduino Uno, SDA is A4 and SCL is A5; the dedicated SDA/SCL header pins, where present, are electrically connected to the same bus.
The address in the supplied sketch is 0x27. Some backpacks use 0x3F or another address. If the backlight turns on but no text appears, check the contrast potentiometer and confirm the I2C address with an I2C scanner sketch. The display library used in the code must match the installed library's API.
Arduino: controller and logic
The Arduino Uno is built around an ATmega328P microcontroller. A sketch configures input and output pins, reads digital data, calls sensor-library functions, and updates the display. In this project D2 is reserved for the DHT11 data line and D3 for the rain module's digital output. The I2C interface uses A4/A5 on the Uno.
The microcontroller operates at 5 V logic on a typical Uno. Share a common ground between all modules so that signal voltages have a common reference. Never connect a signal or supply pin simply because it physically fits: verify voltage requirements and pin labels first.