Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Raspberry Pi

Raspberry Pi Home Automation: Complete Guide

Raspberry Pi Home Automation: Complete Guide

March 11, 2026 /Posted byJayesh Jain / 0

Turning your home into a smart home does not have to cost a fortune or require a subscription to a cloud service. With raspberry pi home automation, you can build a fully local, private, and expandable smart home system for just a few thousand rupees. The Raspberry Pi runs Home Assistant — the world’s most popular open-source home automation platform — and can control lights, fans, appliances, monitor temperature and humidity, detect motion, and even accept voice commands. In this complete guide, we walk through everything from initial setup to advanced automations, tailored specifically for Indian homes.

Table of Contents

  • Why Raspberry Pi for Home Automation?
  • Hardware You Need
  • Installing Home Assistant
  • Connecting Relays to Control Lights and Fans
  • Temperature Monitoring with DHT11
  • Motion Detection with PIR Sensor
  • Voice Control Setup
  • Smartphone App Control
  • Safety Considerations for Indian Homes
  • Expanding Your System
  • FAQ

Why Raspberry Pi for Home Automation?

Most commercial smart home systems — Amazon Echo, Google Home, or Tuya-based devices — require an internet connection and send your data to overseas servers. If the company shuts down or changes its pricing, your devices may stop working. The Raspberry Pi approach is fundamentally different:

  • 100% local control: Everything runs on your LAN. No internet required for automations to work.
  • Privacy: Your home usage data never leaves your network.
  • No subscription fees: Pay once for hardware; run forever.
  • Infinite expandability: Add sensors, cameras, door locks, and more over time.
  • Indian power grid friendly: With the right relay board, you can control 230V AC devices safely.

A Raspberry Pi 4 (4GB or 8GB) is the recommended choice for a Home Assistant server since it handles multiple integrations, real-time processing, and the Home Assistant database comfortably. Pi 5 offers even better performance and faster storage with NVMe.

Hardware You Need

Here is what you need to build a complete Raspberry Pi home automation system:

  • Raspberry Pi 4B or Pi 5 (at least 4GB RAM recommended)
  • 32GB or 64GB microSD card (or NVMe SSD for Pi 5)
  • Official Raspberry Pi power supply
  • Relay module (4-channel or 8-channel, optoisolated)
  • DHT11 or DHT22 temperature and humidity sensor
  • PIR motion sensor (HC-SR501)
  • Jumper wires and a small project box or DIN rail enclosure
  • Ethernet cable (recommended over Wi-Fi for reliability)
🛍️ Recommended: DHT11 Digital Temperature and Humidity Sensor Module — Affordable, reliable sensor for monitoring room conditions. Ideal for air-conditioner automation and energy saving.
🛍️ Recommended: PIR Motion Detector Sensor HC-SR501 with Bracket — Detect movement for automated lighting, security alerts, and occupancy-based automations.

Installing Home Assistant

Home Assistant Operating System (HAOS) is the easiest installation method. It is a purpose-built Linux distribution that runs only Home Assistant — no need to configure anything else.

Step 1: Download the image

# Download Home Assistant OS for Raspberry Pi 4
wget https://github.com/home-assistant/operating-system/releases/latest/download/haos_rpi4-64-13.x.img.xz

# Or for Raspberry Pi 5
wget https://github.com/home-assistant/operating-system/releases/latest/download/haos_rpi5-64-13.x.img.xz

Step 2: Flash to microSD card

Use the Raspberry Pi Imager on your Windows/Mac/Linux computer. Select “Home Assistant OS” from the “Other specific-purpose OS” menu, select your microSD card, and click Write.

Step 3: First boot

Insert the microSD into your Pi, connect Ethernet, and power on. After 3–5 minutes, navigate to http://homeassistant.local:8123 from any browser on your network. The onboarding wizard will guide you through creating an account and discovering devices.

Step 4: Install HACS (optional but recommended)

# In Home Assistant terminal (Settings > System > Terminal)
wget -O - https://get.hacs.xyz | bash -

HACS (Home Assistant Community Store) gives you access to thousands of custom integrations and frontend cards not available in the default store.

Connecting Relays to Control Lights and Fans

This is where the real home automation power lies. A 4-channel relay module lets you control 4 separate 230V AC circuits (lights, fans, etc.) from Raspberry Pi GPIO pins.

Wiring (optoisolated relay module):

Relay VCC  →  Pi 5V (Pin 2)
Relay GND  →  Pi GND (Pin 6)
Relay IN1  →  Pi GPIO17 (Pin 11)  → Bedroom Light
Relay IN2  →  Pi GPIO27 (Pin 13)  → Living Room Fan
Relay IN3  →  Pi GPIO22 (Pin 15)  → Kitchen Light
Relay IN4  →  Pi GPIO23 (Pin 16)  → Bedroom Fan

Home Assistant configuration (configuration.yaml):

switch:
  - platform: rpi_gpio
    ports:
      17: Bedroom Light
      27: Living Room Fan
      22: Kitchen Light
      23: Bedroom Fan
    invert_logic: true  # Most relay modules are active-LOW

After adding this to your configuration.yaml and restarting Home Assistant, your lights and fans will appear as toggleable switches in the HA dashboard. You can now control them from the web UI, smartphone app, or automation rules.

🛍️ Recommended: Modbus RTU Relay Module with Optocoupler Isolation — RS485-based relay control for longer cable runs and industrial installations.

Temperature Monitoring with DHT11

The DHT11 sensor measures temperature (0–50°C, ±2°C accuracy) and humidity (20–90% RH, ±5% accuracy). It connects with just 3 wires: VCC (3.3V), GND, and a single data pin.

Wiring:

DHT11 VCC   →  Pi 3.3V (Pin 1)
DHT11 GND   →  Pi GND (Pin 9)
DHT11 DATA  →  Pi GPIO4 (Pin 7)
# Add a 10K pull-up resistor between VCC and DATA

Home Assistant configuration:

sensor:
  - platform: dht
    sensor: DHT11
    pin: 4
    monitored_conditions:
      - temperature
      - humidity
    name: Living Room
    scan_interval: 30

Once added, you can build automations like: “If temperature > 30°C AND time is between 10am–10pm, turn on the AC.” This simple automation can save significant electricity by not running the AC when it is not needed.

Motion Detection with PIR Sensor

The HC-SR501 PIR (Passive Infrared) sensor detects human body heat movement within a 3–7 metre range and up to a 110° angle. It has two onboard potentiometers to adjust sensitivity and detection delay time (0.3s to 5 minutes).

Wiring:

PIR VCC   →  Pi 5V (Pin 4)
PIR GND   →  Pi GND (Pin 14)
PIR OUT   →  Pi GPIO18 (Pin 12)

Home Assistant binary sensor:

binary_sensor:
  - platform: rpi_gpio
    ports:
      18: Living Room Motion
    bouncetime: 500
    invert_logic: false

Now create an automation in Home Assistant: when motion is detected after sunset, turn on the corridor light for 5 minutes. This is the kind of practical automation that makes a real difference in daily life.

Voice Control Setup

Home Assistant integrates with Google Assistant and Amazon Alexa through cloud-based bridges, or you can use a fully local option like Wyoming Protocol with Piper TTS and Whisper STT running directly on your Pi (Pi 4 with 4GB+ RAM handles this).

For Indian users, Google Assistant integration works well since it already understands Indian English accents and can be triggered from any Android phone, smart speaker, or Google Nest device on your network.

Setup: In Home Assistant, go to Settings → Integrations → Google Assistant, and follow the OAuth flow. Once connected, you can say “Hey Google, turn on the bedroom light” and it controls your relay via Home Assistant.

Smartphone App Control

The official Home Assistant Companion App is available for both Android and iOS. On your local Wi-Fi network, it connects directly to your Pi. From outside your home (4G/5G), you can access it via:

  • Nabu Casa (Home Assistant Cloud): ₹450/month, easiest setup, includes voice assistant features.
  • Tailscale VPN: Free for personal use. Install Tailscale on your Pi and phone for secure remote access without opening ports.
  • Cloudflare Tunnel: Free, no port forwarding needed, excellent for Indian ISPs that block inbound connections.

Safety Considerations for Indian Homes

Working with 230V AC mains is dangerous. Follow these safety rules:

  • Always use optoisolated relay modules that electrically separate the Pi’s low-voltage side from the mains side.
  • Use properly rated wiring: minimum 1.5mm² for lighting circuits, 2.5mm² for fans and appliances.
  • Install your relay module in a proper electrical enclosure — never leave mains connections exposed.
  • Include a MCB (Miniature Circuit Breaker) on each relay-controlled circuit for overload protection.
  • Test with low-voltage DC loads before connecting to mains.
  • If in doubt, hire a licensed electrician to make the final mains connections.

Expanding Your System

Home Assistant supports over 3,000 integrations. Once your basic relay and sensor setup is working, you can expand to:

  • Smart plugs (TP-Link Tapo, Wipro Smart Home) — monitor energy consumption per device
  • Door/window sensors — get alerts when the main door opens
  • IP cameras — integrate camera feeds directly into the HA dashboard
  • Smart air quality monitors — monitor PM2.5 levels (important in Indian cities)
  • Electricity meter integration — read your meter via RS485 Modbus and track usage
  • Zigbee hub (using a USB dongle) — add dozens of Zigbee devices on a single coordinator
🛍️ Recommended: Arducam 8MP IMX219 Camera for Raspberry Pi — Add an 8MP security camera to your Home Assistant setup for local video monitoring without cloud storage fees.

Frequently Asked Questions

Q: Does Raspberry Pi home automation work during a power cut?

Not by default. You can add a UPS (Uninterruptible Power Supply) for your Pi — several Pi HATs exist specifically for this purpose, or you can use a small 12V/24V battery backup with a DC-DC converter. Many Indian homes experience frequent power cuts, so a UPS for the Pi itself (not the relays) ensures Home Assistant keeps running and logs events.

Q: How many devices can one Raspberry Pi control?

A Pi 4 or Pi 5 running Home Assistant can comfortably manage hundreds of devices across multiple protocols (Wi-Fi, Zigbee, Z-Wave, MQTT, Modbus). The limitation is usually your network infrastructure, not the Pi itself.

Q: Can I use Wi-Fi relay modules instead of GPIO-connected relays?

Yes. Sonoff and Tapo smart switches are popular in India and integrate with Home Assistant via their respective integrations (or via Tasmota firmware flashed to Sonoff devices for local control). This avoids any wiring to the Pi’s GPIO entirely.

Q: Is this suitable for rented homes?

Partially. Sensors and cameras can be set up without any permanent wiring. For relay control of lights and fans, some modification to the electrical switchboard is needed, which may not be appropriate for rented homes. Smart plugs are a non-invasive alternative for appliances.

Shop Raspberry Pi at Zbotic.in

Find Raspberry Pi boards, HATs, displays, and accessories with fast delivery across India.

Browse Raspberry Pi →

Tags: DHT11 sensor, home assistant, PIR motion sensor, Raspberry Pi, raspberry pi home automation, relay control, smart home India
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
How to Build a Drone from Scra...
blog how to build a drone from scratch complete guide india 594439
blog drone transmitter receiver guide flysky vs radiolink 594443
Drone Transmitter & Receiv...

Related posts

Svg%3E
Read more

Raspberry Pi Benchmarks: Performance Testing All Models

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi PoE: Power Over Ethernet Setup Guide

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi GSM HAT: SMS and Cellular IoT

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi RS485: Industrial Sensor Network

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi CAN Bus: Vehicle OBD2 Data Reader

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now