Step 5: Programming - Arduino Side

The programming was probably the heftiest portion of this project, and hopefully my liberal amount of commenting will help make it clear how the program works.

First, a flowchart on how the program operates is shown in the first three pictures.

The program has been provided as well for download, just enter your own Pachube information and you are off to the races!

Libraries you may need:

#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <Ethernet.h>
#include <EthernetDHCP.h>

Google for any you are missing, they are generally the first result if you include "Arduino" in your search
<p>Hello,</p><p>What version of arduino ide you use to upload the sketch?i use the latest one and i cannot upload it.i got back lot of errors such as Client has rename it to EthernetClient and more.exit status 1</p>
<p>sir did you finish this already? we got the same problem</p>
<p>sir i when i download the ethernetdhcp.h i got the error #include &lt;wiring.h&gt; and then i change the ethernetdhcp.h to ethernetclient.h but i got the error Client -_- dont know what to do now -_-</p>
<p>anyone ready for my question herE? hahaha</p>
<p>This may be what I was looking for, but I may be in a little over my head-- I was hoping to make a system to see whether or not certain freight trains are shaking our office building more than others, so need it to be able to display seismic activity when a motion-activated camera records passing trains.</p>
<p>how can i write acode of this sensor on the Arduino c</p>
<p>Same question about Arduino Code.</p>
<p>Since you didn't supply the Piezo device, here it is:</p><p>http://meas-spec.com/product/t_product.aspx?id=2474</p>
<p>Exactly what I've been looking for, however, with more sensors you should be able to triangulate and work out the source of disturbances. I'm thinking this could be used for intruder detection if calibrated correctly? Perhaps you could have a map of your property that gets painted red wherever vibrations are detected.. Hmm..</p>
<p>Cool. Why did you not use the SW-180 vibration sensor? Or the ADXL335 Accelerometer? Thanks.</p>
<p>I saw this article too late. very cool &amp; smart system. </p><p>also, you're a good web designer. ;) very easy access to get info via HTTP Server.</p><p>Would you mind if I introduce this article to our collegue &amp; our online collection site?</p>
I'm not very familiar with the analog stuff, but would it be difficult to adjust the sensor to detect when someone, say, walks on a deck?<br><br>The walkway to my front door is a wood deck of 2x4s and I've been trying to think of a way to illuninate it as people walk across it.
not difficult at all<br>All you would have to do is remove some weight from the sensor and change the caps in the charge amp section to lower values to amplify higher frequencies
<p>can this project use to detect vibration on turbine enjine?</p>
Thanks. And good job!
<p>hi,</p><p>I would like to know how sensitive is your sensor and if it will be able to detect vibrations as low as 2 on the richter scale?</p>
Hi, <br>I would like to ask you where did you buy the Piezoelectric Sensor? <br>Thank you.
Any online electronics retailer will carry them, Digikey is popular in north america but I'm sure you can find something similar in every country
I bought the piezo-film sensor and now I am about to build the charging circuit you designed (Thanks!) which I will later connect to a PIC rather than an arduino. I tried simulating the exact diagram on Proteus first, but the output voltage from the final op-amp was at a constant 8.7V &quot;always&quot;, it didn't change ( :s inconsistent!) (in both AC and DC voltmeter) when biasing was done at 9V. <br> <br>I may need to connect the film and build the circuit to test it practically and check for consistent result. However, could you co-operate in answering a few queries? <br> <br>1. As my piezo will vibrate/bend, I am supposed to get a voltage output as seen in the datasheet (frequency vs open circuit voltage graph). When the signal is passed through the charging amp as you designed, I am supposed to get a stable, amplified voltage level variation right? (e.g. in arduino, sample value would be between 0 and 1023 for a range of vibration producing 0~5V). I am asking this because I am supposed to get no voltage when piezo doesn't vibrate, and say get a 2.5V when desired frequency oscillation occurs, right? Would I get such output from the circuit you have shown Sir?
The piezo-electric material changes in capacitance as it bends. The op amp circuit is there to take the capacitance <u>change</u>&nbsp;and turn it into a voltage. So for the simulation you would need to vary the capacitance while it simulates somehow.&nbsp;<br> <br> If you get your own op-amp chip, look up the data sheet and hook up the inverting/non-inverting up like it is in the schematic and ignore the pin numbers on the schematic<br> <br>
simulation successful!
Taufique_, could you please send to my email (cabral.emill@gmail.com) the simulation that you did? It's for educational purposes. Thanks!!
Cool stuff, can you provide a step by step instruction on building the circuit sensor and charge amp for a novice high school student with basic electronics knowledge? The link to the Texas group has been deactivated.
weird that they removed such a widely used document... <br>All you have to do is google &quot;single supply op amp design&quot; and you will find a lot of information on them and many examples you can work off of
Hi man. <br>where do you bought the sensos? <br>Thanks
You can try Digikey if you don't mind the shipping cost. Some electronics parts stores may carry piezo sensors, but the chances are slim, as they aren't a commonly bought sensor.
hi veedo, <br>I am making my own film sensor and want to use your circuit to check the output signal. and First i want to simulate in the Altium designer to determine the components' value. may i use a sinusoidal source to replace the LDT piezo film in the circuit
The circuit simply senses a change in capacitance of the sensor. You would have to make some sort of variable capacitor in the circuit simulator to test it. <br> <br>If you can't make a variable capacitor, you can use timed switches to put capacitors in parallel at different times during the simulation.
you are soo funny, what ever 'floats' your boat, haha brilliant. Im connecting my seismomiter to tweet everytime thers a quake.
The frequency of earthquake ground vibration is typically &lt;6Hz.<br> <br> A 30-80Hz detector might sense trucks rumbling by or heavy footsteps, but not earthquake ground vibration unless it's from furniture falling over.&nbsp;<br> <br> A great resource is <a href="http://psn.quake.net/" rel="nofollow">http://psn.quake.net/ </a>with many DIY seismometer designs.
well, it's all low pass at 50/60 Hz, so it will amplify any frequency above 1 Hz<br>Thanks for the resource though!<br><br>If you wanted to lower the resonant frequency of the sensor, it's as simple as adding more weight on the sensor.
Didn't you neglect to ground the bottom end of R2 / C3?
fixed! thanks for the catch
oh wow, sorry, there is supposed to be a ground symbol at the bottom
Interesting...<br><br>If I didn't want to shorten the sketch nor by an Arduino Mega, could I use an external EEPROM?
most definitely<br>There are also some efficiency improvements that can be made to save more space.<br>I was just not concerned with that since the MEGA has so much space on it<br><br>A good example:<br>I use a float to compare a previous measurement with the next measurement<br>A more efficient way would be to just use the A/D converter's integer value for both, and then convert it to voltage/float right before sending it to pachube.
Ahhh...I have been enlightened.

About This Instructable




More by veedo:Arduino Seismic Activity Monitor - Ethernet Shield Fun Sun-tracking Arduino 
Add instructable to: