SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By RMjimbob
#164391
I've been working on a way to triangulate a bullet impact on a steel plate using an arduino uno. The speed of sound in the steel will be a conservative 220,000 in/sec. I desire a resolution of 1 inch. To obtain this I figure the three digital inputs will need to sample at-least every 4.55 microseconds. I plan to use high/low vibration detecting switches (http://www.dfrobot.com/index.php?route= ... ltdmhB1n9o)

The idea is that with a solid connection to the plate a shock wave through the plate will trip these sensors and the event will be time stamped. This information will then be used for the triangulation calcs.

I plan on running a loop only to collect the three time stamps (should be faster to isolate this task right?). Once this is done the information will then be sent via Xbee to an arduino next to me where the actual triangulation calcs will be done by the second arduino.

My questions stem from a very basic understanding of these electronics and there capabilities.

As far a sampling rate will the arduino uno be able to meet this demand using the digital inputs?

With regards to the sensors I am using; Does anyone have any experience with digital (high/low) vibration sensors that may work better(if the ones I have are not good enough)? I started trying this with piezos and that proved to be tricky. I couldn't even get a clean knock sensor working.

Any other concerns about something I may be missing would be great information as well!

Thanks guys!
By kethy
#164394
As far a sampling rate will the arduino uno be able to meet this demand using the digital inputs?
I plan on running a loop only to collect the three time stamps (should be faster to isolate this task right?). Once this is done the information will then be sent via Xbee to an arduino next to me where the actual triangulation calcs will be done by the second arduino.
By jremington
#164401
I think those vibration sensors have a swinging wire inside, and they are probably way too slow for your application. Do you have a data sheet that gives their frequency response?

I've had no problem using piezo transducers for similar applications, using an edge detector rather than analog sampling (as most do).
By RMjimbob
#164405
Jremington:
I emailed the seller asking for the frequency response of the sensor and await their reply.

I'm not familiar with edge detection rather than analog sampling. My hopes was to apply a simple time stamp and be done with it, but the fast speed of the wave in the steel is proving to make it a bit more cumbersome.

I dropped the piezo approach because I couldn't get any repeatability out of the analog read to apply a basic knock sensor. This was done using the simple knock sensor code in the arduino tutorials using a piezo (SEN-10293) super glued to the steel. Also I have come to learn that the Uno's analog read is much slower than the digital and because all I need for a time stamp is a High/low I decided to take this approach.

With regards to sensors and controllers I am trying to keep it cheap by using an arduino uno and affordable sensors. I feel like this is something that an arduino can do with the right setup.
By waltr
#164406
To use the piezo follow it with an op-amp and a Voltage comparator. Or just a digital Schmidt trigger buffer/invert (74xx14) if the Voltage goes to a digital logic high value to shape the waveform into square digital edge. Then use the arduino digital input to detect and time the edge.
By jremington
#164408
google "piezo amplifier" for lots of circuits. Here is just one example I found. The output could be used to trigger an interrupt:
chargeamp.gif
You do not have the required permissions to view the files attached to this post.
By Mee_n_Mac
#164410
I would condition the piezo output as required and then use the digital inputs that have "Interrupt on Change" (IOC) capability. Setup the 16 bit timer/counter to run at 16 MHz and when each interrupt occurs read the count. When all 3 (or 4 as I've previously mentioned) interrupts have occurred you'll have your time differences.

http://playground.arduino.cc/Code/Interrupts

As for conditioning the piezos ... the simplest I've seen are on the drum kits that use piezos as hit detectors and the Arduino as a MIDI controller. I'm not sold that the simplest provide enough protection to the Arduino pin but ...

http://www.spikenzielabs.com/SpikenzieL ... itKit.html
By lyndon
#164468
I'd add a one-shot to the piezo conditioner output or an impact may trigger a single interrupt so many times you use up all your latency processing one piezo.
By fkatzenb
#164469
lyndon wrote:I'd add a one-shot to the piezo conditioner output or an impact may trigger a single interrupt so many times you use up all your latency processing one piezo.
Agreed. That diagram schematic I posted does just that. The ecu clears the knock sensor value out when ready
By Mee_n_Mac
#164491
Because you can't know if the initial *spike* out of the piezo will be a positive or negative voltage, and because timing is important, I propose that a window comparator w/a pulse stretcher is the optimal conditioning circuit. Bias the piezo at Vcc/2 and detect excursions beyond +/- Vcc/4 ... ???

Again keep in mind that for accuracy the absolute delay introduced by any circuit is not important, the relative delay (btw circuits) must be (nearly) equal.

Comments ... ??
By RMjimbob
#164652
I've been playing with the interrupts as Mee n Mac suggested. I have a code working to time stamp one sensor but I don't understand how to add another while keeping them on the same time for time stamp comparison purposes.

At the moment I am using the sensors I listed above while I try to figure out how to make the piezos work. Lots of info on the topic thanks guys. I have an op amp knock sensor working through analog but what I'm trying to nail down is a comparator set up.

A concern I have is that I am using an UNO and it only has 2 interrupts. This set up clearly isn't a true on/off. If i do get a comparator circuit working that would be a true on/off and then I could use any and all digital inputs to get the job done right?

Thanks for all the good info guys I'm learn much more than I expected to about this stuff. Great first real project I think!
By waltr
#164661
[quote[ I'm trying to nail down is a comparator set up.[/quote]
Did you try a Schmidt trigger buffer/invert (74xx14) ? This will work as a simple comparator at digital logic levels.
By Mee_n_Mac
#164687
The interested might want to read this PDF on the testing done to measure average Interrupt latency for various methods; pins 2/3 direct external, "pin change" Interrupts for various code versions. The end few (summary) pages are a must read. I'll reserve further comment except for 2 points;
- latency almost doesn't matter so long it's consistent, except that ...
- you need to find a way to detect and handle 2+ simultaneous interrupts (2 CCP units ?)

http://code.google.com/p/arduino-pincha ... st-2.0.pdf