Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based Smart Home Automation System with Bluetooth Control

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Home Automation System with Bluetooth Control

Circuit Documentation

Summary

This circuit is designed to control various components based on sensor inputs using an Arduino UNO. The components include a photoresistor, servo motor, LED, RGB LED, buzzer, DHT22 sensor, MQ2 sensor, LCD display, and a Bluetooth module. The Arduino UNO reads sensor data and controls the output devices accordingly. The circuit also allows for Bluetooth control via a mobile application.

Component List

Arduino UNO

Resistor

Passive Buzzer

RGB LED Module

DHT22

Photoresistor (LDR) Sensor

LED: Two Pin (yellow)

Bluetooth Module HM-10

KY-012

MQ-2

Micro Servo 9G

LCD 20x4 I2C

Wiring Details

Arduino UNO

Resistor

Passive Buzzer

RGB LED Module

DHT22

Photoresistor (LDR) Sensor

LED: Two Pin (yellow)

Bluetooth Module HM-10

KY-012

MQ-2

Micro Servo 9G

LCD 20x4 I2C

Code Documentation

/*
 * This Arduino sketch controls various components based on sensor inputs.
 * - A photoresistor controls a servo motor and an LED.
 * - An RGB LED and buzzer are controlled by a DHT22 sensor and an MQ2 sensor.
 * - An LCD displays temperature and humidity levels.
 * - A Bluetooth module allows control via a mobile application.
 */

#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>

// Pin definitions
#define PHOTORESISTOR_SERVO A0
#define PHOTORESISTOR_LED A1
#define SERVO_PIN 6
#define LED_PIN 5
#define DHT_PIN 2
#define MQ2_PIN 3
#define BUZZER_PIN 4
#define RGB_RED_PIN 9
#define RGB_GREEN_PIN 10
#define RGB_BLUE_PIN 11
#define BLUETOOTH_RX 0
#define BLUETOOTH_TX 1

// Constants
#define DHT_TYPE DHT22
#define TEMP_THRESHOLD 25

// Objects
Servo myServo;
LiquidCrystal_I2C lcd(0x27, 20, 4);
DHT dht(DHT_PIN, DHT_TYPE);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  // Initialize components
  myServo.attach(SERVO_PIN);
  pinMode(LED_PIN, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(RGB_RED_PIN, OUTPUT);
  pinMode(RGB_GREEN_PIN, OUTPUT);
  pinMode(RGB_BLUE_PIN, OUTPUT);
  lcd.begin();
  lcd.backlight();
  dht.begin();
}

void loop() {
  // Read photoresistor values
  int lightLevelServo = analogRead(PHOTORESISTOR_SERVO);
  int lightLevelLED = analogRead(PHOTORESISTOR_LED);

  // Control servo based on light level
  if (lightLevelServo > 512) {
    myServo.write(180);
  } else {
    myServo.write(0);
  }

  // Control LED based on light level
  if (lightLevelLED > 512) {
    digitalWrite(LED_PIN, LOW);
  } else {
    digitalWrite(LED_PIN, HIGH);
  }

  // Read DHT22 sensor values