With each new generation of microcontrollers we tend to dwell on quantifiables like memory and speed — bigger, faster programs! At the same time, new devices often bring additional capabilities that are overlooked at first glance. These features open whole new doors, beyond what program size or speed can do.
The SAMD ARM M0 microcontroller used in Circuit Playground Express, Feather M0 and other Adafruit boards with the “Express” or “M0” designations — along with the Arduino Zero — include some intriguing new features, among them:
- A digital-to-analog converter (DAC). Pin A0 can provide a true analog voltage between 0 and 3.3 Volts. Previously, Arduino’s so-called analogWrite() function wasn't really analog — it generated a pulse-width-modulated digital signal.
- Direct memory access (DMA) allows data transfers between memory and peripherals (including the DAC) very quickly and without CPU intervention — it goes about its task in the background while other code continues to run at 100% speed.
We’ll demonstrate by generating composite TV and AM radio signals straight from the board. No shields or breadboards or soldering extra components, just some simple test leads!
While the projects shown here have a vintage rinky-dink flair, the fact that a microcontroller can do this entirely on its own — no extra parts, just some wires — is pretty remarkable. Rather than just thinking bigger and faster, what unconventional ideas and applications might you hatch from new hardware? None of this is really what the DAC is intended for, but it’s cool in a demo-scene kind of way.
These demo projects will require:
- An Atmel SAMD M0-based microcontroller board such as Circuit Playground Express, Feather M0 or Arduino Zero. 8-bit AVR boards and “classic” 8-bit Circuit Playground are not compatible.
- Corresponding board support enabled in the Arduino IDE: Tools→Board→Boards Manager… Adafruit boards require an extra step first, explained in this guide.
- For Circuit Playground Express: some alligator clip test leads. For other boards, some solid-core wire.
- The Adafruit_ASFcore and Adafruit_ZeroDMA libraries:
These libraries must be installed manually…they’re experimental and won’t appear in the normal Arduino Library Manager window. If you’re unfamiliar with manual library installation, the process is explained in this guide. You’ll need to quit and restart the Arduino IDE.
To confirm that SAMD board support is working, try uploading the basic “blink” sketch to a board. To confirm the Adafruit_ZeroDMA library is correctly installed, check that the Files→Examples→Adafruit_ZeroDMA rollover menu is present.
Each of the projects that follow will require its own additional library, again manually installed.