# Low frequency sinus generator

I would like to build a sinus frequency generator that can be controlled via an Arduino. Sinus frequency would be in the low frequency regime (below 100 Hz) with a voltage around 2.5 Volts peak to peak.

I will have to use the SPI interface SPI tutorial for other purposes at my Arduino. Therefore an external IC that can be controlled via SPI is not feasible.

Additionally I would like to avoid the DDS (Digital Direct Synthesis) possibility as I would like to externalize the frequency generation.

So perhaps the sinus generation should be made with some of the standard oscillators like Wien bridge etc.

Can somebody give me a link for a circuit that fulfills my requirements and that can be controlled with an Arduino Uno?

With control I mean:

1. On/off
2. Frequency (this is not a must but a nice to have)
3. Amplitude

With "I would like to externalize the frequency generation" I mean: keep the programming logic inside Arduino clean of too much things, that a dedicated device can do better. If I use hardware instead of software, I expect to have a less fragile setup regarding timing. If other time critical extensions come up, I have more "headroom" for them.

• What do you mean by controlled? On/off, frequency, amplitude? What have you tried? – Spehro Pefhany Jul 15 '14 at 5:18
• By utilizing the Slave Select pin, you can easily extend the number of devices on you SPI bus, or you can bit bang a software SPI. Using SPI shouldn't be a restriction in my opinion. What do you mean by "I would like to externalize the frequency generation"? – jippie Jul 15 '14 at 5:26
• @useer2145488: I am familiar with linear oscillators but not with arduino. Therefore, my question: Which kind of oscillator do you need? Single-element voltage controlled? Something else? – LvW Jul 15 '14 at 7:28
• @jippie: I thought, that because of circuitsathome.com/mcu/… this solution is not advisable neither. Did I understand this link wrong? – user2145488 Jul 15 '14 at 15:50
• @LVW It could be Wien-Bridge Oscillator or a Phase-Shift Oscillator. Oscillators with LC elements I would like to avoid as coils ("L") do not seems very practical for me. As far as I have understood it, a voltage controlled oscillator / function generator does not deliver sinus output, or am I wrong? – user2145488 Jul 15 '14 at 15:57

Have you considered using a look-up table of sine vs angle values and DAC (digital-to-analog converter to produce the analog output? No weinbridge or RC shift oscillators needed. This reduces your parts count and creates an elegant, simplified, precise, digitally controlled oscillator. Simply cycle thru the look-up table at the desired rate to control frequency. You may want to add a low pass filter to smooth the DAC output to reduce harmonic distortion. A lookup table can be built for 1/4 of the cycle to reduce memory needed to store values for the first quadrant ($0-90^{\circ}$). Then use symmetry at $90^{\circ}$ to build the 2nd quadrant ($90-180^{\circ}$). Finally, repeat the 1st and 2nd quadrant with inversion to build the 3rd and 4th quadrants ($180-360^{\circ}$). This completes one cycle. Higher resolution is achieved with higher bit DAC. At the max. freq of 100Hz, you should have no problem finding a DAC to do the job. Build the look-up tables values by hand calcs (error prone) or use the first few terms of the Taylor series expansion of the sine function, for example: $$\sin(x) = x-x^3/3!+x^5/5!-x^7/7!+...$$

The 1st 3 ot 4 terms should give a close approximation of the sine of the angle. $n!$ means n-factorial, e.g. $5! = 5 \times 4 \times 3 \times 2 \times 1$. So, you can actually program the equation in code and load values for each angle between 0 and 90 into memory. http://en.wikipedia.org/wiki/Sine

You don't need any additional ICs for such a low frequency, just a couple of passives and analogwrite is enough, see these links:

http://engineeringnotes.blogspot.com/2013/09/analog-output-from-microcontroller-dac.html

http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/

http://www.avdweb.nl/arduino/hardware-interfacing/super-simple-dac.html

• OP wants to avoid DDS and to have external frequency generator – Vovanium Jul 15 '14 at 14:54
• These links seem to me to have a bad effect on the timing of the Arduino (they induce time criticality in my code). Additionally, some are not related to the Arduino Uno either... – user2145488 Jul 15 '14 at 16:00