Best way to create sine wave

Yes, depending on how smooth you want the wave, it could require a lot of interrupts. If you had 100 steps, that would be 32,500 interrupts per second, or 30 microsecond period, which is a lot but possible with a hardware timer. You can go down to about 10 microseconds between interrupts, so you could probably go up to 300 steps, at the expense of additional overhead.

However I would go in a completely different direction and use something like this. It’s US$ 2.85 (including shipping) and can play audio files completely on its own. It has a 24-bit DAC and a built-in audio amplifier. A bunch of us in the forum have used this board and it works great!

1 Like