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 Home Automation & Smart Devices

Bluetooth Smart Switch DIY: Android App with MIT App Inventor

Bluetooth Smart Switch DIY: Android App with MIT App Inventor

March 11, 2026 /Posted byJayesh Jain / 0

Build a Bluetooth smart switch with Arduino/ESP32 and control it via an Android app made with MIT App Inventor – no coding experience required for the app side. This complete DIY tutorial creates a wireless switch system for Indian homes that works without WiFi or internet, using classic Bluetooth (HC-05) or BLE (HM-10), making it ideal for rural areas or homes with unstable broadband.

Table of Contents

  • Why Bluetooth Smart Switches for India?
  • Hardware: HC-05 vs HM-10 vs ESP32 BLE
  • Circuit: Arduino, Relay, and Bluetooth Module
  • Arduino Firmware for Bluetooth Switch Control
  • Building the Android App with MIT App Inventor
  • Extending to Multi-Switch Control
  • India Use Cases and Room Configurations
  • Frequently Asked Questions

Why Bluetooth Smart Switches for India?

Bluetooth smart switches offer unique advantages for the Indian market:

  • No WiFi dependency: Works in areas with limited/no broadband (village homes, farmhouses, storage godowns)
  • No cloud subscription: Unlike Tuya/Alexa switches, there are zero monthly fees and no privacy concerns
  • Low cost: HC-05 Bluetooth module (Rs 120) + Arduino Nano (Rs 200) + relay (Rs 30) = Rs 350 total per switch point
  • No electrician for control: Add smart control without rewiring – the Bluetooth receiver fits inside a standard Indian gang box (60mm x 60mm modular)
  • Custom app: MIT App Inventor app shows your home layout with room-labelled buttons – more intuitive than generic commercial apps

Recommended: UNO WiFi R3 (ATmega328P + ESP8266)

The UNO WiFi R3 provides both Bluetooth control via its ESP8266 module and physical relay switching. For multi-room Bluetooth switch systems, each room gets one UNO WiFi R3 acting as a Bluetooth peripheral.

View Product →

Hardware: HC-05 vs HM-10 vs ESP32 BLE

Module Protocol India Price Range App support
HC-05 Bluetooth 2.0 Classic SPP Rs 120 10m MIT App Inventor (BluetoothClient)
HM-10 BLE 4.0 Rs 150 15m MIT App Inventor (BluetoothLE)
ESP32 built-in BLE 5.0 Rs 400 (full board) 30m MIT App Inventor (BluetoothLE)

For this tutorial we use HC-05 with MIT App Inventor’s BluetoothClient component (most widely documented approach) and an Arduino UNO/Nano as the controller.

Circuit: Arduino, Relay, and Bluetooth Module

HC-05 Bluetooth Module:
VCC  -> Arduino 5V
GND  -> Arduino GND
TXD  -> Arduino RX (pin 0) [or SoftwareSerial pin]
RXD  -> Arduino TX via 1kohm+2kohm voltage divider to 3.3V

Relay Module (5V coil, optocoupler isolated):
VCC  -> Arduino 5V
GND  -> Arduino GND
IN1  -> Arduino Digital Pin 8  (Light)
IN2  -> Arduino Digital Pin 9  (Fan)
IN3  -> Arduino Digital Pin 10 (Plug point)
IN4  -> Arduino Digital Pin 11 (Spare)

The voltage divider on HC-05 RXD is essential – HC-05 logic is 3.3V but Arduino TX outputs 5V. Connecting 5V directly to HC-05 RXD can permanently damage the module.

Arduino Firmware for Bluetooth Switch Control

#include <SoftwareSerial.h>

SoftwareSerial btSerial(2, 3);  // RX, TX (use pins 2,3 to keep pins 0,1 free for USB)

const int RELAY_PINS[] = {8, 9, 10, 11};
const int NUM_RELAYS = 4;
bool relayState[4] = {false, false, false, false};

void setup() {
  for (int i = 0; i < NUM_RELAYS; i++) {
    pinMode(RELAY_PINS[i], OUTPUT);
    digitalWrite(RELAY_PINS[i], HIGH);  // Active LOW: HIGH = OFF
  }
  btSerial.begin(9600);
  Serial.begin(9600);
}

void loop() {
  if (btSerial.available()) {
    char cmd = btSerial.read();
    // Commands: '1','2','3','4' = toggle; 'A','B','C','D' = ON; 'a','b','c','d' = OFF
    if (cmd >= '1' && cmd <= '4') {
      int idx = cmd - '1';
      relayState[idx] = !relayState[idx];
      digitalWrite(RELAY_PINS[idx], relayState[idx] ? LOW : HIGH);
      // Send status back
      btSerial.print("S");
      for (int i = 0; i < NUM_RELAYS; i++) btSerial.print(relayState[i] ? '1' : '0');
      btSerial.println();
    }
  }
}

Recommended: Mega WiFi R3 (ATmega2560 + ESP8266)

Scale up to whole-home Bluetooth control with the Mega WiFi R3. Its 54 digital I/O pins handle 16+ relay channels, and the built-in ESP8266 adds WiFi bridge capability when your router is available.

View Product →

Building the Android App with MIT App Inventor

Go to ai2.appinventor.mit.edu and sign in with a Google account. Create a new project:

Designer Screen Setup

  1. Add BluetoothClient component (non-visible, from Connectivity palette)
  2. Add a ListPicker button labelled “Connect to Bluetooth” – this will scan for paired devices
  3. Add 4 ToggleButton components labelled: Light, Fan, Plug Point, Spare
  4. Add a Label for connection status display
  5. Arrange in a vertical layout with your home name as the title

Blocks Editor Logic

// ListPicker.BeforePicking
set ListPicker.Elements to BluetoothClient.AddressesAndNames

// ListPicker.AfterPicking
if BluetoothClient.Connect(ListPicker.Selection)
  set StatusLabel.Text to "Connected"

// ToggleButton1.Click (Light)
if BluetoothClient.IsConnected
  BluetoothClient.SendText("1")  // Toggle command
  // Update button text based on state received

Build the APK (Build > Android App APK) and install on your Android phone. Enable Bluetooth, pair the HC-05 (default PIN: 1234 or 0000), and connect. Each button toggle sends a character command and receives the current relay states back.

Extending to Multi-Switch Control

For whole-home control from one app, pair multiple HC-05 modules to one phone simultaneously:

  • Name each HC-05 uniquely via AT commands: AT+NAME=BEDROOM, AT+NAME=KITCHEN
  • In MIT App Inventor, use multiple BluetoothClient components (one per room module)
  • Add a room selector (TabbedLayout or separate screens) in the app for intuitive navigation
  • Limit: Android can maintain ~7 simultaneous Bluetooth connections (more than enough for Indian homes)

India Use Cases and Room Configurations

Common 4-relay configurations for Indian rooms:

  • Living room: Main light, fan, TV plug point, decorative/diya lamp
  • Master bedroom: Main light, fan, AC control (via SSR), charging point indicator
  • Kitchen: Main light, exhaust fan, chimney, water purifier plug
  • Terrace/balcony: Security light, garden water pump, decorative string lights

Recommended: 12V 1-Channel Relay Module (RS485/Modbus)

This optocoupler-isolated relay module provides safe switching for your Bluetooth-controlled Indian home appliances. The RS485 interface also allows wired fallback control when Bluetooth range is exceeded.

View Product →

Frequently Asked Questions

Can I use MIT App Inventor for iOS (iPhone)?
MIT App Inventor only creates Android apps. For iOS, use the MIT App Inventor companion app for testing only – distributing to iPhone users requires Xcode. Alternatively, use Blynk (works on both Android and iOS) with HC-05 via a custom UART-to-WiFi bridge.
What is the maximum Bluetooth range in an Indian flat?
HC-05 Class 2 module: 10m in open air, approximately 5-7m through one Indian concrete wall. For 2BHK coverage, you need separate HC-05 modules per room cluster. HM-10 (BLE) and ESP32 BLE offer better range at 15-30m.
Will the relay switch be active during a phone reboot or disconnect?
Relay states are preserved via the Arduino’s current GPIO levels, not stored in EEPROM. On Arduino power cycle, all relays reset to the boot state (all OFF for active-LOW configuration). Add EEPROM state saving if persistence across power cuts is needed.
Can family members in the same house control switches from their own phones?
Classic Bluetooth (HC-05) supports only one master connection at a time. For multi-user access, use BLE (HM-10 or ESP32) which supports multiple concurrent connections, or switch to WiFi-based control with a shared MQTT broker.
Is the HC-05 module legal to use in India?
Yes. Bluetooth operates in the 2.4GHz ISM band which is license-exempt in India under WPC (Wireless Planning and Coordination Wing) regulations for low-power (up to 1W) devices. The HC-05 at 4dBm output power is well within limits.

Shop Home Automation at Zbotic →

Tags: Android App, Arduino, Bluetooth Smart Switch, DIY, HC-05, home automation, India, MIT App Inventor
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
BOM Management in KiCad and Ea...
blog bom management in kicad and easyeda export for jlcpcb 599484
blog best oled modules in india under 500 rupees 2026 rankings 599495
Best OLED Modules in India Und...

Related posts

Svg%3E
Read more

MQTT for Home Automation: ESP32 + Mosquitto + Home Assistant

April 1, 2026 0
MQTT is the backbone protocol of professional home automation systems. If you are building a smart home with multiple ESP32... Continue reading
Svg%3E
Read more

Curtain and Blind Automation: Stepper Motor Controller

April 1, 2026 0
Curtain automation is one of the most satisfying smart home upgrades you can build. Imagine your curtains opening automatically at... Continue reading
Svg%3E
Read more

Smart Doorbell with Camera: ESP32-CAM Video Intercom

April 1, 2026 0
A smart doorbell with a camera lets you see who is at your door from your phone, even when you... Continue reading
Svg%3E
Read more

Blynk IoT Platform: Control Arduino and ESP32 from Mobile

April 1, 2026 0
The Blynk IoT platform is the fastest way to control your Arduino and ESP32 projects from your mobile phone. Instead... Continue reading
Svg%3E
Read more

PIR Sensor Automatic Light: Save Electricity with Motion Detection

April 1, 2026 0
PIR sensor automatic lights are the simplest and most effective way to save electricity in Indian homes. By automatically turning... 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