How To Use A Geophone With Raspberry Pi and an ADC - Seismic and Footstep Detection

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey gang tim here at crow electronics and this is a geophone it's an ultra sensitive microphone for the ground capable of picking up light footsteps from many meters away they are utilized around the world mainly for studying earthquakes mapping subsurface geology and in early warning safety devices today we set one up with a raspberry pi single board computer and we're going to need an analog to digital converter to do it [Music] if you were to pull apart this sm-24 geophone you are going to see a spring-mounted coiled-up wire mass that is free to move up and down within the field of a case mounted permanent magnet the active element of this device is that hanging wire coil mass when the ground shakes let's say due to an earthquake the spring-mounted mass has an inertia and wants to remain still so as the earth moves up and down the magnet displaces freely around the spring-mounted wire mass this displacement creates a changing magnetic field which in turn produces measurable electrical voltages in the coiled wire as the voltages are the result of natural phenomenon it is a truly pure analog signal so we will need an analog to digital converter like this adafruit 16-bit ads-1115 this is going to be the translator between these two systems reading the data from the geophone and converting it into a format that the raspberry pi can then understand these chips operate at 3.3 volts and the sampling rate can be set anywhere to 8 to 860 samples per second to learn a whole bunch about analog and digital signals in the ecosystem of electronics hit up our guide of the same name down in the description on the table before me is everything you need to set up your raspberry pi to read data from an analog signal produced by a geophone sm24 naturally you're going to need a geophone sm24 and a raspberry pi we are using a raspberry pi 4 model b 2 gigabyte the adafruit ads1115 adc board is also going to be needed and you're going to need to solder a line of headers onto it as well you're also going to need some odds and ends like these three one kilo ohm resistors you're going to want some extra dupont jumper cables and a breadboard you will also need everything to run the raspberry pi as a desktop computer that means you're going to need a microsd card flashed with the latest raspberry pi os and a micro hdmi to hdmi cord to connect the system to a monitor you're also going to want a raspberry pi power supply mouse and keyboard we will now build up the hardware start by plugging in all the connections to your raspberry pi 4 model b as you would a desktop computer check the description for a guide if you need a hand doing this don't plug in the power through usbc just yet now you're going to need to solder headers onto the ads1115 board and solder on some wire connections to the top of that geophone sm24 if you haven't done so already this geophone comes with a little pcb board on top which makes soldering to the top of it significantly easier now let's take a look at the schematic this is exactly what we're going to replicate here as you can see the raspberry pi is connected to the ads1105 board through the gpio pins there are four connections which i will plug in now the first is the red one to deliver 3.3 volts vdd that's voltage drain drain to the adc the black wire is to provide ground connection between both boards the last two are required for i squared c connection they are the serial clock named scl and the serial data named sda the orange wire is going to be the scl and connects like so the purple wire is the sda and connects this way the adc can be supplied voltage from the raspberry pi itself as i do here but it must be the 3.3 volt connection if you connect it up to the 5 volts from the raspberry pi it's going to brick the adafruit adc board now turning attention to the geophone side we will connect up its two outputs to a breadboard as i set up the resistors near the geophone sm24 i'll explain their purposes the one kilowatt resistor in the middle between here and here is a calibration resistor used in accordance with the data sheet this one kilo ohm resistor will flatten the response curve of the geophone these two other one kiloohm resistors leading towards the adc board are for current limiting in a situation where the output voltage from the geophone is significantly greater than the maximum input voltage of the adc these resistors are going to protect our system knowing this we'll now connect up the two resistor ends of the ao and a1 of the adc board with some jumper cables when everything has been connected up and your setup looks a lot like this you can then put power into your system with power to the system and the new first boot up wizard complete you're going to be welcomed by the raspberry pi desktop now this adafruit adc requires i squared c communication to work by default on raspberry pi os this communication method is turned off so the first step is to turn it on to do this we're going to open up the raspberry pi configuration menu found using the top left menu and scrolling over preferences and then we're going to enable the isquared connections found under the interfaces tab after enabling reset the raspberry pi to lock in the changes now with your system rebooted and connected to the internet open up a new terminal window by pressing the black button on the top left of the screen utilizing this terminal window will enable us to download from the internet the exact python packages that we require so type and enter the following lines into the terminal to get all the packages that you'll need you can also copy and paste them from the full written up article linked down in the description like i'm doing right here if ever prompted type and enter y to continue installations [Music] [Applause] so [Music] with that last line complete we have fully set up our raspberry pi single ball computer to work with the geophone sm 24 and the ads1115 board i have created some example codes that you can find and download at the bottom of the full written up article link to it in the description these files will be in a zip folder just extract the contents of it to wherever you would like the desktop is a perfectly good place to do so right click and open any of these files with funny ide to see how i wrote them funny ide is just a python interpreter software and you can use whichever software you would prefer let's start by opening up the differential graph display.py with it open let's press the green button as soon as you press it it's going to show the live output of the geophone plotted to a constantly updating graph when i lightly tap the corners of the table the geophone will register it and the graph will respond in turn very sweet this data is also recorded to the shell and it even picks up handwriting the y axis are the millivolts coming out of our geophone as determined by the adc board the readings constantly come in at around 20 each second taking a quick dive into the script the first two lines are the libraries needed to plot data after that it's time and the package needed to run the adc we then create an adc instance right here this points the system to the i squared c address that we have our adc attached to we then choose a gain for our system i utilize to gain a 16 the max that this adc board can do this way you can really see how sensitive the geophone is just as an example if you were to have this in the boot of your car picking up the vibrations as you drive along you may not need such an extreme sensitivity and a lower gain value would be better we will also use the voltage range that each gain level targets to adjust our graph scaling later in the script everything below this really has to do with creating the constantly updating graph except for this section down here this line here pulls data from the adc each loop the next lines convert this value to a millivolts value then we print them to the shell and the next line plots them on the graph the next script worth looking at is differential data collect gain dot py when you run this script the adc very quickly will sample the geophone a hundred times the raspberry pi will then capture those pieces of information and save them in a csv file named geophone underscore data dot csv if this file is not already created it's going to create it as you can see each new data point has been separated by a new line be aware that each time you run this script it's going to rewrite that csv file it will also tell you exactly how long it took to complete and print that time in seconds to the shell if you run it as is you're going to receive those 100 samples within around a second allow me to demonstrate and it only took 0.96 of a second to do so that is a lot of data points really quick since we're already in the script let's take a dive into it further initialization and data retrieval is the same as before here is the sample number variable which we will use in conjunction with the loop so we can get our 100 data points the next line lets the script create open and write the csv file we also have some extra variables just so we can keep track of how long it took to receive those 100 points of data then simply we jump into the for loop this line right here captures that value coming out of the adc then if we go down a little bit further this line right here is the one that writes those millivolts into our csv file if you wanted to record seismic data over an entire 24 hour period you can do so with this script you just need to make the following adjustment comment out this for loop here and then uncomment these and this this line will take the time it is currently and then only once 24 hours have passed will the script stop looping i'll start it running right now when you have sufficient data or you have something that you really want to graphically observe we can quickly take that csv file and plot it in excel finally i wanted to control a camera based on the vibrations around me the idea is that when i walk by the raspberry pi the geophone will pick it up and trigger a photo to be taken of me to do this i'm going to need to attach this camera to the csi port on the raspberry pi check the description for a guide all about setting up cameras if you need let's take a look at the script called footsteps camera geophone dot py it's going to look very similar to the previous ones except we're also importing the os functionality when you scroll down you can see that the while loop is going to continue forever then we gather the data in the same way as before inside this loop there is also an if statement inside this loop this is the threshold if the geophone picks up a millivolt data point larger or smaller than these two values here then the camera is going to be activated by this line this os dot system sudo lib camera dash still dash dash date time is just a way of taking a photograph this is the reason why we needed to import os at the beginning the camera is going to auto adjust and take a photograph of whatever happens to be in front of it then the system will revert back to vibration listening if this threshold is too sensitive for your application simply adjust these values here keep in mind that i'm making it hard for the geophone as it's on a hard wooden table and i'm walking around on carpet normally geophones are installed directly against hard ground so let's run and test it now we'll stop the script running and let's go take a look at that photo that it got at me you're going to find the photos in the same place as the scripts and the photos are going to be named with the current date and time so there's no concern of overwriting them i'm pretty sure this is the one that got me nice this opens up an interesting world of control where intelligent devices can be set up behind walls completely out of the line of sight say you are walking through your house at night your system could know exactly where you are and turn on your lights automatically illuminating the path as you go or you could utilize it as a secret method of tracking how many people are walking past a certain location hopefully this toolkit of knowledge on both adcs and geophones will serve you well if you have any questions write me a message down below we are full-time makers and we're here to help so with my geophone bouncing along just how it should until next time stay coz [Music]
Info
Channel: Core Electronics
Views: 23,178
Rating: undefined out of 5
Keywords: Gephone and Raspberry Pi set up, how to use raspberry pi to listen to Earthquakes, shakes, ADS1115 ADC, adafruit ADS1x15, matplotlib, analogue Signals into raspberry pi, measure seismic shakes, seismic refletion survey tools, tremours, raspberry pi single board computer, RASPI, RAS PI, RAS PI B 4 Geophone
Id: sbbQY-C3Nps
Channel Id: undefined
Length: 17min 0sec (1020 seconds)
Published: Mon Jul 04 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.