Low-cost seismograph using optical mouse

Hack an optical mouse to detect seismic vibrations with a simple laser source, a hacked mouse lens and a physical cantilever arm setup.

Public Chat
Similar projects worth following
The "seis-mouse-meter" (a name coined by our team) is an outcome of the 2020 Frugal Science course (, where we participants were challenged with solving crowd sourced global problems with frugal solutions. Our chosen problem was to detect and warn of crop raiding elephants in rural India, which cause much damage and human animal violent conflict inducing loss of lives on both sides.

Our simple hack was to use an ordinary computer optical mouse's inbuilt high speed camera and surface features detection hardware as a vibration detector. This could be used to sense the long distance (about 10km) seismic waves generated in the ground when these heavy animals walk or rumble or talk to each other.

Such a device could be part of a frugal and low cost early warning system in vulnerable villages, preventing potential conflicts and losses. It could also act as an environmental tool to monitor anthropologenic noise pollution in the infrasound range.

So its all about the optical mouse's superb built-in camera and the way it detects movements. You can see some detailed explanation in this article here. The built in camera takes about 3k+ images per second of a small region directly beneath the mouse. And then it subtracts each image from the previous to identify if the image has shifted due to a shift in the mouse's position. This shift is detected and that is what is reported to a computer.

If you have used a camera, how difficult is it to keep it steady when the object is too far? Similarly how difficult it is to keep steady if its a macro shot of small objects, right? When one goes towards higher and higher magnifications in a microscopy setup, you can see that its harder and harder to keep the image still, because of 2 reasons, A) Seismic vibrations are everywhere and B) The magnification also magnifies the vibrations on the formed image by the same amount. So a 1000x microscope will magnify a feeble ground vibration 1000 times in a formed image (interesting article here on this subject). Just the touch of your hand on the device can disturb the image. So while microscopes are rigidly constructed to prevent vibrations from causing a shift between the object and the imaging system, and labs invest tons of money to keep their microscopy apparatus on vibration free platforms, we on the contrary want to make a 'flimsy' microscopy platform which is very susceptible to vibrations. The image sensor is our optical mouse which tries to find if the image has moved and by how much, while the remaining part of the 'flimsy' microscope amplifies any vibrations on a non-rigidly coupled object plane.

A (long) video explanation of this trick (our innovative contribution to frugal seismography) can be found here:

We made many models and experiments before settling in on a design where the ease of making was an essential feature. This conscious decision is driven by the idea of frugal science where the components as well as the methods and skills needed to make something are carefully oriented towards simplicity. The first successful prototype we had built is explained in the video below.

In the first proto, the magnification was small and the construction was complicated. The lens used was from a 'Foldscope' microscope, the 1$ microscope developed and promoted by Stanford University's Manu Prakash. The design of the seismometer was of the Lehman type, or 'garden gate' type.

The second prototype modifies many aspects of the first, prominent being simplifying the construction of the system as well as lengthening the system to increase the magnification. Additionally, I removed the lens of the mouse itself and placed it as far as possible (limited by the illumination of the laser on the image chip). The focal length of that lens is about 1 mm or so. So keeping any brightly illuminated piece of plastic (with some surface features) right in front of the mouse lens at 1mm distance, will form an amazingly large image on the mouse sensor. If this plastic piece moves due to vibrations, then the image on the mouse moves.

Second prototype : 

In the above prototypes, the mouse connected directly to a computer. However for long term recording we need something which is not dependent on another costly computer. Hence, in this version the mouse was connected to an Arduino Uno and its USB shield, a SD card module to store the data, and an RTC module to know the precise UTC time during recording. The whole device is powered by a 5V wall plug connected to the Arduino's main power input jack. The data read can be stored on an SD card and analyzed later.

The code to run on the Arduino can be availed here. It is still a work in progress and many issues need to be addressed. 


While this project works, there is much stuff to do.

  • Try to update the device with a high DPI gaming mouse (see project logs for info).
  • Record lots of data and see if this device is actually...
Read more »

  • 1 × Optical LED mouse This is the main sensory device and it is the one that is hacked. Common mice are 1000 DPI, however upto 16000 DPI laser mice are available. I have had no success with laser mouse., hence LED mouse is recommended.
  • 1 × PVC pipe 3" dia, 1 m length This forms the external fixed pipe.
  • 1 × PCV pipe 1" dia, 1m in length This forms the cantilever internal pipe.
  • 1 × 3" to 1" PVC pipe reducer
  • 1 × 3" end cap

View all 13 components

  • Seis-mouse-meter V3.1

    Subir Bhaduri02/13/2022 at 07:24 0 comments

    Here is a new video of the modifications done by Mr Aniket Kandalkar to V3.

    The main mods are:

    • Base for holding all things together, including the yellow plywood, PVC pipe holders, leveling screws.
    • Electronics box, which includes the mouse circuit, the Arduino Uno, and PCB.
    • The PCB, hand soldered as of now, has some LEDs to indicate the activity of the device, useful especially when data is being logged but not plotted on the computer. (the mouse has a tendency to sleep off).

    The next idea will be to program the Arduino to log data onto an SD card every 10ms, for many days and then to eventually do some data analysis to see if we see a daily seismic trend.

  • Gaming mouse experiments

    Subir Bhaduri08/21/2021 at 06:12 0 comments

    The mouse used normally by us can detect about 1000 dots / inch of travel. A gaming mouse can detect 16000 dots / inch, a sensitivity 16x the normal. Why not use this instead of the regular mouse in our experiments? I did try and i wish it had succeeded. 

    Here is the test setup. A vice holds a steel scale on one end, the other end is free and responds to vibrations in the building or the table. This moving tip is positioned directly above a highly sensitive gaming mouse.

    While the mouse was connected to a laptop and was able to detect minute vibrations of people walking near it, it seemed it could be improved. The beauty is that such a setup is already quite sensitive even with such a simple setup. 

    The con is that when i tried to remove the mouse lens and try to show some red laser onto it to incorporate it into my 1 meter long PVC cantilever setup, it just didn't work. Direct show of laser onto the sensor makes the mouse 'move' on the screen. However, when the laser passes through the mouse lens kept some distance apart, and the speckle interference pattern is formed on the mouse sensor, it seems to not be affected by it. I think its to do with its very narrow optical properties. With its built in IR laser, the chip might also be using some algorithm to detect surface features change which i am not able to replicate when used in my setup.

    Incorporating such a nice mouse into the system could have been transformative for the project.

View all 2 project logs

Enjoy this project?



Peter Walsh wrote 08/17/2021 at 15:40 point

Oh, by all means use the mouse image comparison system - I was thinking more in terms of not needing the whole mouse, and using a consistent chip that you can order in bulk.

Some of the high-end gaming mice use chips that have insane resolution and speed - 9k dots per inch or so, and have updates of 1000 samples per second.

As an example, I have a library online that will interface to the ADNS9800 chips, which has a frame rate of 12000 frames/sec and has a built-in laser, and another driver that interfaces to the ADNS2600 series.

That chip's a little pricey, but the driver can be trivially tweaked to interface to just about any other mouse chip.

The mouse sensors with builtin lasers are what quadcopters use for position sensing, and you can get these separately. I found one on eBay got $10US that includes the laser and focusing optics. The lens focuses the laser at infinity, so if you were to use this part you wouldn't need your own laser. Just point the lens at the vibrating film.

I *believe* that chip has built-in motion sensing as a pin output, so you could put the arduino to sleep and have it wake up when motion is detected.

At any rate, your project looks really interesting and I just wanted to point out some options. I think the hard part will be the signal processing, but the hardware should be simpler.

  Are you sure? yes | no

Subir Bhaduri wrote 08/18/2021 at 10:50 point

Thanks Peter. You are correct, the inner settings of the chip could be tuned better for a job like this, probably. I also tried using a gaming mouse with 16k DPI, but it seems Arduino can't interface that mouse through the regular USB add on shield. When i tried to use this mouse with a regular laser and connected to a laptop (no Arduino), it didn't quite work well and i am not sure why. 16k DPI would have been 16x more powerful than the 1k DPI of the current mouse setup. Even if i could make the gaming mouse work for my device, i would still need a laser to illuminate the distant lens, the image from which must fall back onto the mouse sensor. This makes it difficult. I would love to interface the gaming mouse and make is sensible to the image patterns created by the scratched CD and laser.

  Are you sure? yes | no

Peter Walsh wrote 08/18/2021 at 14:50 point

I've been thinking about that.

Why not mount the gaming mouse (roughly speaking) where the dampening bolt is? The inner tube is free to move, and the tube end can serve as the surface the mouse scans. As the end moves, the mouse acts normally.

That way you don't need a laser, don't need special optics, and can use the gaming mouse. (And put the dampening magnet and bolt somewhere else.)

  Are you sure? yes | no

Subir Bhaduri wrote 08/21/2021 at 03:17 point

Peter, thanks for the ideas to incorporate the gaming mouse. I will add some of the experiments done in that direction in the description above (can't put in links / images here in the comments). I had done a similar experiment which you mentioned and it seemed the be the simplest thing one can do, and very sensitive too! The damping magnet can, as you said, be repositioned elsewhere. 

However, the LASER and long arm length is necessary for magnification. The current setup may roughly imply a magnification of 1000x (focal length of mouse lens is 1mm, but the image formed is at a distance of 1m = 1000x) whereas the gaming mouse can only offer say 16x. If we use only the gaming mouse, our overall sensitivity may not be sufficient. It would be great if i could combine the 2 parallel high sensitivity strategies (microscopy optics and the great detector of a gaming mouse).

  Are you sure? yes | no

Peter Walsh wrote 08/14/2021 at 15:56 point

I just saw your project on the HAD blog. This looks really good.

You can access the optical flow sensor in a mouse directly without having to use the USB interface. The SPI interface of the Arduino can read the sensor registers directly, you won't have to wait for the USB polling, and you might be get more resolution and have access to other chip features.

You can find chip datasheets online, which will tell you what features are available for the chip you have. Also, if you want to make many of these you can purchase the sensor chips without the mouse and have a consistent hardware.

I've got a note that shows how to do this. IM me if you want code for reading the chip.

  Are you sure? yes | no

Subir Bhaduri wrote 08/17/2021 at 10:21 point

Thanks Peter.
As of SPI access to the image the mouse is seeing, yes, i had seen some videos on youtube doing that, but i learnt that the rate of capture is very slow, about 2 frames/sec if i remember correctly. The inbuilt image comparison and difference and magnitude system (used by the mouse for all movement detection) seems to be the fastest (~3k frames/s?) , though it is indeterminate which is a problem i have to figure out by polling at fast enough at equidistant times so that output data will be cleaner. I initially tried capturing the timestamps along with X, Y of the mouse, but then the file becomes too big. While the frame capture rate is fast, the USB update rate of the X, Y coordinates is what seems to be the bottleneck. To record infrasound/seismic waves from 0-40 hz, i need a sampling of at least 80 hz (1/ 100 hz = 10 ms) and i struggle to get data at that rate with a regular mouse.  

Your note is interesting. Thanks for sharing.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates