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

Arduino UNO-Based Smart Home Automation System with Bluetooth and Sensor Integration

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

Circuit Documentation

Summary

This circuit is designed to monitor environmental conditions and control various devices based on sensor inputs. It includes an Arduino UNO microcontroller, a DHT11 temperature and humidity sensor, an LDR module, a 12V single-channel relay, a DC motor, a servo motor, a 4x4 keypad, an ultrasonic sensor, a 16x2 I2C LCD, a Bluetooth HC-06 module, and a four-pin LED. The Arduino UNO reads data from the sensors and controls the relay, motor, servo, and LED based on the sensor inputs.

Component List

Arduino UNO

DC Motor

Module LDR

12V Single Channel Relay

Servo

DHT11

LED: Four Pin

Bluetooth HC-06

Resistor

Ultrasonic Sensor

4x4 Keypad (Simulator)

16x2 I2C LCD

Wiring Details

Arduino UNO

DC Motor

Module LDR

12V Single Channel Relay

Servo

DHT11

LED: Four Pin

Bluetooth HC-06

Resistor

Ultrasonic Sensor

4x4 Keypad (Simulator)

16x2 I2C LCD

Documented Code

#include <DHT.h>

// Định nghĩa chân cảm biến và thiết bị
#define PIRPIN 5         // Chân kết nối PIR
#define DHTPIN 12        // Chân dữ liệu DHT
#define DHTTYPE DHT11    // Loại cảm biến DHT11
#define relayPin 8       // Chân điều khiển relay (quạt)
const int ldrPin = A0;   // Chân kết nối LDR
const int redPin = 9;    // Chân LED đỏ
const int greenPin = 10; // Chân LED xanh lá
const int bluePin = 11;  // Chân LED xanh dương

DHT dht(DHTPIN, DHTTYPE);  // Khởi tạo đối tượng DHT
float temperatureThreshold = 30.0;  // Ngưỡng nhiệt độ

void setup() {
  // Cài đặt các chân
  pinMode(PIRPIN, INPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  
  Serial.begin(9600);  // Khởi động Serial Monitor
  dht.begin();         // Khởi tạo DHT
}

void loop() {
  // Kiểm tra PIR
  int pirState = digitalRead(PIRPIN);
  if (pirState == HIGH) {  // Phát hiện chuyển động
    Serial.println("Phát hiện người! Hoạt động các cảm biến.");

    // Hoạt