↑ Return to Projects

Print this Page

Audio Sound Module Library for the SOMO-14D (Version 1)

There is a simple way to put audio to your projects, yes, that is using an external hardware.  If you want to manage only applications without worring about speech processing, compression and decompression and just want to test simple audio sounds in your project, the SOMO-14D audio module is just for you.

Description of the SOMO-14D

The SOMO-14D is a tiny Audio-Sound module that can play back pre-stored audio files such as voice and music from a micro-SD memory card. The module supports 4-bit ADPCM audio files with sample rates from 6Khz up to 32Khz. By using the freely available software tool, any WAVE(.wav) or MP3(.mp3) file can be easily converted to the ADPCM(.ad4) format which can then be can be saved to a micro-SD memory card. The compact 14pin drop-in-module takes up very minimal board space and is ideal for any application that requires embedded audio.

The module offers two modes of operation, SERIAL-MODE and the KEY-MODE. The SERIAL-MODE provides a simple 2-wire interface to any micro-controller via its DATA and CLK lines. Audio operations such as PLAY, PAUSE, STOP and VOLUME control functions are all available to the host micro via simple serial commands.

By these example i will implement not the KEY-MODE but the serial mode, because is very useful to have all commanded via “protocol”.

Features

• Low-cost module for all embedded Audio-Sound applications.
• Supports 4-bit ADPCM (.ad4) file formats with sampling rates from 6Khz to 32Khz.
• SERIAL MODE: Supports a 2-Wire (Data, Clock) interface to any micro-controller.
• KEY-MODE: Supports a simple stand alone operation without a host micro.
• Differential 2 line PWM output for direct speaker drive (8/16/32 Ohm/0.25W).
• Dedicated 16-bit DAC/PWM audio output to use with an external amplifier.
• On-board micro-SD memory card adaptor for storing of audio, voice and music files (up to
512 files).
• Supports up to 2Gig micro-SD memory cards (FAT/FAT16 format).
• Compact size measuring only 18.3 x 20.8 mm.
• 2.7V to 3.6V DC voltage range (single supply).
• RoHS Compliant.

Applications

• General purpose embedded audio and sound applications.
• All voice annunciator systems.
• Automotive, Parking radar, GPS navigation systems.
• Elevator, Security, Access-Control and Warning devices.
• Intelligent home automation and domestic appliances.
• Robotics and Industrial control.
• Traffic facilities: Toll gates, parking lots.
• Toys, learning tools, talking books and all gaming sound effects.
• MP3 player like simple devices

Pin Configuration

 SOMOpincfg

Pin Symbol I/O Description
1 NEXT I Selects the Next Audio file from the memory card. Active LOW triggered input. Connect to a push-button in stand alone KEY-MODE.
2 NC No Connect.
3 CLK I Serial Clock input from host micro-controller. SERIAL-MODE use only.
4 DATA I Serial DATA input from host micro-controller. SERIAL-MODE use only.
5 BUSY O BUSY signal. Active HIGH output. This signal is high when the module is playing an audio file from the uSD memory card. This pin can be connected to a LED via 470 Ohm resistor to GND.
6 PLAY/STOP I Play/Stop toggle input. Active LOW triggered input. Connect to a pushbutton in stand alone KEY-MODE.
7 PREVIOUS I Selects the Previous Audio file from the memory card. Active LOW triggered input. Connect to a push-button in stand alone KEY-MODE.
8 VCC P Main Voltage Supply +ve input pin. Working Voltage range is 2.7V to 3.6V, nominal 3.3V. Connect a capacitor in the range of 100uF to 470u between this pin and supply ground.
9 GND I Supply Ground.
10 RESET P Master Reset signal. Active LOW triggered input. Internally pulled up.
SERIAL-MODE: Can be controlled by external micro port or left open.
KEY-MODE: Can be connected to a push button or left open.
11 SPK+ O Speaker+ drive output. Connect to 8/16/32-Ohm, 250mW speaker +ve.
12 SPK- O Speaker- drive output. Connect to 8/16/32-Ohm, 250mW speaker -ve.
13 NC No Connect.
14 AUDIO O 16-bit DAC/PWM output for external amplifier drive (optional). Use the BUSY signal to enable the audio to eliminate clicks. See section 2.3

Serial-Mode Connections

Schematic

Not all pins are necessary to achieve correct communications via the SOMO and the MCU unit.  For just commanding, simply connect the DATA and CLK signals to your microcontroller.

The basic commands correspond to 16-bit characters from 0000 to FFFF.  The hex values commands all actions from the module.

 

Command Code Function Description
0000h – 01FFh AUDIO FILE ADDRESS Selects one of the pre-stored audio/sound/voice files in the microSD memory card (up to 512 files max).
FFF0h – FFF7h VOLUME Volume adjustment codes. Total of 8 levels. FFF0h is the minimum and FFF7 is the maximum (also the default) volume level. The volume can be adjusted during play or standby state.
FFFEh PLAY/PAUSE Plays or Pauses the current audio file.
FFFFh STOP Stops playing the current audio file and puts the module in the low power idle mode.

 

For the first command code, the 000 hexadecimal value corresponds to the first *.ad4 file on the SD Card, 01FFh, correspond to the 512 *.ad4 file on the SD card.  As you see, the device is limited to 512 audio files in a special format *.ad4, corresponding to ADPCM.

SOMO Audio Converter Tool

For convert your *.wav or *.mp3 files to *.ad4, is neccesary to use a 4D Systems Tool (freeware, i don’t know if 4D Systems developed this tool).  You can download here 4D-SOMO-Tool.

Timing Diagram

Special care for the signals must be given if you have a fast microcontroller, but you can revise it using a oscilloscope or adjusting your system bus clock module on your microcontroller, determine the bus speed and adjust as you want.

The timing diagram is shown below.

SOMOTimingDiagram

 

More information is on the user manual of the SOMO-14D that you can get here.

MBED Application

Now is time to pass to our application.  The main purpose of the use of our mbed platform in this application is to do a terminal program where you can command the SOMO via simple commands.  The image below show what we do.

SOMOTerminalI use CoolTerm for the serial interface.

Basic commands are used to:

  • Play the current song
  • Pause/Resume the song
  • Stop and go to low power mode
  • Increase the volume
  • Decrease the volume
  • Select a specific sound (if exists)

The basic hardware is shown on the next image below.

DSC02670

The connections are made with the schematic used above and the STM32F030R8 microcontroller nucleo development board.  For this application i use the Port C, bits 0 to 3 for make connections between the microcontroller and the module.

  • PC_0 pin as BUSY
  • PC_1 pin as DATA
  • PC_2 pin as CLK
  • PC_3 pin as RESET

Nucleo F030R8 SOMO 2 Nucleo F030R8 SOMO

DSC02675 DSC02671 DSC02673
Finally I made a library code that you can get from my mbed repository.  You can get a preview of it from the code below.  If you want further documentation, please visit the mbed project.

/*
*******************************************************************************
*                              CERES CONTROLS
*                         PANAMA, REPULIC OF PANAMA
*
*  File          : main.cpp
*  Programmer(s) : Rangel Alvarado
*  Language      : ANSI-C
*  Description   : Main file for SOMO-14D (version 1) terminal controller.
*
*  Note          : The SOMO-14D is a tiny Audio-Sound module that can 
*                  play back pre-stored audio files such as voice and music 
*                  from a micro-SD memory card.
*
*  Warning       : Tested only on a STM32F030R8 mbed board.
*                  Software must have to do a call on
*                  - MsgRxISR()
*                  - SOMO14DISR()
*
*  Usage         : 1 - Open a terminal program like CoolTerm in 9600,8N1
*                  2 - Use only the following commands
*                      List of available commands:
*                      p       play the current song
*                      h       hold the current song
*                      n       play the next song in the queue
*                      r       play the previous song in the queue
*                      a <num> set audio to a specific song, 511 > num > 0
*                              i.e.   num = 0010
*                      +       set volume up, max 8 levels
*                      -       set volume down, max 8 levels
*
*  ----------------------------------------------------------------------------
*  HISTORY
*   DD MM AA
*   09 03 15    Created.
*   09 03 15    Modified.
*   12 03 15    Import to mbed platform.
*******************************************************************************
*/
 
/*
*******************************************************************************
*                                              INCLUDE FILES
*******************************************************************************
*/
 
#include "includes.h"                      /* Include all header files       */
 
 
/*
*******************************************************************************
*                              CONSTANTS AND MACROS
*******************************************************************************
*/
 
enum SOMO_ACTION {PLAY  = 'p', HOLD  = 'h',/* The list of available commands */
                  STOP  = 's', NEXT  = 'n', 
                  PREV  = 'r', STAU  = 'a', 
                  VOLUP = '+', VOLDN = '-'
                 };
 
 
/*
*******************************************************************************
*                                            FUNCTION PROTOTYPES 
*******************************************************************************
*/
                                 
void SOMOManageAction(INT8U nbytes);       /* Check will action be performed */
void SOMO14DISR(void);                     /* Interrupt routine of busy pin  */
void MsgRxISR(void);                       /* Interrupt routine of rx char   */
 
                                 
/*
*******************************************************************************
*                                MAIN FUNCTION 
*******************************************************************************
*/                               
                                 
int main() {
  INT8U action;                             /* Variable for action command    */
    
    
    
  action   = 0;                             /* Set action initially to 0      */
  SOMO14DInit(SOMO14DISR);                  /* Set up the sound module pins   */
  MsgBufInit();                             /* Initialize the buffer          */
  MsgRxISRCfg(MsgRxISR);                    /* Attach Rx IRQ function         */
  MsgPutLine((INT8U *)"SOMO Waiting for commands\r"); /* Hello Message        */
  MsgPut('>');                              /* Waiting a command sign         */
  while(1) {                                /* Repeat forever                 */
    if (!MsgRxBufEmpty()) {                 /* If there is something Received */
      action = MsgGetChar();                /* Get the action                 */
      SOMOManageAction(action);             /* Check which action to perform  */
    }
  }
}

Finally i gave to you some old videos of the working module on this playlist.

And in this video i give you a brief explanation in how to use the serial interface.  By the way, I am using CoolTerm at 9600,8N1.

Permanent link to this article: http://cerescontrols.com/projects/audio-sound-module-library-for-the-somo-14d-version-1/

1 ping

  1. Play Audio with the SOMO-14D Module » Ceres Controls

    […] Audio Sound Module Library for the SOMO-14D (Version 1) […]

Leave a Reply

Your email address will not be published. Required fields are marked *