Single Transistor Earthquake Detector
Intro: Single Transistor Earthquake Detector
Hello, I present to you the construction of an earthquake detector with Arduino and piezo elements with a single transistor.I used an Arduino to have an analysis of the vibrations on the display. I chose to modify the project with the MPU6050 sensor because the values read differ from manufacturer to manufacturer and the code was not universally valid. This version is very sensitive. the sensitivity being given by the correct placement of the piezoelectric transducer.
- See also the other MPU6050 accelerometer project in my profile on Instructables.
STEP 1: Schematic Diagram
The electrical wiring diagram does not raise any particular problems. I tested the device on a test board, but the final construction will be made on a board with soldered connections. The two LEDs are optional, they may be missing. In this case, the 470 ohm resistor will also be missing.
The transistor used can be any NPN transistor, I used a BC547.
You can replace the regular semi-adjustable one with a multi-turn one. This potentiometer adjusts the size of the monitoring line on the display.
STEP 2: Mechanical Construction
The mechanical construction is an important step in making a quality detector. I attached a spring through to the back of the piezo element to increase its sensitivity, as you can see in the pictures. I tried the detector mounted on a breadboard, but for a precise detection the piezo element will be mounted separately from the electronic board and the acoustic element (speaker). I recovered the piezo element from a toy, you can find a piezo element in many objects or you can buy a new one, being very cheap.
STEP 3:
- The code is compiled in the Visuino program, but you can find in the attachment the code in IDE format and a link to the libraries used by the Visuino program.
- As soon as we open the code, we notice the Arduino board and the OLED display, the two components included in the code. A counter that counts from 1 to 128 with a speed dictated by the clock signal found in the "Up" pin of the counter. By changing the "Clock Generator" value, you can increase or decrease the speed of the line on the display. Basically, a line made up of several pixels moves from left to right from 0 to 128, which is the size of the display
- "Compare Integer value" has the value 1. When the counter counts and reaches the value 1, the comparison component changes its state from "false" to "true" generating an impulse on the "fill screen" input of the display, erasing everything on the display in that moment. Basically, the line resumes moving from 1 to 128 with a blank screen, erasing the last remaining graphic from the previous cycle of moving from 0 to 128.This is the horizontal display algorithm.
- On pin A0 of the Arduino, we find the signal from the collector of the transistor, a signal that is amplified from the piezo element. The signal is passed through an "Analog Map" component to limit the movement of the line on the display in the vertical plane within the limits of the display.
- The two "Compare analog value" components change their state from "false" to "true" when the value of the signal from the output of the "Map range" component reaches the values set in these two components (one for the minimum and one for the maximum) Output of the generator command comparators of pulses that will control the digital pins of the Arduino. Pins 4 and 6 for LEDs (visual signaling) and pin 7 (acoustic signaling) for the speaker.
- We choose the correct port and load the code into the Arduino
- *If you use the Arduino IDE, copy the "Mitov" folder to the folder where the Arduino libraries are.
- Find the file here: https://app.box.com/s/cryz1fytbi1wvan7bk2etxqojl4zkn3e
STEP 4: Start the Device
- As soon as we power up the device, a thicker or thinner stripe will appear on the display that moves from the left or right on the screen. We adjust from the 10k potentiometer until we get the thinnest value. By lightly hitting the support on which the piezo electric transducer is located on the screen, the line will move vertically more or less depending on the strength of the vibration felt by the sensor.
- If the vibration value exceeds the minimum or maximum value set in the two components of the "Compare analog value" code, the device enters the acoustic and visual alarm state for 5 seconds. When the vibrations stop, after 5 seconds the device returns to the standby state.
- If you liked my project, don't forget to give a like and a follow. Stay tuned, other interesting projects are coming. Thank you!