# Crystals For Odd Frequencies?

Discussion in 'Electronic Basics' started by Ron Hubbard, Sep 11, 2003.

1. ### Ron HubbardGuest

I need a stable clock oscillator for a digital filter. Does
anyone know if it's possible to make a crystal oscillator to
produce square waves at odd frequencies like 400 Hz, 700, Hz,
830 Hz, and 2kHz?

2. ### John PopelishGuest

If you need all those at once, you can build a single crystal that
runs at the product of all their prime factors.

E.G.
400=2*2*2*2*5*5
700=2*2*5*5*7
830=2*5*83 (yikes!)
2000=2*2*2*2*5*5*5

So 2*2*2*2*5*5*5*7*83=1,162,000 Hz

If you can find a crystal that runs at any integer multiple of that
frequency, you can use counters doing integer frequency division to
create all those frequencies.

3. ### Thomas C. SefranekGuest

You usually divide a higher frequency down to these frequencies.
Look at the CMOS 4040 or 4060 chips.
Natural frequency quartz for these low frequencies mean VERY BIG crystals.

4. ### SteveGuest

An interesting question.

A couple of those would be theoretically possible using frequency
division!

A small technicality, but I would think you'd be after a frequency
synthesiser rather than an oscillator.

Maybe a micro (PIC) that's crystal locked and suitably programmed
would have the accuracy you're after?

5. ### Ron HubbardGuest

Hmmm, Mouser makes custom crytal oscillators for about \$15 and
it shouldn't be hard to get one made for 1.162 MHz.. But I
don't see how that one frequency can be divided in so many
ways using only the usual divide by 2, divide by 5 or 6,
divide by by 10, and divide by 12 counters.

6. ### John PopelishGuest

1,162,000/83/7/5=400
1,162,000/83/5/2/2=700
1,162,000/7/5/5/2/2/2=830
1,162,000/83/7=2000

This takes more divisions than necessary.

1,162,000/83=14000
14,000/7=2000
2000/5=400
14,000/5/2/2=700
1,162,000/7/5/5/2/2/2=830

For value less than 10, a 10 bit decoded counter like a CD4017 can be
hooked up to roll over on any count below 9.

The only hard to construct counter is the divide by the prime number,
83. This could be built with a preloadable counter that counts 82
down to zero, and then reloads. These often come in 4 bit packages,
so two of those would hold the preset value of 82.

7. ### EROMLIGNODGuest

I have done this.

I used a 10 MHz crystal oscillator and divided it with an Intel 82C54
programmable counter. It has a "square wave" mode where it divides the clock
by a number and produces a square wave output. If you wanted 440 Hz, for
example, you would give the counter the number

10,000,000 / 440 = 22,727

This would produce an extremely accurate 440Hz square wave.

You have to set up and feed the counter with some sort of processor though. I
use a Basic Stamp. It's pretty simple.

Hope this helps.

Don

8. ### Charles JeanGuest

Check out page 11 of the data sheet for the Phillips 74HCT40103 8-bit
down counter at:
http://www.semiconductors.philips.com/acrobat/datasheets/74HC_HCT40103_CNV_2.pdf

F(out) = F(in)/(N-1), where 0<N<256, N an integer

Depending on the value of N wired into the device, you can get one of
255 lower output frequencies.

They can also be cascaded to get even lower frequencies.

If God hadn't intended us to eat animals,
He wouldn't have made them out of MEAT! - John Cleese

9. ### Ron HubbardGuest

And if I understand you right, John, an awful lot of counter
chips; at least fifteen, and more if I need to add additional
clock frequencies. That makes what starts out as a simple
project immensely complicated with, ironically, the clock for
the filter becoming far more complicated than the rest of the
project.

I think, while it's more expensive to purchase and use several
custom crystals, it would be easier to use crystals like 1.000
MHz, 1.400 MHz, 1.660 MHz, etc and divide those frequencies by
10/10/10/2— thus requiring overall only four chips. Three
chips (minus the oscillator), if I use double decade counters.
I believe in that basic engineering tenet, "keep it simple,
[stupid]." It started as a simple project and I really want to
keep it that way.

Ron

10. ### John PopelishGuest

I did not make a judgment that this method was a good solution to your
could be derived from a single crystal oscillator. If the technique
is some use to you, that is good.

I don't even know that you need the stability of crystal oscillators
for your frequencies. For all I know, a few 555 timers might be a

11. ### Ron HubbardGuest

John, you gave me a few options and food for thought that has
led to a solution. Not an "ideal" one, but what is?

I want to build a cheap (less than \$100) but rather special
type of EEG biofeedback unit designed to allow one to learn
how to produce 4.0 Hz theta, 7.0 Hz theta, 8.3 Hz alpha, and
20.00 Hz beta waves; and possibly two or three other
frequencies if the need arises. commercial units usually run
around a thousand bucks!

I started with analog filters but finding precise resistor
values and matching capacitors to be a major drag. I replaced
the analog filters with the tunable LTC-1164-8a bandpass
filter. It's not good for anything high frequency (read that
as greater than 5 kHz) but it should be perfect for this
application. However, the bandpass frequency is determined by
the clock frequency: 500 Hz in equals 5 Hz out in a 100:1
ratio.

I intended to use the VCO in a CD4046 as a clock, but it
wasn't stable; drifting about 1 or 2 Hz every few seconds. For
most other applications, a slight deviation in clock frequency
wouldn't matter, but here a one or two Hz drift would mean the
filter might cycle between 5Hz and 5.01 Hz sporadically. For
this biofeedback purpose, that wouldn't be acceptable in the
least. Hence the need for a stable square wave clock source.
And to further complicate things a bit, the LTC1164-8a
requires that square wave to have a 50% duty cycle.

There are a lot of oscillators out there, but so far I can't
find any that's highly stable without using crystals. I hear
he old tube-based Franklin oscillator was very frequency
Going with microprocessors would add to the complexity, time,
work, and cost— But at least crystals are a relatively cheap
sure thing.

Ron

I did not make a judgment that this method was a good solution
to your
frequencies
could be derived from a single crystal oscillator. If the
technique
is some use to you, that is good.

I don't even know that you need the stability of crystal
oscillators
for your frequencies. For all I know, a few 555 timers might
be a

12. ### Robert MonsenGuest

I've written some PIC code to take a crystal and produce a given
set of squarewaves. The squarewaves are selected based on digital
input to two of the pins. The output is preprogrammed internally,
and can be set up for 4 different frequencies. You need a 20Mhz
parallel crystal, a resistor, and a couple of 22pF caps to drive it.

Its quite stable. Are you interested? email me at rcmonsen at comcast.net

Regards,
Bob Monsen

13. ### Ron HubbardGuest

Thanks, Bob, but as a design objective I wanted to stay away
from PICs, microprocessors, and anything even remotely related
to computers..Back in the "old days" (the 70s) people could
of op-amps and some transistors. Were it not for me sticking
in a digital filter, I would've been finished with this thing
in a couple of spare evenings with no hassles (well, few
hassles). Now it's already taken on a complexity I find
appalling. For all the exotic chips being made, you'd think
someone would make a dedicated clock chip...

Oops, somebody did: Intersil used to make the ICL7209 clock
oscillator that would drive any crystal, had a divide by eight
output, and an inhibit pin for digital control. Too bad, those
are as extinct as the dodo these days.

But thanks anyway.

Robert Monsen wrote in message ...

14. ### Bob MastaGuest

Just out of curiosity, why wouldn't 5.01 Hz be acceptable?
Aren't the standard alpha, beta, etc designations for fairly
broad bands that vary between individuals? Or is there
some advantage in biofeedback training to hit a very
precise value? I would have guessed that 10% would
be accurate enough for this.

Bob Masta

D A Q A R T A
Data AcQuisition And Real-Time Analysis
Shareware from Interstellar Research
www.daqarta.com

15. ### Ron HubbardGuest

Hi, Bob;

It's true that there is a bit of debate in the EEG community
about the boundaries of the various brainwave boundaries:
delta, theta, alpha, beta, and gamma. But generally its:

0.5 Hz-3 Hz delta
4.0 Hz-7 Hz theta
8.0 Hz-12 Hz alpha
13 Hz-40 Hz beta
40Hz-- gamma Or 30 Hz-500 Hz high beta

There are frequencies within each band that are beneficial if
you can learn to produce them at will: 3 Hz delta is good for
headaches (if you can learn to stay awake); 30 minutes of 5Hz
theta is equal to 8 hours of deep sleep, etc. Biofeedback when
smoking & alcoholism, improved memory and improved creativity,
plus a fairly wide assortment of other things— some of those
that would amaze you.

But learning how to change your brainwaves is not like
learning to tie your shoes; it's bloody difficult. With my
original design that used analog filters, I could be sure that
a specific frequency would be passed and others rejected.

With this digital filter being clock dependent, if there are
any slight frequency variations it makes it doubly hard to
learn how to reach whatever center frequency I may want to
learn. If I wanted to learn how to produce 5 Hz at will, a
slight deviation of .01 Hz isn't going to be constant with
anything but a crystal-based clock oscillator; using my
original CD4046 as an clock it would shift up and down maybe 1
Hz or maybe 2 Hz sporadically; other oscillators were even
worse.

For most applications a 1 or 2 Hz shift might not be a
problem, but in this case it would be shifting the center
frequency up and down— can you drive when sunlight is
flickering in your face unpredictably? Such a frequency shift
would amount to the same thing in this application.

Ron

Bob Masta wrote in message

16. ### Robert MonsenGuest

[brainwave information]

So what kind of sensor do you use to detect the brainwaves? Where are they
placed?

Regards,
Bob Monsen

17. ### Ron HubbardGuest

The unit uses three silver electrodes of the kind used in most
biomedical devices (EEGs, EKGs, etc): one on the back of the
head, one on the forehead, and the ground is clipped to an
ear. These electrodes are connected to an instrumentation
amplifier with an incredibly high impedance provided by a pair
of TL081 JFET op-amps.

The signal is then amplified quite a few times by a couple of
LM301 externally compensated op-amps, and then bandpass
filtered since the brain at any point in time cane be
producing multiple frequencies at once and in different parts
of the brain. Most people when awake and active produce beta,
but other parts of the brain could be producing alpha or theta
at the same time.

The desired frequency leaves the filters and is used to
frequency modulate a square wave oscillator to let you know
that a particular frequency is being produced. As biofeedback
units go it's pretty simple, but it does the job without
needing a computer and software, and considerably cheaper than
commercial EEG units that rely on computer technology.

Ron

Robert Monsen wrote in message ...

18. ### Roger JohanssonGuest

You cannot first amplify and then filter, you need active filters
which amplify only the frequencies which are of interest.
Too much noise if you don't.

After these active bandpass filters all you need to do is to rectify
and indicate the activity within these pass bands.
There is no need for crystals, which have 5-7 digits precision, in
this project. Plus minus 30% is a more useful precision for these
frequencies.

I read about an EKG (heart monitor) project once, it used an active
filter with very high amplification within a pass band where you can
expect the heart rate to be.

Something like that will be needed for this project. Active filters
which use op-amps.

I think you could find schematics for such EEG units if you search
thoroughly for them on the web. Try EKG too, it is the same basic
circuit.

19. ### Bob MastaGuest

On Mon, 15 Sep 2003 16:22:22 -0700, "Ron Hubbard"

Ron:

It seems to me that if you are trying to produce 5.00
Hz and succeed in producing 5.01 Hz, that is a definite
hit! Also, consider that the analog filters probably had drifts on
this order of magnitude due to component drift with temperature.
Since you are only changing the center frequency of a fairly
broad band (even with digital filters), a small shift is not going
to send a valid signal down by very many dB; it just might move
out from the passband onto the start of the cutoff slope.
My guess is that you can probably tolerate 5 or even 10%
drift in the center frequency before you will get a perceptible
difference.

Bob Masta

D A Q A R T A
Data AcQuisition And Real-Time Analysis
Shareware from Interstellar Research
www.daqarta.com

20. ### Ron HubbardGuest

Bob Masta wrote in message

In this one particular application, neither a 5 nor 10 per
cent drift is acceptable. If you just want to learn how to
produce alpha or theta-- yeah, it don't matter. But I have
reasons for very precise, very specific frequencies +/- no
more than 1% and that's being generous. There's a list of
brainwave frequencies available on the "Net and that list is
quite clear where a frequency like 3.6 Hz may do one thing,
but 3.84 Hz does something entirely different. That's less
than a 7% difference, but there are other frequencies even
closer together than that that do very different things. So
there are no allowances for drift of any kind.

But the LTC1164-8 is a 8th order, ultra-selective digital
bandpass filter,

http://www.linear.com/pdf/11648fa.pdf

whose center frequency depends only upon it's clock frequency,
which, as I said elsewhere, is in a 100:1 ratio: 500 Hz in to
get 5 Hz bandpass. With a few custom crystal oscillators and
few counters, I can get even fractional frequencies with a
high degree of accuracy out of the LTC1164-8 that I could
never achieve with analog filters even using 0.1% resistors
and matching caps to three places.

Ron