Geophone to Picaxe

julianE

Senior Member
I would like to interface a geophone to the picaxe. I have tried using a single stage transistor amplifier feeding the ADC input of picaxe and it worked well enough, would sense a tap on the table reliably. I want to try using an OPAmp circuit and am asking for suggestions on how best to interface to picaxe. Attached is the circuit i built, sorry for the crude drawing,

geophone.jpg


So far I've attached the output to an oscilloscope, a 1980s tektronix without computer interface. The geophone is very sensitive and will detect footsteps on a concrete floor. I have it AC coupled and it shows volt or more peak to peak on the scope by just dropping a screwdriver nearby.

The geophone is a surplus unit and it looks like the sparkfun one,

http://www.sparkfun.com/products/11744


The signal from the op amp is pretty brief so I'm not sure what would be the best way to interface to the picaxe. I have the other half of the op amp available for a pulse stretcher circuit then I can just use a digital input of the picaxe or would it be better to make many ADC readings. Either way, I'm thinking I'll need to set the frequency of the picaxe as high as possible. I have an assortment of picaxe chips available, I can use whatever works best.

The other possibility, if picaxe isn't fast enough to capture the data I can use a raw pic chip as an intermediary.

I don't have a specific use planned just experimenting.

Thank you and a Happy New Year to all.
 

premelec

Senior Member
Be more specific on timing... just putting a diode from the OPamp to a capacitor will stretch any pulse... do you need more analog data from the geophone or mostly just pulse more or less than some value etc... ?
 

julianE

Senior Member
As far as timing, that's my main concern, I let my geophone with a transistor amplifier attached to an ADC pin of picaxe run for an extended time
and there was scantly any activity unless i was hitting the nearby area with my hand. My concern is that I'm missing pulses as the program loops and the time needed for A to D conversion. I'm thinking using an interrupt to catch the quick pulse might be the way to go. In order to use a pulse I need to shape the output so it's at logic levels, i'm very op amp inexperienced, can certainly use help. Should I follow the first stage with second stage set up as a comparator so I can get hard 0 and 1 levels?
I have a lot to learn as far as OP Amps.
 

julianE

Senior Member
What type of signal do you want to detect? An impact, vibration, earthquake, or ?
I originally bought the geophone to detect seismic activity, it was also a bargain. Upon further reading, a geophone is not ideal for seismic activity detection, oh well. Now, I'm just having fun with it and it's forcing me to learn op-amps and to use an oscilloscope that has gathered dust for ages.

I added another stage to the detector, a comparator. There is a multiturn trimmer that I used to adjust to the point when the output goes high and then I backed it off a little. Now, as I tap the area around the geophone the output goes between 1V and 4V.
Here is the schematic with additional components,

geophone2.jpg


Premelec, Thank you for the reading materials and I think I will use your idea of a simple pulse stretcher using a diode and a cap after the resistor and before the picaxe. Should I use a schottky diode? What value cap, .1uF sufficient or should I go higher?
 

Pongo

Senior Member
Yeah, I think there are a lot of disappointed geophone/seismic users out there :(

You could also try a peak detector to feed to the picaxe A/D. Setting the decay time to support the A/D sampling rate, or having the picaxe discharge the capacitor once the A/D has done completed its measurement.
 

AllyCat

Senior Member
Hi,

Your first Op-amp circuit was fine. It appears to have a gain of around 50 and a bandwidth (very approximately) from 10 Hz to 1 kHz. My immediate reaction was that the 10 Hz wasn't low enough for seismic measurements, but I see from the datasheet that it's also the lower frequency specified for the sensor itself. However, the data does show the response down to 1 Hz, so maybe what should be done is increase the gain of the amplifier below 10 Hz to compensate for the sensor's decline. That might be a better use of your second Op-Amp stage.

IMHO your "comparator" addition was a bad move. In particular, there is no bias applied to the + input, so it's behaviour is highly unpedictable. You were better connecting the first Op-Amp directly to a PICaxe pin, where you could read the voltage as either an analogue or a digital level (compared to a threshold voltage). Note that the "quiet" level from the Op-Amp will (should) read as a logic "1" level. True "seismic" signals would probably be best measured as an ADC input, but if you just want to catch a brief "noise" then a digital input to the SR flip-flop could be easiest.

I suspect that those "Geophones" are really intened to measure higher-frequency "seismic" activity, i.e. echoes from rock formations from man-made explosions (dynamite) which are often used for surveying on land and sea.

Cheers, Alan.
 

julianE

Senior Member
Allen, thanks for having a look. I thought my low frequency cutoff was 1/(6.28*3.3uF*10K), 4.8Hz. I went and ran the circuit in LTspice and you are correct it's 10Hz. If I make the cap 10uF cut off drops under 2Hz. Easy modification. The high end is around 400Hz so your estimate is very close.
Honestly, the second stage as a comparator was just a guess on my part. i could add a 100K feedback resistor to stabilize the comparator. I really must read up OP Amp theory.

The pulses coming from the geophone are very brief and my concern is that the picaxe will not catch them all hence the need for lengthening the pulse. In your opinion should I add a diode/cap circuit to lengthen the pulse or have you other ideas. I dislike doing analog circuits on the breadboard, I'm actually soldering on small circuit board.

I will add the picaxe soon to the circuit and perhaps it will work as is, easy to test just using one stage or both stages. Adding an SR flip flop might take me awhile, not sure I have any in stock.

Also, if there are better solutions I'm more then willing to start from scratch.
 

AllyCat

Senior Member
Hi,

If your amplifier (and the Geophone) are limiting the bandwidth to ~400 Hz, then that is within the capability of the PICaxe (perhaps running with a higher clock such as SETFREQ M32). Connecting a PICaxe, running a tight program loop and then sending data to the Editor's terminal using SERTXDs may give an idea what's possible.

IMHO you need to be clear about what your "pulse" represents. Your OpAmp is ac coupled and has a single supply rail so the normal output voltage should be half of the supply rail. A PICaxe READADC should see a value of about 128 (or READADC10 = 512) but a digital input will read as a "1" because its threshold voltage is around 1/4 of the supply rail. A classic "pulse" could either rise from the normal ("quiescent") level towards the supply rail or fall towards ground. For the rising pulse a digital input will see nothing (because it's already "1"), so there's no point in trying to stretch that! A negative-going pulse (if large enough) will cross the threshold and can be detected. After some time, either the pulse will "finish" or its effect will die away due to the ac coupling. It's unlikely to end very quickly because of the low-pass filtering action of the amplifier.

But an analogue input can give much more information. A change in value of (say) 10 could be more sensitive than having to reach the digital threshold, it can detect both polarities and the threshold can be made "adaptive". It might then record a sequence of values to analyse, or perhaps "play back" rather like a digital sampling oscilloscope.

However, your "pulse" is more likely to be a burst of low frequency oscillation, which will cycle above and below the normal bias level. That may cross the digital threshold (probably several times) to trigger an "event". But it really depends what you are trying to detect, and perhaps as importantly what you don't want to detect (battery voltage change, temperature, radio interference, etc.). If you're really interested in seismic type events then you should probably boost the amplifier response below 10 Hz.

Cheers, Alan.
 

manuka

Senior Member
JulianE: Where in the USA are you ? Best you clarify your "seismic events" - earthquakes ? Predicting, monitoring or alerting ? Are you familiar with P & S waves ?

Back in April 2011 I penned a "Silicon Chip" article pondering that VLF (Very Low Freq) EM monitoring may have merit for both seismic insights & perhaps as quake precursors. Significant work has since emerged - Google.

Here in our so called "Shaky Isles" we've had quite a quake swarm recently, with a Kaikoura's 7.8 causing major damage - most luckily in a remote area. A NZ wide Geonet system gives prompt insights.
Stan. in nEw ZeAlAnD
 

julianE

Senior Member
I'm in the middle west, not much seismic activity. Yes, I'm familiar with P&S waves. From all I read one needs a proper seismograph to detect distant earthquakes, there are plenty of examples on the web but I'm not willing to spend the money and haven't the mechanical skills to build one. I am enjoying interfacing a geophone to a picaxe as a learning experience, who knows, maybe it will be of use someday.

Back in April 2011 I penned a "Silicon Chip" article pondering that VLF (Very Low Freq) EM monitoring
I will try to find your article, sounds fascinating. I've read some research articles that meteor showers produce VLF as well.
 

julianE

Senior Member
I went and simplified the amplifier circuit and tuned some values. All works well and is very stable. It will reliably detect a pen hitting a concrete floor. I have another op amp stage available to make it more sensitive but for now it's fine. I'm just using READADC10 and getting values of about 530, running the 08M2 at 16 MHz. Alan was right the picaxe adc in a tight loop worked swell.

One thing that caused me a lot of head scratching is the input capacitor, the 4.7uF, I first used a plain aluminium electrolytic, one worked perfect on the breadboard but using a similar one in the proto board gave erratic values. I tried a bunch of electrolytic caps and they would either not work or be erratic, ADC values drifting to 800 while initially reading 500. Once I switched to a tantalum type the circuit became rock steady. Something to keep in mind.
Here is the final schematic,

geophone3.jpg


Thank you all.
 

Pongo

Senior Member
Sounds good!

It would be best to use a non-polarized capacitor for that input cap. 4.7uF is available in a film cap, or you could parallel up 1 uF's which might be easier to find from a non-professional source.
 

AllyCat

Senior Member
Hi,

the 4.7uF, I first used a plain aluminium electrolytic, one worked perfect on the breadboard but using a similar one in the proto board gave erratic values.
Assuming that you put the electrolytic capacitors in the correct way around ( ;) ) , electrolytics can become rather leaky if they spend a long time "on the shelf". But they may recover after some time with a bias applied; I would have expected that 100uF on the other input to cause at least as much of a problem.

You could get a much higher input impedance (and hence use a much smaller coupling capacitor) by driving the positive input. Simply connect the 4.7 uF to the junction of the two 220k resistors (without the 100 uF), and connect the 10k input to earth (0v).

The input impedance then becomes 110k (two 220ks in parallel), i.e. ten times greater, which would extend the lower bandwidth (but not boost it), or allow you to use a capacitor about 10 times smaller (e.g. 0.47uF unpolarised).

Alternatively, you could arrange the other half of the Op Amp as a unity gain buffer amplifier and/or to give a low-frequency boost, to compensate for the droop of the sensor at low frequencies.

Cheers, Alan.
 

julianE

Senior Member
Hi,



Assuming that you put the electrolytic capacitors in the correct way around ( ;) ) , electrolytics can become rather leaky if they spend a long time "on the shelf". But they may recover after some time with a bias applied; I would have expected that 100uF on the other input to cause at least as much of a problem.

You could get a much higher input impedance (and hence use a much smaller coupling capacitor) by driving the positive input. Simply connect the 4.7 uF to the junction of the two 220k resistors (without the 100 uF), and connect the 10k input to earth (0v).

The input impedance then becomes 110k (two 220ks in parallel), i.e. ten times greater, which would extend the lower bandwidth (but not boost it), or allow you to use a capacitor about 10 times smaller (e.g. 0.47uF unpolarised).

Alternatively, you could arrange the other half of the Op Amp as a unity gain buffer amplifier and/or to give a low-frequency boost, to compensate for the droop of the sensor at low frequencies.

Cheers, Alan.
Hi Alan,

Is this what you mean,

geophone4.JPG

LTSpice did not have TL062 Op Amp I'm using their closest equivalent.

When I run the simulation I get hardly any gain, I'm thinking there needs to be another resistor between the 4.7 uF cap and the 220K pair. I'll do some more reading.

I'm running the current iteration of the circuit and keeping track of how many events are captured. I might have to set up a raspberry PI to capture events for later graphing.

Thanks again for all the help. It's worth the effort to get a better understanding of the op amps, I have had ample theory of Op Amps back in my school days but real world experience is lacking.
 

AllyCat

Senior Member
Hi,

Sorry, I'd overlooked that it's a single rail design. If the Op-Amp will work with zero volts dc bias input (many will) then change the upper 220k resistor (R4) to 10M (yes Megohms) and reduce the other (R5) to 100k.

If the Op-amp won't work with zero input bias, then try replacing the 10k with a 22k + 22k divider chain across supply to ground (middle point to Op Amp input). But resistor tolerances (output bias level) may be an issue.

A single divider bias chain with suitable resistors to + and - inputs would be better. Perhaps a 10k + 10k chain on the negative input (with the feedback network unchanged) and 100k between the Op Amp inputs (and removing R4 and R5).

Cheers, Alan.
 
Last edited:

julianE

Senior Member
Thanks for all the insight Alan. I'm going to set up all sort of op amp circuits with a goal of having a universal module I can connect to various sensors in the future.
The other project I have slated is to cross reference LTspice simulator with real world readings. I'm very curious how accurate the simulation is, I'm sure it's all been done before but I'll chalk it up as a learning exercise. To that end, I'll order some of Linear op-amps so as to stay true to the simulation. I do realize I'm adding difficulty by using a low voltage single rail power supply, mainly for simplicity of attaching it to the picaxe.
 

BeanieBots

Moderator
My experience of LTspice is that it's really poor at simulating op-amps when what you are interested in is what happens when the op-amp saturates or gets close to supply rail. This is because those characteristics vary largely from device to device (of the same type) and a good design should never allow it to go there anyway.
No op-amp can ever truly get right close to the supply rails but even one that is 0.5v shy of 0v can be made to appear to get there.
This can be done by putting a diode in series with the op-amp output. Depending on what comes next, you might need to load the cathode end with a resistor.
What this does is cause the op-amp to conduct and have an output voltage of ~0.5v in order to maintain the virtual 0v. Obviously, this will only work if your overall circuit does in fact rely on having a virtual 0v. (your circuit does and also has sufficient loading so a simple diode right at the op-amp output should do it).
If your op-amp is very high gain and also high speed, the diode might cause oscillation. If that happens, a 1nF cap across the diode will fix it.
 

julianE

Senior Member
Thanks BeanieBots I'll make note of your suggestions. I have had very good results simulating transistor circuits using LTspice but I really need to learn op-amps. Most tutorials on the web are overly optimistic and much is ideal case. I keep running into real world differences. Last project I made was an active crossover for speakers. Looked great on paper but did not sound right, the passive crossover sounded better. I kept at it and it's better but still needs work.
 

BeanieBots

Moderator
The irony is that more often than not, if an op-amp is required, that elusive 20mV is usually significant.
My work around enables even sloppy op-amps to get right down to 0v.
It even works (in many circumstances) even with old favourites like the LM324 which can only get within a few volts of its power rails.
Using a zener and increasing the output load can also help the less than ideal op-amp pretend to be better than it really is.
All said and done though, you can never beat using the correct op-amp for the job with correct power rails. My proposal is more of a solution for the hobbiest working with limited resources.
 

julianE

Senior Member
All said and done though, you can never beat using the correct op-amp for the job with correct power rails.
Hello BB, do you think TL062 is the correct op amp for a job of driving a picaxe and using 5V single rail. I have a collection of op-amps including the LM324 which I see in a lot of designs but is frowned upon as old technology. here is the link to the TL062 datasheet,

http://www.ti.com/lit/ds/symlink/tl062.pdf

I let my geophone run for half a day and I noticed that the ADC output keeps creeping up to 700 levels, it starts at 500s. It's still very useful since all I'm checking is for change. I basically monitor the ADC output and compare with previous reading and if the difference is 6 more or less I print out the value, works very well, it detects footsteps perfectly. I can also alter the change value to make it more/less sensitive. I'm thinking the idle value drift is due to the large input capacitor, the 4.7uF. It could be the 100uF, I'll do some testing.
 
Top