Go Down

Topic: Single Tone Sine Wave Generator with Fixed Aplitude (Read 826 times) previous topic - next topic

alex_flying

Hello guys,

I am new in the forum and I would like to ask if there is a relatively simple project regarding a sine wave generator that can be modified to fit the following requirements:

- single tone frequency 3105Hz
- Amplitude 7Vrms

I found this project: https://www.arduino.cc/en/Tutorial/DueSimpleWaveformGenerator

but I don't know if it can be modified to produce the expected sinewave.

Thanks for the help

Alex

wolframore

This example states:

Taking into account the time for the instructions to execute, and adding the time for the analog input (around 40 µS to read the pot), maximum frequency for the signal with this sketch is around 170 Hz.

Could you explain what you're trying to do, maybe there's another option
Bad Boys Race Our Young Girls But Violet Generally Wins - Get Some Now :) - ELI ICE man

jremington

You will need an amplifier to produce a signal with 7Vrms.

DVDdoug

Do you need a stand-alone generator, or can you use your computer's sound card?

If you can't use your soundcard, I'd look for a generator/oscillator chip to see what's available before programming a microcontroller.

For some reason your example project only goes up to 170Hz.    I'm pretty sure the Due is faster than that.   

And of  course, you'll just have to use that project as a guide because the goals of that project are slightly different from yours.   (You don't need variable frequency or variable wave shape.)

FYI - The Windows calculator in "programmer mode" can convert between hex and decimal if you want to more-easily visualize the wave table data.   (Or, you might want to use a spreadsheet.)

You'll notice that the waveform is biased because the Due can't put-out negative voltages.   A series capacitor (AKA high-pass filter) will take-out the "DC component" giving you a waveform that swings positive & negative. 

You'll also need a low-pass filter if you want to "smooth" the stair-stepped DAC output.

The wave table can be simplified.   You only have to store 1/4 of the waveform (0-90 degrees).    Then the sequence can be reversed and/or inverted to build the rest of the cycle.   And of course, you can give yourself more resolution depending on the sample rate you want to use (and depending on how fast you can get it to run). 

In any case, you'll need an amplifier to get the 7V.    Do you know the load impedance?   7V RMS is about 20V peak-to-peak so you'll need something like a +/-12V or +/-15V power supply for your amplifier. 


...If you are not familiar with how digital audio works (or how any analog signal is digitized), theAudacity website has a nice little tutorial.     

DVDdoug

Quote
Two pins producing sine waves 180° out of phase will get pretty close to 7V RMS as the voltage difference between them varies from +5V to -5V...

...will need an RC filter to turn the PWM signal into an analog voltage,
The Due runs at 3.3V and in most "signal generator" applications you can't have a differential signal.

And, the Due has a DAC so you don't have to "fight" with PWM. ;)

wolframore

#5
Apr 09, 2020, 04:26 pm Last Edit: Apr 09, 2020, 08:23 pm by wolframore
Just produce a square wave and send through an integrator, you will have to calculate the values required and may need 2 stages. 
Bad Boys Race Our Young Girls But Violet Generally Wins - Get Some Now :) - ELI ICE man

DVDdoug

Quote
Just product a square wave
Again, unlike the "standard" Arduino's the Due has a DAC (true analog output) so that's not necessary.    You can filter/smooth the 12-bit output if you need a "pure" sine wave.

ard_newbie


It's very easy to produce a sinewave with the DUE (with a divider of 27053, you get 84 MHz/27053 = 3105 HZ).

As stated above, you can output a PWM signal from a sine wave at F=3105 Hz and add an RC, or output directly a sine wave thru the DAC. In either case, you'll have to add some hardware to rich 7V.

MarkT

Just produce a square wave and send through an integrator, you will have to calculate the values required and may need 2 stages. 
No, integrator will make a triangle wave.  You use a bandpass filter with reasonable Q or a multi-pole low-pass filter to chop off all the harmonics.  Far more efficient, a multiple-feedback opamp bandpass filter is probably
just the ticket.  You can use the other opamp in a dual package to provide gain upto 7Vrms (20V peak-to-peak).

Note +/-15V supplies will be needed for this kind of signal level.

[ about the Due: not only is it only 3.3V, but its DACs only use 2.2V of that range... ]
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

aarg

No, integrator will make a triangle wave.
A 2 stage cascaded integrator yields a very close approximation to a sine wave. We built this circuit in college.
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

wolframore

The multiple feedback band pass is actually a good idea as long as you can get a Q over 10. Not sure what the project is for.

3105 Hz is very specific

7v rms, we're talking about 10Vpp.

Does the OP have a negative rail?
Bad Boys Race Our Young Girls But Violet Generally Wins - Get Some Now :) - ELI ICE man

ard_newbie


MarkT

@MarkT: The DAC output is between 1/6 * 3.3V and 5/6 * 3.3V.
In other words a range of 2.2V as I said.  5/6-1/6 = 2/3 and 2/3 of 3.3 is 2.2
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

wolframore

@alex please explain what this is for.

@ard... yes that's what I meant and why I asked about the negative rail, thanks for catching that.
Bad Boys Race Our Young Girls But Violet Generally Wins - Get Some Now :) - ELI ICE man

Go Up