1. WTV020-SD 오디오 재생 모듈

SD 카드에 있는 오디오 파일을 재생해주는 모듈입니다. Ebay 등에서 쉽게 구할 수 있는 MP3 audio play 모듈인데 가격이 저렴해서 유용하게 사용할 수 있지만 사용법에 대한 정보가 많지 않아서 자료를 정리해 봤습니다. (아직 제품 입수가 안되서 실제 동작 및 문제점 확인을 못했습니다. 자료 참고만 하세요.)

이 모듈은 WTV020-SD-16P (혹은 WTV020-SD-20S) 칩을 사용하고 칩의 버전이 여러개 있지만 사용법은 거의 비슷하다고 합니다. 먼저 이 모듈의 스펙, 특징입니다.

  • Support plug-largest-capacity of 1G SD card;
  • Automatically identify audio files;
  • Can load WAV audio at 6KHz ~ 16KHz sample rate;
  • Can store up to 512 Section voice;
  • Support for micro-processor and key control;
  • With power-down save operation data function;
  • Support combination of documents playback, including the mute combination;
  • Quiescent Current: 16uA (do not insert SD card)
  • Support play 4 Bit ADPCM format file;
  • Can load AD4 audio at 6KHz ~ 32KHz and 36KHz sampling rate ;
  • 16bitDAC and PWM audio output;
  • With WTV020-SD-20S, WTV020-SD-16P two module types;
  • Can play any paragraph of the voice;
  • Can be loaded voice without software, just need to place voice into the SD card directly;
  • Operating voltage: DC2.5 ~ 3.6V;

32ohm 0.5w 가 스피커 제한이라고 합니다.

WAV, AD4 오디오 파일을 SD 카드에 넣어서 순서대로 재생이 가능한 것 같습니다. MP3, WAV 파일을 AD4 파일로 변환이 필요한 경우 아래 링크를 참고하세요.

http://www.buildcircuit.com/how-to-convert-mp3-and-wav-files-to-ad4-format-wtv020sd-tutorial/

SD 카드는 스펙에 최대 1GB 까지 지원한다고 되어 있는데 실제로는 더 큰 사이즈도 인식한다고 합니다. 오히려 1GB 카드가 인식이 안되고 2GB가 제대로 인식이 되는 경우도 있다고 하네요. 이 모듈에는 SD 카드가 포함되지 않으므로 가지고 있는 SD 카드에 따라서 동작할지 안할지는 장담할 수 없습니다. (뭐 이런;;) 만약 SD 카드 인식에 문제가 있다면 아래 링크를 참고해서 [Overwrite Formatting Option] 을 사용해서 포맷해보세요.

https://www.sdcard.org/downloads/formatter_3/

모듈은 다음과 같이 5가지의 모드를 지원합니다.

  1. MP3 control mode : play / stop, next, last, volume +- 등등을 지원
  2. Key control mode (3 voice) : play 키로 3개의 audio 파일을 순차적으로 재생. volume +- 조절 가능.
  3. Key control mode (5 voice) : 5개의
  4. Loop play mode : 전원이 들어오면 SD 카드의 모든 오디오 파일을 순차적으로 재생. 전원 종료시 종료 시점 저장.
  5. Two-line serial control mode : CLK, DI 데이터 라인으로 제어가능. 오디오의 어떤 address 든 지정해서 재생 가능.

사용자가 모드를 마음대로 바꿀 수 없는 것 같습니다. 따라서 구매할 때 미리 5. Two-line serial control mode 로 설정되어 있는지 확인을 해야 합니다. 5번 모드가 외부에서(아두이노 같은) 제어할 수 있도록 해주는 모드이고 온라인에서 쉽게 구할 수 있는 예제들이 이 모드를 사용하기 때문입니다.

2. 연결방법

serial 연결을 지원한다고해서 digital pin 2개에 연결해서 Software Serial 을 사용하는줄 알았는데.. 예제들은 I2C 핀에 연결해서 쓰네요.

Schematic

아두이노 A3 – reset 핀을 연결하고 아두이노 A4, A5 핀을 모듈의 P04, P05 핀에 연결합니다. 모듈의 스피커와 전원 핀(VDD)을 적당히 연결하고 동작 상태 감지를 위해서는 LED를 연결합니다. 오디오 모듈의 핀 배치 확인이 어려운 경우 아래 이미지를 참고해서 확인하세요.

PinConfig

동작 전압이 3v로 설정되어 있습니다. 5V로 동작시키기 위해서는 납땜 패드를 연결해줘야 합니다. 아래 동영상이 다이오드(N4407) 2개를 이용해서 5V로 동작시키는 영상이라고 합니다.

http://www.youtube.com/watch?v=IpUpi0OmHHI

3. 소스코드

컨트롤 코드를 라이브러리로 만들어서 공유해 주신 분이 있네요. [링크] 에서 라이브러리를 받아서 설치하고 예제코드를 실행해보시면 됩니다.

/*
 Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
 Created by Diego J. Arevalo, August 6th, 2012.
 Released into the public domain.
 */

#include <Wtv020sd16p.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

/*
Create an instance of the Wtv020sd16p class.
 1st parameter: Reset pin number.
 2nd parameter: Clock pin number.
 3rd parameter: Data pin number.
 4th parameter: Busy pin number.
 */
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void setup() {
  //Initializes the module.
  wtv020sd16p.reset();
}

void loop() {
  //Plays synchronously an audio file. Busy pin is used for this method.
  wtv020sd16p.playVoice(0);
  //Plays asynchronously an audio file.
  wtv020sd16p.asyncPlayVoice(1);
  //Plays audio file number 1 during 2 seconds.
  delay(5000);
  //Pauses audio file number 1 during 2 seconds.  
  wtv020sd16p.pauseVoice();
  delay(5000);
  //Resumes audio file number 1 during 2 seconds.
  wtv020sd16p.pauseVoice();
  delay(5000);  
  //Stops current audio file playing.
  wtv020sd16p.stopVoice();
  //Plays synchronously an audio file. Busy pin is used for this method.  
  wtv020sd16p.asyncPlayVoice(2);
  delay(2000);   
  //Mutes audio file number 2 during 2 seconds.
  wtv020sd16p.mute();
  delay(2000);
  //Unmutes audio file number 2 during 2 seconds.
  wtv020sd16p.unmute();
  delay(2000);    
  //Stops current audio file playing.
  wtv020sd16p.stopVoice();
}

아직 제품을 입수해서 테스트 해보지는 못했습니다!

제품 판매처 예시 : http://www.ebay.com/itm/160806790230?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

WTV020 chip manual : http://letsmakerobots.com/files/WTV020_manual_V1.3.pdf

모듈 동작 매뉴얼 : Emartee.com, 아두이노용 라이브러리, Buildcircuit.com

스테레오 오디오를 제공하는 고품질 모듈(PAM8803 칩) : 판매처 참고 링크, 아두이노용 라이브러리

$(KGrHqRHJDgE+BK88n6cBPw4h3!o,Q~~60_12