Very smooth low frequency wave generation with arduino (1-Hz)

I'm working on a project that needs to control mechanical elements with very high precision. The current approach is employing an arduino UNO and an 8 bit DAC and an op amp to drive piezo elements (up to 15 V). While this works, the mechanical movement is far from smooth and causes unwanted vibrations due to stepwise movement.

I've looked at direct synthesis methods, pwm + low pass filter combinations that seem to be popular in audio context, but due to the resolution of the digital write, i think it might be hard to get a smooth waveform at low frequencies. (example)

Does anyone have experience in generating smooth low frequency signals (1-2 Hz)? I've been thinking of cycling the DAC between different levels akin to PWM to get even higher resolution but ı'm not sure if that would be feasible or even whether it would work better than arduino's native PWM.

Use a higher resolution DAC, e.g. this 12 bit one, or better.

You want a pure sine wave of 1-2 Hz ?

jremington- For everything to be sufficiently smooth, I'd need at least a 16 bit DAC. With more than one channel to deal with this makes things prohibitively expensive.

6v6gt- Not necessarily a sine-wave but any predefined waveform i can read off a lookup table. I assume i'll need around 16 bit voltage resolution to make movement smooth enough.

I was wondering how I could implement software Delta-Sigma modulation on an arduino with an 8 bit dac. If i'm understanding it correctly I should be cycling the 8 bit dac between values like PWM, fast enough so that a good low-pass filter will give an in-between value. DAC's are fast enough, but I'm not sure how to implement it in the software side.

The reason behind needing a very smooth wave is because this should be running a piezo element, not for sound but for positioning in an open loop system.

I'd need at least a 16 bit DAC

So what is stopping you?

Do you need better resolution or just smooth transition between levels? If you have enough levels and you need smooth transition put low pass filer between DAC and the solenoid and you should be OK.

EDIT: The higher value of resistor and capacitor the smoother your output will be but it will take longer to reach desired value. I guess with low pass filter large enough you could skip DAC at all and use PWM directly (if it would help).

With large value of resistor in the filter you may need to amplify the generated signal with an op-amp?

Is you problem absolute accuracy or switching jitter?

12bits is pretty accurate. You'd need to clock it at 2^12 times your output frequency of 1 Hz, (4096Hz) and even a simple 1-pole filter with -3dB at 3Hz would reduce switching 'jitter' by >1000 times - wouldn't this be good enough?

Even 8- bits with such a filter would have it reduce by nearly 100x.

And a 2-pole filter ( eg Sallen and Key ) would square these numbers



You can use this library to do what you want. The sampling time will need to be increased for 1 Hz.

charliesixpack: You can use this library to do what you want. The sampling time will need to be increased for 1 Hz.

I doubt any software will help him. He wants smooth analog signal, not precise sine wave.

What is the application, just piezo elements doesn’t explain what you are doing and why you need precise output control?

Thanks… Tom… :slight_smile:

Smajdalf: I doubt any software will help him. He wants smooth analog signal, not precise sine wave.

To get a smooth analog signal you first need to produce the signal in software. The direct digital synthesis method he is looking at would require a very big look up table at the frequency he is looking at. I proposed a more practical alternative.

I am puzzled by the requirements of this thing. 16 bit accuracy of a 15V signal is .2 mV resolution. Really? If using PWM you can never filter to that accuracy.