Quick Links:

Rugged Audio Shield

The Rugged Audio Shield is the most powerful and flexible audio playback, recording, and processing shield for the Arduino family. Includes 3.5mm jacks for stereo Line In and Headphone Out, mono Microphone In, microSD card socket with built-in FAT filesystem drivers, analog potentiometer, dedicated 32 MHz microcontroller (with hackable/upgradable firmware!) and stacking headers.

This is not a “kit”, there is nothing to solder. It is fully assembled and ready to work right out of the box. Stacking headers are already soldered in so you can add more shields on top.

The Rugged Audio Shield is compatible with Arduino Uno/Duemilanove, Ruggeduino, Arduino Mega/Mega2560, and all compatible shields (both 5V and 3.3V shields will work).

 

  • The Rugged Audio Shield

    ../assets/images/ad210_01.gif

    The Rugged Audio Shield has 3.5mm stereo Line In and Headphone Out connectors, a 3.5mm mono Microphone In connector, microSD card socket, and analog potentiometer. A dedicated 32 MHz Atmel ATxmega32A4 processor handles all audio and microSD card functions, leaving lots of free FLASH for the Arduino -- and lots of free processing time!

    Rugged Audio Shield
  • Compatible With Everything

    ../assets/images/ad210_02.gif

    The Rugged Audio Shield is compatible with just about every Arduino out there, including Uno/Duemilanove, Ruggeduino, Mega/Mega2560, and derivative boards, even 3.3V boards such as the chipKit. Only an SPI interface is needed.

    Rugged Audio Shield
  • Arduino Mega Compatibility

    ../assets/images/ad210_03.gif

    The Rugged Audio Shield is shown mounted on a Mega 2560. For Mega/Mega2560 boards, the ICSP header is used to provide SPI connectivity.

    Rugged Audio Shield

 

 

$34.95

Features

  • 3.5mm stereo Headphone Out connector for playing audio files from a microSD card (16-bit mono/stereo WAV), from the Line In or Mic In connectors, or directly from the Arduino (over SPI)
  • 3.5mm stereo Line In connector for recording to a microSD card (16-bit mono/stereo WAV), creating pass-through audio effects (to Headphone Out), or streaming audio directly to the Arduino (over SPI)
  • 3.5mm mono Mic In connector for audio input from standard electret condenser microphones. This audio source can be used instead of Line In for all functions (recording, pass-through effects, streaming to Arduino). It can also be configured for “Karaoke Mode”, that is, mixed with the left Line In channel to mix Line In+Mic.
  • Open-source Arduino library and example sketches
  • Built-in microphone amplifier with 25X gain, can be further amplified by software-selectable gain stage of 1X, 2X, 4X, or 8X (for a maximum overall gain of 200X)
  • Line In signal also has software-selectable gain stages of 1X, 2X, 4X, or 8X to accommodate a wide range of sources.
  • Software-controlled Headphone Out volume control, with controllable gain boost and bass boost
  • 32 MHz Atmel ATxmega32A4 microcontroller dedicated to audio processing and microSD card functions -- no need for an SD card library on the Arduino! Opening files, closing files, reading from files, writing to files, and more -- it’s all taken care of on the shield!
  • ATxmega32A4 microcontroller code is fully open-source, hackable, and easily updated. Just load a new program onto a microSD card, reset the shield, and the microcontroller reprograms itself using a built-in bootloader! You can also use ICSP to reprogram the ATxmega32A4, or use the Arduino itself.
  • 12-bit audio input and output resolution, supporting sampling rates of at least 44100 kHz (recording sampling rate is limited by the performance of the microSD card)
  • General-purpose analog potentiometer connected to analog input A3 on the Arduino (can be disconnected with a cuttable jumper)
  • SPI communication to/from the Arduino (uses pins D11, D12, D13, or ICSP header on the Mega/Mega2560)
  • Flexible pin configuration allows SPI chip select to be easily rewired to alternate pins (uses D8 by default)
  • Compatible with Arduino Uno/Duemilanove, Ruggeduino, Mega/Mega2560 and all compatible boards, both 5V and 3.3V models
  • Compatible with Arduino Mega or Mega2560 (or compatible boards) using ICSP header for SPI communication and 2x3 0.1” socket header (sold separately)
  • Powered directly from Arduino -- no additional power supply required
  • Includes reset switch for the Arduino and reset switch for the shield

Sample Sketches

Here are some sample sketches that illustrate only a few ways to use the Rugged Audio Shield. There are more examples in the library code. See the Arduino Library section below for instructions on downloading and installing the Rugged Audio Shield library and example sketches.

  • WAV File Playback From microSD Card
  • This sketch shows how simple it is to play WAV files from a microSD card. Since all of the microSD card functions are taken care of on the shield, this sketch only takes up 1496 bytes of FLASH on an Uno! That’s only 4.6% of available space.

    #include <SPI.h>

    #include <RAS.h> // Rugged Audio Shield library

     

    RAS RAS;

     

    void setup(void) {

       RAS.begin();

       RAS.InitSD();

    }

     

    void loop(void) {

      delay(1000);

     

      RAS.PlayWAV("SOMEFILE.WAV");

    }

  • WAV File Record To microSD Card
  • This sketch demonstrates how simple it is to record audio to a WAV file on a microSD card. A recording is started at a 32 kHz sampling rate, stereo, from the Line In connector and saved in 16-bit WAV file format to the file RECFILE.WAV on the microSD card. The file is created if it does not already exist. Then, the recorded file is played back repeatedly with a 1 second pause in between. Total sketch size: 3256 bytes on an Uno (10.1% FLASH used).

    #include <SPI.h>

    #include <RAS.h> // Rugged Audio Shield library

     

    void setup(void) {

      RAS.begin();

      Serial.begin(38400);

      RAS.InitSD();

     

      Serial.println(“Press ENTER to start recording”);

      while (! Serial.available()) /* NULL */ ;

     

      RAS.RecordWAV(32000, SOURCE_STEREO, SOURCE_LINE, "RECFILE.WAV");

      delay(5000); // Record for 5s

      RAS.Stop();

      RAS.WaitForIdle();

    }

     

    void loop(void) {

      delay(1000);

      RAS.PlayWAV(“RECFILE.WAV”);

      RAS.WaitForIdle();

    }

  • Mixing Line-In and Microphone with Volume Control
  • This sketch demonstrates “Karaoke Mode”, mixing the left channel of the Line In connector with the Mic In connector, then passing the summed signal to the Headphone Out connector, whose volume is controlled by the potentiometer on the shield.

    #include <SPI.h>

    #include <RAS.h> // Rugged Audio Shield library

     

    RAS RAS;

    int lastVolume;

     

    void setup(void) {

      RAS.begin();

     

      RAS.SetInputGainLine(INPUT_GAIN_1X); delay(10);

      RAS.SetInputGainMic(INPUT_GAIN_2X); delay(10);

      RAS.AudioEffect(EFFECT_NONE, 32000, SOURCE_STEREO, SOURCE_MIC);

    }

     

    void loop(void) {

      int reading;

     

      delay(300);

      reading = analogRead(3); // Read shield potentiometer

      if (abs(reading - lastVolume) > 16) {

        lastVolume = reading;

        RAS.OutputVolumeSet(map(reading, 0, 700, 0, 31));

      }

    }

  • Generating real-time audio
  • This sketch demonstrates real-time sound synthesis on the Arduino. The sketch generates a sinewave, whose frequency is controlled by the potentiometer on the Rugged Audio Shield. It’s like a Theremin!

Arduino Library

The only code you need to use the Rugged Audio Shield is the Rugged Audio Shield library, available from GitHub:

To install, just unpack into your Arduino libraries directory. The Arduino web site has some more specific instructions:

“Open your Arduino sketchbook folder. If there is already a folder there called libraries, place the library folder in there. If not, create a folder called libraries in the sketchbook folder, and drop the library folder in there. Then re-start the Arduino programming environment, and you should see your new library in the Sketch > Import Library menu.
For details, see the page on the Arduino environment.”

See the RAS Library page for full documentation on all the methods available in the library. The repository also contains numerous examples that demonstrate Rugged Audio Shield usage.

Pin Usage

The following table lists the default pin assignments of the Rugged Audio Shield.

Pin

Function

D8

SPI Slave Select

D11

SPI MOSI

D12

SPI MISO

D13

SPI CLK

A3

Potentiometer

All of the pins can be rewired for maximum flexibility, using cuttable jumpers on the bottom side of the shield (see the picture below). For example, if you want to use a different SPI slave select pin, other than D8, you would cut the small trace between the pins labelled D8 (on the bottom side of the board), then manually solder a wire from another pin (D5 for example) to the pad closest to the label D8 in the figure below.

ad210pin

NOTES:

  • The SPI slave select signal is active low (0 to communicate to the Rugged Audio Shield, 1 to communicate to other SPI devices).
  • If you cut jumper J14 then the potentiometer will become disconnected from analog pin A3, allowing you to use this pin for other purposes.
  • The potentiometer forms a voltage divider relative to 3.3V. Thus the range of readings you will get on a 5V Arduino is about 0-675 (rather than 0-1023) using the analogRead() function.
  • On an Arduino Mega/Mega2560 pins D11-D13 are not SPI pins. Instead, the SPI pins come from the Arduino ICSP connector at the right side of the shield. You will need to purchase a 2x3 0.1” pin socket and solder it onto the shield, with the socket pins facing downwards.

Additional jumpers and header pins are described in the table below.

Jumper

Function

J1

3.3V bias for electret condenser microphone input. You can use a dynamic microphone with the shield if you cut this jumper.

J11

ATxmega32A4 PDI CLK pin for in-circuit programming using an external programmer

J12

ATxmega32A4 PDI DATA pin for in-circuit programming using an external programmer

Shield ICSP

ATxmega32A4 ICSP header for programming using an AVR-ISP mkII or compatible programmer

D0

Connection to Arduino D0 pin (USART receive). The ATxmega32A4 can also talk to the Arduino over the serial port in addition to the SPI port, but currently does not do so.

D1

Connection to Arduino D1 pin (USART transmit). The ATxmega32A4 can also talk to the Arduino over the serial port in addition to the SPI port, but currently does not do so.

Technical Data

Here is the schematic of the Rugged Audio Shield.

 

The Rugged Audio Shield was designed in the USA and is assembled in the USA using lead-free components and lead-free manufacturing and assembly processes.

Proudly located in Michigan, USA

Copyright © 2013 Rugged Circuits LLC