If using solar power, connect the solar panel to a charge controller and use a voltage regulator (e.g., AMS1117 or 7805) to provide a stable 5V output for the Arduino and components.
For backup power, connect an AC-DC adapter (5V output) that automatically takes over when solar input is low or unavailable. Ensure proper power isolation if needed.
Ensure all components share a common ground with the Arduino. Here's how to wire each module:
Use a voltage divider with a 10kΩ resistor. Connect:
5V → LDR → JunctionJunction → 10kΩ Resistor → GNDJunction → D2 (LDR_PIN)
This setup lets D2 read LOW when dark and HIGH when bright.
LM35 VCC → 5VLM35 GND → GNDLM35 OUT → A3 (THERMISTOR_PIN)
LM35 outputs 10mV/°C. For example, 27°C = ~0.27V.
PIR VCC → 5VPIR GND → GNDPIR OUT → D4 (PIR_PIN)
Use “H” jumper mode on the PIR for continuous signal while motion persists.
Relay IN1 → D8 (LED_RELAY_PIN)Relay IN2 → D9 (FAN_RELAY_PIN)Relay IN3 → D10 (ALARM_RELAY_PIN)Relay VCC → 5V,GND → GND
Connect your high-voltage devices (e.g., bulb, fan, buzzer) to the NO (Normally Open) and COM terminals.
HC-05 TX → D6 (Arduino RX via SoftwareSerial)HC-05 RX → Voltage Divider → D7 (Arduino TX)VCC → 5V,GND → GND
Voltage Divider for HC-05 RX (to drop 5V TX signal to ~3.3V):
Arduino TX --- 1kΩ ---+--- 2kΩ --- GND
|
HC-05 RX
This prevents damage to the HC-05's 3.3V logic input pin.
| Component | Arduino Pin | Notes |
|---|---|---|
| LDR | D2 (Digital) | Use with voltage divider; LOW when dark |
| LM35 Temperature Sensor | A3 (Analog) | Middle pin to A3; VCC & GND to 5V/GND |
| PIR Motion Sensor | D4 (Digital) | OUT to D4; requires 5V and GND |
| Relay (LED) | D8 | IN pin of relay module |
| Relay (Fan) | D9 | IN pin of relay module |
| Relay (Alarm) | D10 | IN pin of relay module |
| Bluetooth HC-05 | D6 (RX), D7 (TX) | Use voltage divider on HC-05 RX |
Note: Connect all VCCs to 5V and all GNDs to common ground.