top of page
Writer's pictureSanskruti Ashtikar

Vibration Sensor System Using 8051 Microcontroller

Updated: 4 days ago

Introduction


Vibration sensors are used in various applications to detect and measure vibrations in machines, structures, and environments. In this project, we will design a vibration sensor system using the 8051 microcontroller. This system can be used to detect vibrations and trigger alarms or other responses based on the detected vibration levels.





Components Required


  • 8051 Microcontroller (e.g., AT89S52)

  • Vibration Sensor (e.g., SW-420 or any piezoelectric vibration sensor)

  • Operational Amplifier (Op-Amp, e.g., LM358)

  • Buzzer or LED (for alarm indication)

  • Resistors (10kΩ, 1kΩ, 330Ω)

  • Capacitors (33pF, 100μF)

  • Crystal Oscillator (11.0592 MHz)

  • Breadboard and Connecting Wires

  • Power Supply (5V for the 8051 and sensor)


Circuit Diagram


The vibration sensor is used to detect vibrations and produce an output signal. This signal is processed by an Op-Amp configured as a comparator. The 8051 microcontroller reads the output from the comparator and triggers a buzzer or LED to indicate the detection of vibrations.


+5V ----- +5V
          |
          |
      Vibration Sensor
        +---+
        |   |
        |   |
       10kΩ |
        |   |
        |   +---------- P1.0 (8051)
LM358 Op-Amp
    +Vcc to +5V
    GND to Ground
    Non-Inverting Input (+) to Voltage Divider (Sensor and 10kΩ resistor)
    Inverting Input (-) to Reference Voltage (set with a potentiometer)
    Output to P1.0 (8051)
Buzzer/LED
    Anode to P2.0 (8051) through 330Ω resistor
    Cathode to Ground

Pin Connections


  • Vibration Sensor:

  • One terminal to +5V

  • The other terminal to a voltage divider with a 10kΩ resistor and then to the non-inverting input of the Op-Amp.

  • The same point between the sensor and resistor to P1.0 of the 8051.

  • Op-Amp (LM358):

  • Non-inverting input (+) connected to the voltage divider (sensor and resistor).

  • Inverting input (-) connected to a reference voltage set using a potentiometer.

  • Output connected to P1.0 of the 8051.

  • Buzzer/LED:

  • Anode connected to P2.0 of the 8051 through a 330Ω resistor.

  • Cathode connected to Ground.





Software Implementation


The code is written in C using Keil uVision IDE. It involves reading the output from the vibration sensor, determining if a vibration is detected, and triggering the buzzer or LED accordingly.


#include <reg51.h>
sbit SENSOR_INPUT = P1^0; // Vibration sensor output
sbit ALARM = P2^0; // Buzzer or LED control pin
void delay(unsigned int count) {
    int i, j;
    for(i=0; i<count; i++)
        for(j=0; j<1275; j++);
}
void main() {
    while(1) {
        if (SENSOR_INPUT == 1) { // Vibration detected
            ALARM = 1; // Turn on the buzzer/LED
        } else { // No vibration detected
            ALARM = 0; // Turn off the buzzer/LED
        }
        
        delay(1000); // Check every second
    }
}




Explanation


  1. Initialization:

  2. No special initialization is required for this simple project. The main loop continuously monitors the vibration sensor's output.

  3. Reading Sensor Output:

  4. The vibration sensor output is read from P1.0. If it is high, this indicates that a vibration is detected (since the sensor produces a high voltage signal when vibrations are present).

  5. Controlling the Alarm:

  6. If the sensor output is high (indicating vibration), the buzzer or LED is turned on by setting P2.0 high.

  7. If the sensor output is low (indicating no vibration), the buzzer or LED is turned off by setting P2.0 low.

  8. Delay Function:

  9. The delay function is used to introduce a small delay between each check of the sensor's output.


Conclusion


This project demonstrates the use of the 8051 microcontroller to create a vibration sensor system. By integrating a vibration sensor and an Op-Amp comparator, the system can detect vibrations and trigger an alarm accordingly. This project is a great way to learn about sensor interfacing, signal processing, and using microcontrollers for monitoring and alarm systems.


Want us to guide you through your project or make the project for you ?






Create Various Projects

Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 



2 views0 comments

Related Posts

See All

Comments