Shop OBEX P1 Docs P2 Docs Learn Events
Quake Detector! — Parallax Forums

Quake Detector!

T ChapT Chap Posts: 4,223
edited 2006-09-11 14:37 in Propeller 1
I hacked up some Jon Wiliams Memsic 2125 code today to create an earthquake detector. Here in California, when a good sized quake hits, the first thing I do when I wake up and realize there is a quake, is head for the front door as fast as possible. There hasn't had a good one in many years, but the memories of the few bigs one I have experienced were pretty scary. I have developed a motorized door, and decided to have an optional switch to set it open up all doors on the network in the event of an earthquake. This way, you can just run like hell in your half asleep dazed and confused state should one occur really late.

The code below simply snaps a shot of the 2125 when powered up, and compares after that. My hope is that these things last for many years without wearing out or drifting. I was hoping someone might have experience with this unit to say where it would be stable at typical room temps for 10+ years without major drift. Since it would be hassle in most cases to reboot due to a misfire, would it make sense to always update the calibration to avoid drift? If so, at what frequency? Considering the Prop is doing other things that I don't want it interrupted by the 2125 code, I was hoping that there was an easy way to make it run on it's own cog since there are some left. Then, maybe have it calibrate and loop maybe a 1000 times, then recal again. Any thoughts?

Comments

  • parskoparsko Posts: 501
    edited 2006-09-11 07:04
    Originator,

    Wouldn't a quake measurement be relative? Aka not need calibration? For instance, one minute, your quake detector is sitting there in a box, on a table with some "G" value always being output the data pin. Your prop only needs to see a relative movement (from static) to notice something is happening, right? At which point, it might not even matter if the thing drifted 1 whole G in ten years, cause it's range is 2g, and would still show a relative movement.

    OR, I missed something in your post...

    BTW, I like the auto-doors-slamming-open idea for when a quake hits. The mental image I have of a million groggy individuals pinballing their way to the nears open door in their bra's and tighty-whiteys is crackin me up. I can also imagine the confusion when countless people get home the night of the Great Guinness Toast only to find that after slamming the door closed, only to have the same door open back up on them...

    -Parsko
  • T ChapT Chap Posts: 4,223
    edited 2006-09-11 08:51
    Parkso Relative to what? You still have to have a starting point to "relate" to, whether you refer to it as "static" or any other term. My question was very clearly, do you constantly update the calibration(static) point,which I have decided to do, or use a fixed point from boot up. I also said that the feature was an option that could be toggled on and off by the user at any time.

    Also, with all due respect, who said anything about slamming doors? As I posted, the doors are motorized, hence, no manual operation. My doors are sliding Starfire laminated glass pocket doors and operate by touching a panel on a wall. The doors are also networked to a main terminal and the vibration detection code will take into account more than one door prior to making decisions on opening the whole place up.
  • parskoparsko Posts: 501
    edited 2006-09-11 09:20
    Originator,

    Your starting point would be your first measurement. Each subsequent measurement after that would simply compare to the previous measurement, hence self calibrating. So, in theory, if mounted to a stable platform (for instance, http://www.starrett.com/pages/860_granite_surface_plates.cfm) you would retrieve some really stable values. If you compare the current value with the previous value, you would notice a change if there was a tremor. If the table were to slowly rotate (wrt the horizon), and I mean slowly, like a degree per week, then you would still maintain calibration. If there was a quick movement (door slamming or small tremor) the change would be quicker, like a 10 bit change, instead of a 1 bit change as a result of drift.

    I didn't gather you meant sliding doors. I also assumed the motorized door could be opened/closed manually, hence being able to slam it. Either you live in a very fancy Star Trek like world, or I am an *** and you have a handicap requiring the need for said doors. Either way, I'm jealous I don't have auto doors! It would be nice to not have to let the cats out every 5 minutes!!!

    -Parsko
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2006-09-11 14:37
    For a digital low pass filter, you could do something like this through each iteration.

    Note: For this to work, the G force (NewSample)·needs to be a positive value representing magnitude (ro)


    CON 
         SampleNumber = 10 'Theoretically your sample number can be very high. As long as the bit resolution
                           'of your SampleNumber added to the bit resolution of your NewSample does not exceed
                           '32-bits, the DataBase variable will be able to keep the correct value. 
    
    VAR 
         long DataBase, Average, NewSample 
    
    
    PUB TestLoop 
    
         Average := 0 
    
         repeat 
              ' Read 'NewSample Here 
    
              DataBase = DataBase - Average + NewSample 
              Average = DataBase / SampleNumber 
    
              'Compare NewSample against Average here if there is a large difference, then sound an alarm
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 9/11/2006 2:42:10 PM GMT
Sign In or Register to comment.