Burglar detectors used to protect cars are similar
to this device.
Connecting the tremor detector to a computer.
Check out the computer engineering section of our projects page. It
is possible to connect this device to pins 1 and 3 of the joystick port and
use your computer to detect tremors. Connect the wire from the metal
weight to pin 1 (through a 1K resistor), connect the wire from the foil on
the funnel to pin 3.
The Qbasic code below creates a graphic display and a siren when a tremor
is detected.
For information about using Qbasic check our projects page
CLS
SCREEN 9
c = 1
DO
a = STICK(0)
PSET (c, a), 2
c = c + 1
IF a > 0 THEN LINE (c, 0)-(c,
a), 4
'IF a > 0 THEN LINE (c, 0)-(c
- 4, a), 4, BF
IF a > 0 THEN GOSUB 900
IF c > 639 THEN CLS
IF c > 639 THEN c = 1
LOOP WHILE INKEY$ = ""
'Sound command is created first and will be used with GOSUB
'for next statements are used with the sound command
900
FOR s% = 440 TO 1000 STEP 10
SOUND s%, s% / 1000
NEXT s%
FOR s% = 1000 TO 440 STEP -10
SOUND s%, s% / 1000
NEXT s%
RETURN
'RETURN will send it back to the line after gosub