3
\$\begingroup\$

I'm interested in creating low frequencies using a high-frequency oscillator. For example - using a 12Mhz oscillator to create 1Khz, 2Khz waves.

I've been said that using a Binary adder(oops) counter it could be accomplished.

Anyone could please help me to understand how this can be done? Also, I should use a low-pass filter for Sine(ish) waves. How does this come into place?

The target is to create about 5 distinct frequencies and "stream" them out of the circuit. The circuit should be very cheap - so no mC could be used.

Many thanks for the help :)

\$\endgroup\$
  • \$\begingroup\$ what kind of high-frequency oscillator are you using - or have you not chosen one yet? \$\endgroup\$ – Jim Jul 23 '11 at 9:14
  • \$\begingroup\$ If you're looking at creating a sine wave, this question may be of help -electronics.stackexchange.com/questions/16512/… You might be surprised by how low cost a micro controller may be once you've added everything up. \$\endgroup\$ – Jim Jul 23 '11 at 9:19
  • \$\begingroup\$ It was a Binary Counter I suggested, not a Binary Adder. The two are very different. Read the data sheet for the '4040' CMOS chip. \$\endgroup\$ – Majenko Jul 23 '11 at 9:53
  • \$\begingroup\$ sorry - really was the Counter :) \$\endgroup\$ – roman Jul 23 '11 at 10:39
  • \$\begingroup\$ @roman - I mention a counter in my answer for the non-microcontroller solution, but it does actually what the uC also does, but then in software. \$\endgroup\$ – stevenvh Jul 23 '11 at 10:45
4
\$\begingroup\$

Yes, that was Matt who told you about the filtering to get a sine from a square wave; unfortunately he forgot to tell you how to do this. :-)
Well, it's not easy. A 1kHz square wave will have a 3kHz harmonic with 1/3 amplitude, a 5kHz with 1/5 amplitude, etc. That's a lot of energy in the harmonics which you want to get rid of. You need a sharp low-pass filter to be sure that the 3kHz is attenuated enough. That's possible, but not so easy to make it variable; for the 2kHz sine you want a higher cut-off frequency.

enter image description here

The plot shows that the signal still looks more like a square wave than a sine even with all except the third of the harmonics removed.
All this suggests that this may be an easy approach to generate different crystal-stable frequencies from a single 12MHz oscillator, but not sines. For sines there are analog solutions like the Wien bridge, but these aren't so frequency stable.

Like I said in my other answer DDS really is the way to go; you get the best result for the money. If you don't want to use a microcontroller you can use a lookup ROM programmed with a sine waveform, let a counter run over all addresses, and feed the output to a DAC. That requires a little bit of logic, but no uC. The clock you use for the counter will be a multiple of the sine, so feeding a different clock frequency will give you a different sine frequency.
All this said, this may cost as much as a microcontroller; there's no reason to dismiss a microcontroller because it would be too expensive. uCs are dirt cheap these days and often a more economical solution that analog alternatives. You won't find anything simpler than Jesper's generator (was linked here http://www.myplace.nu/avr/minidds/index.htm, link now broken)

If you want to generate the 5 signals simultaneously and mix them the DDS solution is even more cost-effective: you'll need only one (1), vs 5 oscillators in an analog solution.

edit
If you only need 5 fixed frequencies you might want to switch them on and off selectively, so that you can mix them. Easy with the DSS uC: instead of keeping one phase accumulator (expensive word for "counter"), you just keep 5 of them, and add the sine values before sending them to the external DAC. You could use 5 switches to turn them on and off. You don't need the MAX232 then. Like I said: cheap.

\$\endgroup\$
  • \$\begingroup\$ I'm not sure the OP wants the Oscillators to be adjustable - "The target is to create about 5 distinct frequencies" It may be that they just want fixed frequencies, which would be a lot easier to filter \$\endgroup\$ – Jim Jul 23 '11 at 9:23
  • \$\begingroup\$ @Jim - I really need only 5 FIXED frequencies. No need for dynamic generation or stuff like that. \$\endgroup\$ – roman Jul 23 '11 at 10:29
  • \$\begingroup\$ @Stevenvh - thanks for the great answer. I'm going to check the DDS solution (though it seems little expensive). I'm looking for max 3$ solution. better even less. \$\endgroup\$ – roman Jul 23 '11 at 10:30
  • 3
    \$\begingroup\$ @roman - the microcontroller used (actually its successor, the ATtiny2313) costs 2 euro, and you hardly need anything else. The MAX232, for instance only if you want to connect to a PC. But you can use pushbuttons to control it if you want. \$\endgroup\$ – stevenvh Jul 23 '11 at 10:33
  • 3
    \$\begingroup\$ @roman - if you take a look at Jesper's page you'll see that it can do sines too. It uses a sine lookup table and a DAC (cheap, just resistors). If you tweak the software a bit you can even generate several different sines added together. \$\endgroup\$ – stevenvh Jul 23 '11 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.