ESP32-VIBRATION SENSOR
Aim:
To extract information from vibration sensor.
Description:
To learn how to
read values from a vibration sensor connected to analog pin using ESP32-
Microcontroller.
Hardware required:
ESP32-Microcontroller Development board
Vibration sensor.
Pin connection:
VIBRATION SENSOR
|
ESP32
|
5V
|
5V
|
GND
|
GND
|
A/O
|
IO12
|
Procedure:
1.
The above pin connection shows how
to read values from a vibration sensor using ESP32 board.
2.
Do the connections as shown in the pin diagram and
pin mapping.
3.
Connect the USB cable to the board.
4.
Open Arduino IDE .Select DOIT ESP32 DEVKIT V1 in
boards and select COM port.
5.
Verify the program and upload it.
6.
Now you can see the output on the serial monitor.
Program:
void setup()
{
pinMode(35, INPUT);
Serial.begin(9600);
}
void loop()
{
int sensorvalue = analogRead(35);
if(sensorvalue>1000)
{
Serial.print("Sensor value is : ");
Serial.println(sensorvalue);
delay(2000);
delay(2000);
}
}