Skip to content

LakinduBabySoap/Alarm_Time_-_Sensor_Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

Arduino Multi-Sensor Control System

This project is an Arduino-based multi-sensor control system that integrates a Light Dependent Resistor (LDR), ultrasonic distance sensor, buzzer, DC motor (via L293D driver), and a 16x2 LCD display. The system measures ambient light, distance to an object, and controls a motor and buzzer accordingly, displaying real-time data on the LCD.

Features

  • LDR Sensor: Measures ambient light and calculates the resistance of the photoresistor.
  • Ultrasonic Sensor: Measures the distance to an object in centimeters.
  • Buzzer: Emits a tone whose frequency is mapped to the light intensity.
  • DC Motor Control: Motor speed is adjusted based on the measured distance.
  • LCD Display: Shows resistance (with Ω symbol), buzzer frequency, distance, and motor speed (RPM).

Hardware Requirements

  • Arduino Uno (or compatible)
  • LDR (Light Dependent Resistor)
  • 10kΩ resistor (for LDR voltage divider)
  • Ultrasonic sensor (HC-SR04 or similar)
  • Buzzer
  • L293D Motor Driver IC
  • DC Motor
  • 16x2 LCD Display (compatible with LiquidCrystal library)
  • Jumper wires, breadboard, and power supply

Pin Connections

ComponentArduino Pin
LDR (Analog Out)A0
Buzzer8
Ultrasonic Trig6
Ultrasonic Echo7
Motor IN19
Motor IN210
Motor Enable13
LCD RS12
LCD E11
LCD D45
LCD D54
LCD D63
LCD D72

How It Works

  1. Initialization:
    The LCD displays "Initializing..." on startup.

  2. Sensor Readings:

    • The LDR value is read and converted to resistance.
    • The ultrasonic sensor measures distance to the nearest object.
  3. Output Control:

    • The buzzer emits a tone mapped to the light intensity.
    • The DC motor speed is mapped to the measured distance (closer object = slower speed).
  4. Display:
    The LCD shows:

    • Top row: LDR resistance (Ω), buzzer frequency (Hz)
    • Bottom row: Distance (cm), motor speed (RPM)

Example LCD Output

1000Ω=>1500HZ 20cm=>120RPM 

Code Overview

The main logic is implemented in [Arduino.ino]

  • Reads LDR and calculates resistance.
  • Reads distance from ultrasonic sensor.
  • Maps sensor values to buzzer frequency and motor speed.
  • Updates the LCD with real-time values.

Getting Started

  1. Wiring:
    Connect all components according to the pin mapping above.

  2. Upload Code:
    Open [Arduino.ino] in the Arduino IDE and upload it to your Arduino board.

  3. Power Up:
    Power the Arduino and observe the LCD and hardware responses.

TinkerCAD Simulation

You can view and simulate the circuit on TinkerCAD using the following link:
Open TinkerCAD Simulation

Assembly Code Projects

This repository also includes two 8051 assembly language programs that demonstrate microcontroller programming with the Atmel 8051 MCU:

Calculator (Calculator.asm)

An assembly implementation of a calculator that:

  • Performs arithmetic operations (multiplication and division)
  • Displays results on a 16x2 LCD display
  • Features:
    • Performs hex arithmetic operations on 8-bit values
    • Displays input values and results on an LCD
    • First line shows input values: "T:xxH U:xxH"
    • Second line shows calculation results: "T:xxxxxx Q:xxxx"
    • Includes comprehensive LCD control routines
    • Handles hexadecimal to ASCII conversion for display

Alarm Timer (Timer.asm)

A countdown timer with alarm functionality:

  • Uses Timer1 interrupts for accurate timing
  • Displays countdown on a 4-digit 7-segment display
  • Starts countdown from the value 9558
  • Activates a buzzer/alarm (on P1.5) when the countdown reaches 0508
  • Features:
    • Display multiplexing for the 7-segment displays
    • BCD countdown logic with carry handling
    • Customized delay routines for display stability
    • Interrupt-driven timing for accuracy

Both assembly programs demonstrate low-level hardware control, interrupt handling, and I/O operations on the Atmel 8051 microcontroller architecture.

Circuit Setup for Assembly Projects

For the 8051 assembly programs, you'll need:

  • Atmel 8051 microcontroller (AT89C51/52 or compatible)
  • For Calculator: 16x2 LCD display connected to Port 0 and Port 2
  • For Timer: 4-digit 7-segment display (common cathode) connected to Port 0 and Port 2
  • Buzzer connected to P1.5 (for the Timer program)
  • 11.0592 MHz crystal oscillator
  • 5V power supply
  • Associated passive components (resistors, capacitors)

Files

  • Arduino.ino: Main Arduino source code.
  • Calculator.asm: Assembly code for a calculator (unrelated to Arduino sketch).
  • Timer.asm: Assembly code for a timer (unrelated to Arduino sketch).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published