Arduino Sinewave Generator

This project describes how to use an I2C DAC and an Arduino Uno to make a sinewave.

Aug 11, 2021

73039 views

8 respects

Components and supplies

1

Arduino UNO

2

4.99K Resistor

1

Capacitor 100 nF

1

SF-5 DAC Board

1

Resistor 10k ohm

1

Jumper wires (generic)

1

Solderless Breadboard Half Size

Tools and machines

1

Oscilloscope

Project description

Code

SF-5 DAC Example Arduino Code

arduino

This code will output the sinewave discussed, but it also reads and writes to the registers of the MSP4725.

Downloadable files

Schematic Diagram

This shows how to connect the SF-5 to the Arduino Uno

Schematic Diagram

Schematic Diagram

This shows how to connect the SF-5 to the Arduino Uno

Schematic Diagram

Comments

Only logged in users can leave comments

thomash73

a year ago

Skipping the MSP4725 and using the Arduino itself as a 6-bit DDS, I built a 6-bit R-2R DAC and with the Uno, I get a clean sine wave up to 41 kHz with 64 samples/cycle, progressively less clean as I reduce the number of samples by half, all the way up to a (clean) square wave at 1.33MHz. This is of course with a hand-optimized assembler loop writing to the GPIO's, with interrupts disabled and checking for break conditions in the loop. I'm planning to put this project up soon, but I want to disprove the claims of those saying this type of thing isn't possible without an external synthesizer chip.

Anonymous user

3 years ago

I did a bunch of experiments a few years ago generating sine waves for a morse code project. I used both PWM techniques and a Teensy processor which has a real DAC. I used all integer math to speed things up. One thing you could do is shrink the size of your sine table by exploiting symmetry in the sine curve. You can get a complete table by storing only one quarter of the values. https://wb8nbs.wordpress.com/2015/12/15/still-more-fun-with-direct-digital-synthesis-teensylc-with-dac/