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

Arduino Nano Bluetooth Child Safety Monitor with LCD and Buzzer Alert

View and Edit Project In Cirkit DesignerImage of Arduino Nano Bluetooth Child Safety Monitor with LCD and Buzzer Alert

Circuit Documentation

Summary

The circuit in question is designed to interface an Arduino Nano with an HC-05 Bluetooth Module, an I2C LCD screen (16x2), and a Buzzer. The Arduino Nano serves as the central processing unit, controlling the LCD display and the Buzzer based on the data received from the HC-05 Bluetooth Module. The LCD screen is used to display messages, while the Buzzer provides audible alerts. The HC-05 Bluetooth Module enables wireless communication with the Arduino Nano.

Component List

Arduino Nano

HC-05 Bluetooth Module

LCD Screen 16x2 I2C

Buzzer

Wiring Details

Arduino Nano

HC-05 Bluetooth Module

LCD Screen 16x2 I2C

Buzzer

Documented Code

Arduino Nano Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>

#define BT_NAME "BT_Slave"
SoftwareSerial mySerial(2, 3); // RX, TX

LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 columns and 2 rows
const int buzzer = 6;

unsigned long previousMillis = 0;
const long interval = 5000; // 5 seconds for connection timeout

void setup() {
  pinMode(buzzer, OUTPUT);
  lcd.init(); // Initialize the LCD I2C display
  lcd.backlight();
  lcd.setCursor(3, 0); // Move cursor to (3, 0)
  lcd.print("DIYables");
  lcd.setCursor(0, 1); // Move cursor to (0, 1)
  lcd.print("www.diyables.io");
  delay(2000); // Display the welcome message for 2 seconds

  Serial.begin(38400);
  mySerial.begin(38400);
  Serial.println("Arduino receiver");

  // Enter AT mode
  mySerial.print("AT\r\n");
  delay(200);
  mySerial.print("AT+RMAAD\r\n"); // Remove all paired devices
  delay(200);
  mySerial.print("AT+ADDR?\r\n"); // Get the address of the Slave
  delay(200);
  mySerial.print("AT+NAME=" + String(BT_NAME) + "\r\n"); // Set device name
  delay(200);
  mySerial.print("AT+PSWD=\"1234\"\r\n"); // Set password
  delay(200);
  mySerial.print("AT+ROLE?\r\n"); // Check role
  delay(200);
  mySerial.print("AT+UART=38400,0,0\r\n"); // Set UART baud rate
  delay(500);
}

void loop() {
  unsigned long currentMillis = millis();

  if (mySerial.available()) {
    String message = mySerial.readString();
    Serial.println("Received: " + message);

    // Display "CHILD SAFE" on the LCD and turn off the buzzer
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("CHILD SAFE");
    noTone(buzzer);

    // Reset the timer
    previousMillis = currentMillis;
  } else if (currentMillis - previousMillis >= interval) {
    // If no signal is received for 5 seconds, display "CHILD MISSING" and turn on the buzzer
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("CHILD MISSING");
    tone(buzzer, 1000); // Activate buzzer
  }
}

This code is responsible for initializing the LCD screen and the HC-05 Bluetooth Module, as well as handling the communication between the Arduino Nano and the Bluetooth module. It also controls the Buzzer and updates the LCD display based on the received Bluetooth messages.