How to Generate Square Wave in Bursts with Variable Amplitude

Hello everyone,

I have an idea for a project but am not really sure if it is feasible. I want to generate a square wave of variable amplitude in bursts. I'm aiming for a frequency of around 500 kHz, and I want to be able to vary the number of bursts. Does anyone know if this is possible to do, and if so what the best method of proceeding would be? I've done a lot of research about PWM but I'm still not sure if I can make it happen using only that. Does anyone have any experience or suggestions?

Thanks in advance!

An arduino with proper sketch programming can certainly generate square waves, in bursts or continuously and up to 500kHz shouldn't be a problem.

What the basic arduino can't do without external components and/or circuitry is to vary the amplitude of any digital output signals it can generate. You need an external DAC for that or possibly a digitally controlled pot.

or an OP-Amp with a digi-pot in the feedback loop, controlled by the arduino,, or a staircase generator to provide stepping offset to the digital outout, or,,,

Thank you very much for your help. How do I generate a square wave in bursts? Is it via PWM or another function?

Cleisthenes:
Thank you very much for your help. How do I generate a square wave in bursts? Is it via PWM or another function?

The existing PWM function (analogWrite) only generates a fixed frequency with variable pulse width and probably wouldn't be used in your application. You would rather most likely have to find an existing 3rd party library or learn to control the internal timer hardware and create your own function.

I apologise for the late bump, but I'm still working on resolving this issue. Is anyone aware of any third party libraries that allow variable frequency and bursts for a square wave output from arduino? I am not having any success with controlling the internal timer to achieve this end.

Cleisthenes:
I am not having any success with controlling the internal timer to achieve this end.

If you haven't already read these, you might find the Varying the pwm frequency for timer 0 or timer 2? thread interesting, also the Timer PWM Cheat Sheet in the playground.

Maybe look into the toneAC library:
https://code.google.com/p/arduino-tone-ac/wiki/toneAC_Frequency_Limits