Searching \ for '[PIC] A/D vs. Counting Pulses - Design Question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=a%2Fd
Search entire site for: 'A/D vs. Counting Pulses - Design Question'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] A/D vs. Counting Pulses - Design Question'
2002\09\27@073245 by Nate Duehr

face
flavicon
face
Hi all,

Working on getting my head "around" the PIC a bit here, and have a
generic design question that may or may not come off as really dumb.

Not an EE here, so take any incorrect terminology with a grain of salt.

I'm looking to take an audio input to a PIC, first bandpass filtering it
heavily so that only the 50-300 Hz range is left over after a filter
(call it an anti-aliasing filter if you like) and then present that to
the PIC to do a frequency count.  Could even just use a low-pass filter
if that seems appropriate that rolls off sharply at anywhere from 250 to
300 Hz.

After reading quite a bit of information on the PIC's with A/D
converters, it appears I'm at a decision cross-road, or maybe not... the
group's input is definitely welcome and appreciated here.

It appears I have two choices... After the filter I can either...

Amplify whatever's "left-over" after the filter and rail-to-rail (or
even clip) the output from 0v to 5v with another op-amp circuit if need
be and add clamping diodes (oh wait the PIC's inputs are clamped... just
gotta watch the current, right?), and just count the pulses and average,
etc... using an interrupt routine on a standard input pin.

Or...

Use less filter and attempt to use one of the PIC's with a built-in A/D
and do a bit more math than the above idea to count the frequency of the
signal.   This approach seems more difficult for someone newer to the
PIC... but I'm willing to try it.

The audio input characteristics will be that it will be from a fairly
low-impedance source, 10V peak-to-peak, maximum, but can be lower.  It
will have an overall audio frequency range of typical voice
communications of about 0-3000 Hz, and could include quite a bit of
noise/static mixed in with all the other audio component.

So I *think* there may be some left over junk that might come through
from time to time at the 50-300 Hz range.  The audio will not be present
at all times, and the PIC will have to "decide" when a constant low
frequency component is there and when it's not, and what frequency it
is.

I guess I'm wondering a few things, not being much of an electronics
designer here... but having read a whole lot of stuff recently to try to
get up-to-speed, including the various Microchip application notes on
A/D and various app notes from all over on op-amp active filter
design... since I'm assuming that a one-to-three pole RC filter will
both not be enough filtering to get the higher frequencies out of the
signal to prevent aliasing and sampling problems, as well as it will
have other problems like affecting phase and lowering the overall output
to the point where I'll need to amplify the signal again anyway to make
it useful again... (?)... the questions are:

- Are the two options above both viable?
- Am I missing something obvious while I'm building my assumptions that
will lead to this circuit design?  (GRIN)
- Is one or the other of these "better" in your opinion?
- Any major advantages/disadvantages to either?

Way out on a limb getting ready to take the plunge... (GRIN)...
--
Nate Duehr, spam_OUTnateTakeThisOuTspamnatetech.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2002\09\27@110249 by Chris Loiacono

flavicon
face
Assuming you want to measure the frequency, I would use this method, but I
like to take several samples, then implement a median filter in code to
reject any left-over junk. Then I would average the cleaned samples to get a
result.

> Amplify whatever's "left-over" after the filter and rail-to-rail (or
> even clip) the output from 0v to 5v with another op-amp
> circuit if need
> be and add clamping diodes and just count the pulses
> and average,
> etc... using an interrupt routine on a standard input pin.
>

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\09\27@115134 by mpoulton

flavicon
face
You may be better off using a comparator instead of A/D
converter.  If all you want is frequency counting, then you
don't need to know the analog value of the signal at lots of
points in time, you just need to know how often it passes a
certain value.  Using a PIC with an internal comparator and
voltage reference (like the 12F675), you can do just that.

---- Original message ----
>Date: Fri, 27 Sep 2002 05:16:49 -0600
>From: Nate Duehr <.....nateKILLspamspam.....NATETECH.COM>
>Subject: [PIC] A/D vs. Counting Pulses - Design Question
>To: EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU
>
>Hi all,
>
>Working on getting my head "around" the PIC a bit here, and
have a
>generic design question that may or may not come off as
really dumb.
>
>Not an EE here, so take any incorrect terminology with a
grain of salt.
>
>I'm looking to take an audio input to a PIC, first bandpass
filtering it
>heavily so that only the 50-300 Hz range is left over after
a filter
>(call it an anti-aliasing filter if you like) and then
present that to
>the PIC to do a frequency count.
<snip>
--
Mike P.
MTP Technologies
KC0LLX

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\09\27@171607 by Nate Duehr

face
flavicon
face
Thanks for the idea Mike... funny you should mention it, I was reading
through the datasheet for the 12F675 last night when I fell asleep
thinking the same thing... when you wake up and you've drooled on your
Microchip data sheets you know you're thinking about it too hard and
it's time to try a few designs and see what works.  (GRIN)

(Just kidding about the drool...)

And thanks Chris for verifying that at least one of the ideas was
something you would attempt also... heh heh... at least we'd make good
lemmings!   :-)

Nate

On Fri, 2002-09-27 at 09:49, Mike P. wrote:
> You may be better off using a comparator instead of A/D
> converter.  If all you want is frequency counting, then you
> don't need to know the analog value of the signal at lots of
> points in time, you just need to know how often it passes a
> certain value.  Using a PIC with an internal comparator and
> voltage reference (like the 12F675), you can do just that.

--
Nate Duehr, @spam@nateKILLspamspamnatetech.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\09\28@062615 by Russell McMahon

face
flavicon
face
> Amplify whatever's "left-over" after the filter and rail-to-rail (or
> even clip) the output from 0v to 5v with another op-amp circuit if need
> be and add clamping diodes (oh wait the PIC's inputs are clamped... just
> gotta watch the current, right?),

**** WRONG !!! ****

I'm afraid.
This starts a holy war every time it is raised and you can explore any
number of versions of this in the archives. So -

I'll just give you the absolute facts :-)
People will come along and say all sorts of contrary things but the
following is the good oil and if you depart from it you may verily have
sorrow:

- PIC clamp diodes are there to provide protection.
- PIC clamp diodes are not intended by the PIC designers to EVER conduct
during in-spec operation.
- The spec sheet doth verily give information about how much current said
clamp diodes will handle and about how high a pin may be taken outside the
supply rails but this data is in the section relating to absolute maximum
values and verily doth not relate to normal operation.
- Spec sheet also gives pin acceptable voltage range during normal opertaion
and this range is such that clamp diodes do not conduct.
- People with itching ears who want to save a cent or so and some PCB real
estate will read the former pin voltage ranges and apply them to the latter
situation and great shall be their sorrow sometimes.

- IF you allow the clamp diodes to conduct during normal operation the PIC
shall often behave still as intended. But sometimes it will be seen to
behave in most wierd and unpredictable ways. And, worst of all, it shall
sometimes APPEAR to be behaving normally but shall truly be behaving badly
and you may never know but your results may be trash and worth only
spreading on walkways in lieu of expended rock salt. Or worse.

- Problems that do occur when thou strayest from the true path in such
manner do not have to relate to the pin that offendeth or even to the
function of the processor related to the pin that offendeth.

- Even though the great Microchip their very selves doth on occasion allow
to be published official application notes containing circuits which allow
clamp diodes to conduct during normal operation such application notes must
not be taken as holy writ for in the day thou runnest after and emulatest
them thou shalt surely maybe die (or thy circuit or application in thy
lieu).

Here endeth the lesson.

Note well how many abominators shall cry out against it in their ignorance.

:-)


           RM

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2002\09\28@145955 by Alan B. Pearce

face picon face
Preacher McMahon sayeth

>And, worst of all, it shall
>sometimes APPEAR to be behaving normally but shall truly be behaving badly
>and you may never know but your results may be trash and worth only
>spreading on walkways in lieu of expended rock salt. Or worse.

But what he misseth out of his sermon is that such results shall be returned
to the earth from which they cometh by means of the muck spreader on the
farm, for the results shall surely issue forth strange smells at the most
inopportune times and seasons, or result in genetic modifications of the DNA
(Device Natural Activities) such that the performance shall be woefully
inconsistent to that prescribed by the great maker Microchip, in the good
book Datasheet ...

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...