Rail to Rail sine wave out from arduino

Thread Starter

fieryfire

Joined Feb 14, 2017
150
Hi All,

I am trying to design a circuit that would allow me to analog out a sine wav/sinc wav between -10V and +10V rail to rail.
I would need to be able to control the amplitude as well as the frequency of the wave. I would hope to be able to control the wave through 8 different analog out channels. Could you please propose a solution on how i can realize such an architecture?
 

wayneh

Joined Sep 9, 2010
17,496
How much power do you want this wave to carry, in what frequency range? You'll obviously need a power supply with at least 20V DC.
 

Thread Starter

fieryfire

Joined Feb 14, 2017
150
How much power do you want this wave to carry, in what frequency range? You'll obviously need a power supply with at least 20V DC.
I already have a power supply that can supply dual rail. -15V and +15V. The frequency needs to be between 1 and 30Hz. Typically about 5Hz. It would be better if there was an option to adjust the frequency/width of the pulse
 

wayneh

Joined Sep 9, 2010
17,496
I already have a power supply that can supply dual rail. -15V and +15V. The frequency needs to be between 1 and 30Hz. Typically about 5Hz. It would be better if there was an option to adjust the frequency/width of the pulse
And the power level?
 

wayneh

Joined Sep 9, 2010
17,496
This i am unsure how to calculate, I would need just enough power for an ADC to be able ot detect.
That's close enough. That means essentially zero power. You just need to produce the voltage signal and that's much easier than, say, driving a subwoofer at 100W.
 

Thread Starter

fieryfire

Joined Feb 14, 2017
150
That's close enough. That means essentially zero power. You just need to produce the voltage signal and that's much easier than, say, driving a subwoofer at 100W.
Exactly... Could you please direct me on how i can achieve this? i know the basics of arduino, done a few PCBs myself. But i need some input here. :)
 

wayneh

Joined Sep 9, 2010
17,496
Exactly... Could you please direct me on how i can achieve this? i know the basics of arduino, done a few PCBs myself. But i need some input here. :)
I have no experience with Arduino but here's where I would start, with an assumption: The Arduino will have some sort of clock and an analog voltage output. With those two things you could, for each time interval, calculate the appropriate voltage of a sine wave at that time point, and set the output voltage to that value. The time intervals could be as small as the device is capable of but think about what level of precision you really need. Breaking one full cycle of the sine wave into as few as 6 segments might be just fine. If you need more precision, break it into more segments. I have no idea how far you can go but I assume you can achieve your needs.

Once you have a sine wave output from your Arduino, you'll need to scale and amplify it up to your desired voltage range. That can be done with a linear amplifier and I'd be tempted to use an off-the-shelf audio amplifier. It would need good low frequency specs but that's pretty easy to find these days.
 

Thread Starter

fieryfire

Joined Feb 14, 2017
150
I have no experience with Arduino but here's where I would start, with an assumption: The Arduino will have some sort of clock and an analog voltage output. With those two things you could, for each time interval, calculate the appropriate voltage of a sine wave at that time point, and set the output voltage to that value. The time intervals could be as small as the device is capable of but think about what level of precision you really need. Breaking one full cycle of the sine wave into as few as 6 segments might be just fine. If you need more precision, break it into more segments. I have no idea how far you can go but I assume you can achieve your needs.

Once you have a sine wave output from your Arduino, you'll need to scale and amplify it up to your desired voltage range. That can be done with a linear amplifier and I'd be tempted to use an off-the-shelf audio amplifier. It would need good low frequency specs but that's pretty easy to find these days.
As i understand, its only possible to do PWM with the arduino, which means it would go to from 0 to 5V only, and to control the analog voltage output would be via controlling the duty cycle. but this is not the same as an actual analog pulse. :(
 

wayneh

Joined Sep 9, 2010
17,496
As i understand, its only possible to do PWM with the arduino, which means it would go to from 0 to 5V only, and to control the analog voltage output would be via controlling the duty cycle. but this is not the same as an actual analog pulse. :(
Ah, ok, so you need a low pass filter LPF circuit to convert PWM to analog.
 

shteii01

Joined Feb 19, 2010
4,644
I have no experience with Arduino but here's where I would start, with an assumption: The Arduino will have some sort of clock and an analog voltage output. With those two things you could, for each time interval, calculate the appropriate voltage of a sine wave at that time point, and set the output voltage to that value. The time intervals could be as small as the device is capable of but think about what level of precision you really need. Breaking one full cycle of the sine wave into as few as 6 segments might be just fine. If you need more precision, break it into more segments. I have no idea how far you can go but I assume you can achieve your needs.

Once you have a sine wave output from your Arduino, you'll need to scale and amplify it up to your desired voltage range. That can be done with a linear amplifier and I'd be tempted to use an off-the-shelf audio amplifier. It would need good low frequency specs but that's pretty easy to find these days.
Uno does not have DAC. PWM is the only “analog” output on Uno.

Due has DAC. So they can do analog output using Due. however, the last time I used it, it did not do 0-3.3V. It only did 0.5-2.7V. I hope Arduino fixed that problem.
 

Polymorph

Joined Feb 6, 2009
6
The Teensy 3.1 and 3.2 have a built-in 12 bit DAC and are much less expensive than the Arduino Due. Example code to create a sine wave output on this page:
https://www.pjrc.com/teensy/teensy31.html

To avoid loss of resolution at lower signal levels, I might consider using a digital potentiometer to control amplitude rather than lowering the signal in the DAC.

There are also plenty of DDS chips and DAC chips that could handle this.

Trivial to amplify the signal to 10Vpk-pk. The Teensy 3.5 and 3.6 have two 12 bit DACs, you could use both to get higher resolution and put the output into an instrumentation amplifier, removing the offset voltage and amplifying the signal at the same time.

BTW, if you alter high/low ratios, it isn't a sine wave any more. Does it matter, for your application, that you'll be adding non-fundamental, non-harmonic content?
 
Top