Vibration sensing.

I am a total Arduino neewb, however I have a project I want to make happen and seriously need the help of the forum to achieve it.

The scenario is: I believe the structure of my mother’s house is being damaged by the number of large lorries going through the village in which she lives. What I would like to do is locate several (maybe 4) accelerometers around the house and have them sampling low g vibrations at about 4 Hz. This information to be time-stamped and stored on an SD card to be downloaded to a laptop on a daily basis. The idea would be to display each axis data-stream relative to time in an application like Matlab. I have already installed CCTV and would check the recordings against the times when the accelerometer showed greatest movement to prove the vibration was coincident with passing lorries.

To achieve it I have the following hardware: an Arduino UNO, Ethernet shield with SD card, an MMA7361 accelerometer and a DS1307 RTC.

I can program up the UNO as a WebServer (I’m simply interested in 3 analogue values?) using the standard library and ping and browse to it with no problem.

How do I get the MMA7361 to sample at 4Hz?

How do I get the MMA7361 to write to the SD card.

How do I get the DS1307 to time-stamp the MMA7361 data.

I’m happy to research this and initially looking for pointers or links that will guide me in the right direction.

Thanks in advance. :slight_smile:

How do I get the MMA7361 to sample at 4Hz?

Only read it every 250mS

How do I get the MMA7361 to write to the SD card.

You don't. The Arduino reads the MMA7361 and then writes the numbers to the SD card. The SD library has examples of writing to a file.

How do I get the DS1307 to time-stamp the MMA7361 data.

You don't. Every time you read the MMA7361 and write it to the SD card you then read the DS1307 and write it to the SD card.

Vibration:
I was thinking: "Geophone". A geophone is in the ground, perhaps you can try that to see if it is different than the sensor in the house.
Also the PVDF sensors can be used: Piezo Vibration Sensor - Small Horizontal - SEN-09198 - SparkFun Electronics
The 4Hz seems low to me. Vibrations of trucks can be up to 40Hz or 100Hz perhaps.
The MMA7361 is an analog sensor. Any voltage noise in the 3.3V will show in the sampled data.
With 4 of them, you need 12 analog inputs. The Arduino has only 6.
Do you want to use wires to the sensors ? or wireless ?
Perhaps 4 sensors are not needed, start with one sensor connected in the center to the floor of the house.

Sampling with 4Hz is simple using millis().
See the 'blink without delay': http://arduino.cc/en/Tutorial/BlinkWithoutDelay
If you want to do precise frequency measurements, you can use a hardware timer and an interrupt. But that is not needed for your situation.

There are many software examples (also included in the Arduino IDE) and many tutorials to write to SD card. I would write it as a text file, for example in *.CSV format.

Uno:
A webserver and writing to SD card and handling sensor data... the Uno will run out of memory very quick. You might need a Mega 2560.

Grumpy_M, thanks for the input.

Caltoa,

The MMA will provide information about the movement of the walls in the three axes.

4Hz is the rate at which I want the Arduino to sample the MMA7361 and I think G_M has provided a clue.

My plan was to have 4 MMAs located in different parts of the house, each one with an UNO attached, and storing data on the SD card so each UNO would only have three analogue inputs.

Wireless isn't possible due to the thickness of the walls.

I would log into each UNO and download the data daily so was hoping that the UNO would be able to handle the sampling and writing to SD card and not run out of memory. However to be sure I might get the Mega just in case. Presumably the code would be similar?

4Hz is the rate at which I want the Arduino to sample the MMA7361

If you want sensible data on 4Hz signals, you need to sample at at least 8Hz.

So you want to have 4 Arduino Uno boards, each with its own ethernet shield and request the file via ethernet ?
That is possible, but data transfer is very slow. Maybe 4kbyte per second. It is easier to use 16GB SD cards and retrieve the data by pulling the SD cards out of them once a weeks.

Using both Ethernet library and the SD card library is possible with the Arduino Uno, but not a lot more. So if you don't want buzzers, displays, other sensors (with large libraries) or something like that, it should fit in a Uno board.

The code for the Mega is the same, but the SPI bus is on different pins. You might have to change one or two code lines.

Start by testing the sensor and storing data for just one Arduino board. I hope the vibrations will be large enough to distinguish it from the noise of the sensor.

If you want sensible data on 4Hz signals, you need to sample at at least 8Hz.