SineWave Generator for Arduino DUE

9.6K410

Intro: SineWave Generator for Arduino DUE

A sketch to generate a sine Wave using Arduino Due

The wave is generated by outputting pre-calculated voltage levels through the DAC on the arduino DUE board

Required:

1x Arduino DUE

2x Jumper wire

Setup:

Using a jumper wire, connect DAC0 on the Arduino to the desired target that should receive the wave

If ground connection is required:

Using a jumper wire, connect GND on the Arduino to the ground connection on the desired target.

The sketch offers 5 different waveforms with different frequency and levels of granularity. Follow the documentation in the sketch to uncomment the desired wave.

Resulting waves:

STEP 1:

7 Comments

Hi! I am 80 years old. I have no
serious programming experience with the Arduino Due. I would like to create a
signal generator with visualization of the results on the monitor screen of EVIVE
(StemPedia). Unfortunately, it is difficult to understand the code, since there
is no electrical diagram of the project. For example, what is the role of
buttons in a project. Could you send me the wiring diagram of the project.


pinMode(buttonPin1, OUTPUT);


pinMode(interruptPin1,
INPUT_PULLUP);
Hello!
Thank you for the thorough code with comments!
Two things I am confused about are the two Ints,
F = xxx; // for frequency
and
waitTime = 1000/F;
I don't see them being used anywhere other than being declared, why is that?
Hello. thanks for code. I got the sine wave using these code. how to acquire the data from analog pins. i mean am collecting sine wave at Dac0 pin is nice. now how can i get acquire same sine signal from the ADC pins. thank you

Im afraid the arduino UNO has no DAC and cannot support this implementation.
I have only tested this on a DUE, but technically the zero and mkr1000 could also work.

good afternoon. Tell me on arduino it works? The error in line 107 ('analogWriteResolution' was not declared in this scope). Tell me what to do. Thank you.

Interesting. I have never seen a wave generator like this on an Arduino before.