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

Arduino UNO Human Detection and Fan Control System with LD2410C Sensor and Relay

View and Edit Project In Cirkit DesignerImage of Arduino UNO Human Detection and Fan Control System with LD2410C Sensor and Relay

Circuit Documentation

Summary

This circuit is designed for human detection and fan control using an Arduino UNO, an LD2410C sensor, a 1 Channel Relay, and a fan. The LD2410C sensor detects human presence and sends a signal to the Arduino UNO, which then activates the relay to turn on the fan. The circuit is powered by an AC supply, which is converted to DC using an HLK-PM12 module.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. 1 Channel Relay 5V

    • Description: A relay module that allows control of high voltage devices with a low voltage signal.
    • Pins: VCC, GND, IN, NC, COM, NO
  3. HLK-PM12

    • Description: A power module that converts AC to DC.
    • Pins: +V0, -V0, AC
  4. LD2410C

    • Description: A sensor module for human presence detection.
    • Pins: RX, OUT, GND, VCC, TX
  5. Fan

    • Description: A fan that is controlled by the relay.
    • Pins: Neutral, Live
  6. AC Supply

    • Description: An AC power supply.
    • Pins: +ve, -ve

Wiring Details

Arduino UNO

1 Channel Relay 5V

HLK-PM12

LD2410C

Fan

AC Supply

Code Documentation

/*
 * Arduino Sketch for Human Detection and Fan Control
 *
 * This code interfaces with an LD2410C sensor to detect human presence. When
 * a human is detected, it activates a relay to turn on a fan. The relay is
 * connected to digital pin 8 of the Arduino UNO, and the LD2410C sensor is
 * connected to the Arduino's 3.3V, GND, RX (D1), and TX (D0) pins.
 */

#define RELAY_PIN 8

void setup() {
  // Initialize serial communication for LD2410C
  Serial.begin(9600);
  // Set relay pin as output
  pinMode(RELAY_PIN, OUTPUT);
  // Ensure the relay is off initially
  digitalWrite(RELAY_PIN, LOW);
}

void loop() {
  // Check if data is available from LD2410C
  if (Serial.available() > 0) {
    // Read the incoming byte
    char incomingByte = Serial.read();
    // Check if the incoming byte indicates human presence
    if (incomingByte == '1') { // Assuming '1' indicates presence
      digitalWrite(RELAY_PIN, HIGH); // Turn on the relay (and the fan)
    } else {
      digitalWrite(RELAY_PIN, LOW); // Turn off the relay (and the fan)
    }
  }
}

This code initializes the serial communication for the LD2410C sensor and sets the relay pin as an output. In the main loop, it checks for incoming data from the sensor. If the data indicates human presence (assumed to be '1'), it turns on the relay, thereby activating the fan. If no presence is detected, it turns off the relay, deactivating the fan.