In this tutorial, we will learn how to use the AETHDX Vibration Sensor.

Components Needed

  • AETHDX Vibration Sensor
  • LED light
  • Jumper cables
  • Arduino Uno board
  • Breadboard
  • USB Cable
  • A computer to run the program

What is the AETHDX Vibration Sensor and how does it work?

The AETHDX Vibration Sensor is a vibration/shake sensor that can detect vibrations. The sensor has a scale from 0 to 1024. If there are no vibrations detected by the sensor, the value of it will be 1023 or 1024. If however vibrations are descried, then the value of the sensor will be below 1023 or 1024. The stronger the vibration, the lower the value of the sensor will be.

In this project, we are going to be using the sensor and an LED light. We are going to make the LED turn on if there are vibrations detected. If there are no vibrations detected, the LED will remain off.

Pin Connections

  • One leg of the AETHDX Vibration sensor connects to the analog pin (A0)
  • The other leg of the AETHDX Vibration sensor connects to the 5V

The Circuit

The image depicted below shows the completed circuit of the AETHDX Vibration Sensor

The Code

Below, you will find the program for the AETHDX Vibration Sensor

/*

*/

int sensor;
int redLight = 2;

void setup() {
    
    Serial.begin(9600);
    pinMode(redLight, OUTPUT);
}

void loop() {
     sensor = analogRead(A0);
    
    if (sensor<1023) { 
      digitalWrite(redLight, HIGH);
      Serial.println("Vibration detected");
      delay(1000);
    } else {
      digitalWrite(redLight, LOW);
      Serial.println(sensor);
     delay(1000);
    }
}

In this code, we first started off by creating a variable called “sensor” for the AETHDX Vibration Sensor, and we created the variable redLight for the LED pin.

In the setup function, we begin serial communications and we setting pin number 2 for OUTPUT using the pinMode function.

Finally, in the loop function, we are creating an “if/else”, statement. If the vibration value is lower than 1023, the serial monitor will print “Vibration detected”, and will also turn on the LED light. Otherwise, the LED light will stay off and the serial monitor will print the sensor’s vibration value.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s