There are a variety of further steps you could take with this project that would make it even more capable. We'll look at a few here.

Amplifier

Adding a class D breakout would provide a stronger output signal. This breakout would do the job nicely. It's the amplifier used in the HalloWing and similar to the one in the Circuit Playground Express.

Angled shot of Adafruit Mono 2.5W Class D Audio Amplifier.
This super small mono amplifier is surprisingly powerful - able to deliver up to 2.5 Watts into 4-8 ohm impedance speakers. Inside the miniature chip is a class D controller, able to...
Out of Stock

Low Pass Filter

Adding a low pass filter on the output to filter out some of the high frequency digital artifacts would produce a cleaner output signal.

More Waveforms

While the four provided waveforms are the standard ones, it could be useful to add more. Sine based signals with different sets of harmonics would be one possibility.

The current sawtooth wave ramps up slowly then drops. The opposite is also often present in signal generators: slowly ramping down before jumping up.

Waveforms as Classes

This would be an interesting as an exercise, and quite useful if you wanted to add to the selection of waveforms. Each waveform would be implemented by a separate class, possibly with a base class. Each of these classes would have methods to generate (x, y) pairs that define how to draw the thumbnail of the wave, and a method to generate the sample array.

There would need to be some way of storing the instances, and selecting from among them. This might require the Feather M4 due to memory.

Adjustable Duty Cycle

Currently square and triangle waves have a 50% duty cycle. Making that adjustable would be extremely useful. In fact, the sawtooth could be removed as a separate waveform (possibly completely, but probably just the implementation since it's common enough that you might want to keep it as a selection) since it can be considered to be a triangle wave with an extreme duty cycle (0% or 100%).

Dynamic Sample Rate

The current design uses a fixed sample rate and varies the number of samples based on frequency. A result of this is that high frequency signals have fewer samples and thus are much choppier, and have far more digital artifacts.

By keeping the number of samples fixed we can get good quality signals for all frequencies. To support that we need to vary the sample rate based on frequency. 

This guide was first published on Oct 17, 2018. It was last updated on Mar 27, 2024.

This page (Going Further) was last updated on Mar 08, 2024.

Text editor powered by tinymce.