Learn, Make and Invent
  • Educational STEM Products
  • Early Primary
    • Bee Bot
    • Ozobot
    • Matatalab Coding Set
    • Neuron coding blocks
    • Osmo ios
    • Cubetto
    • Sphero Bolt
  • Primary
    • Codey Rocky AI Robot
      • Tutorials
        • Introduction
        • Get Started
        • Upload Mode
        • Emotion Blocks
        • IoT Blocks
        • Neuron Blocks
        • IR Remote
        • Use Python
      • Examples
      • Block Reference
        • Looks
        • Lighting
        • Speaker
        • Action
        • Sensing
        • Infrared
        • Events
        • Control
        • Operators
      • Python API Reference
        • Python API for Codey
        • Python API for Rocky
        • Python API for Third-Party Libraries
        • Python API for Neuron Extension Modules
      • FAQs
    • Edison
    • mBot
      • Introduction
      • Building mBot
      • Connect mBot
      • Preset Modes
    • Microbit
    • Merge Cube
    • Bare Conductive Board
    • Tello Edu
  • Secondary
    • Microbit Grove Inventor Kit
    • mBot Ranger
    • Arduino Science Kit
    • Arduino Starter Kit
    • Arduino Grove Starter Kit
    • CoDrone
  • Senior Secondary
    • CoDrone Pro
    • Arduino CTC Go
  • Digital Tech Kits
    • Digital Tech Kit for K-2
    • Digital Tech Kit for 3-5
    • Digital Tech Kit for 6-8
    • Digital Tech Kit for 9-10
  • Makerspace
    • Otto DIY
      • User guide
      • Assembly Instructions
        • Builder Kit
        • Builder Kit +
        • Builder Kit Humanoid
        • Builder Kit E
      • OTTO enclosures 3D and laser cut files
      • Code
    • Curcuitmess
      • Circuitmess Ringo
        • Inside the Box
        • Tools Needed
        • Soldering the parts
        • Assembling the parts
        • Set up your Ringo
  • Grove Ecosystem
    • Grove System
    • Grove Modules
      • Actuators
        • Atom Node
        • Grove 2 Coil Latching Relay
        • Grove Button
        • Grove Buzzer
        • Grove Dry Reed Relay
        • Grove EL Driver
        • Grove Haptic Motor
        • Grove I2C Motor Driver V1.2
        • Grove I2C Motor Driver V1.3
        • Grove I2C Motor Driver
        • Grove LED Matrix Driver v1.0
        • Grove Mini Fan
        • Grove Mini I2C Motor Driver v1.0
        • Grove MP3 v2.0
        • Grove Recorder v3.0
        • Grove Relay
        • Grove Serial MP3 Player
        • Grove Servo
        • Grove Solid State Relay
        • Grove Speaker
        • Grove Variable Color LED
        • Grove Vibration Motor
        • Grove Water Atomization
      • Display
        • Grove 4 Digit Display
        • Grove Circular LED
        • Grove LCD RGB Backlight
        • Grove LED Bar
        • Grove LED Socket Kit
        • Grove LED String Light
        • Grove LED Strip Driver
        • Grove OLED Display 0.96inch
        • Grove OLED Display 1.12inch
        • Grove Red LED
        • I2C LCD
      • Sensors
        • Grove 3 Axis Analog Accelerometer
        • Grove 3 Axis Compass V1.0
        • Grove 3 Axis Digital Accelerometer 1.5g
        • Grove 3 Axis Digital Accelerometer 16g
        • Grove 3 Axis Digital Accelerometer 400g
        • Grove 3 Axis Digital Gyro
        • Grove 6 Axis Accelerometer And Compass V2.0
        • Grove 6 Axis Accelerometer And Gyroscope
        • Grove 80cm Infrared Proximity Sensor
        • Grove Air Quality Sensor v1.3
        • Grove Alcohol Sensor
        • Grove Barometer Sensor BME280
        • Grove Barometer Sensor BMP180
        • Grove Barometer Sensor BMP280
        • Grove Barometer Sensor
        • Grove Barometer High Accuracy
        • Grove Chest Strap Heart Rate Sensor
        • Grove CO2 Sensor
        • Grove Collision Sensor
        • Grove Digital Infrared Temperature Sensor
        • Grove Digital Light Sensor
        • Grove Dust Sensor
        • Grove Ear clip Heart Rate Sensor
        • Grove Electricity Sensor
        • Grove Finger clip Heart Rate Sensor with shell
        • Grove Finger clip Heart Rate Sensor
        • Grove Fingerprint Sensor
        • Grove Gas Sensor O2
        • Grove Gas Sensor
        • Grove HCHO Sensor
        • Grove High Temperature Sensor
        • Grove IMU 10DOF v2.0
        • Grove Infrared Receiver
        • Grove Line Finder
        • Grove Temperature and Humidity Sensor Pro
        • Grove Temperature And Humidity Sensor
        • Grove Voltage Divider
        • Grove Water Sensor
        • Grove XBee Carrier
      • Communication
        • Grove High Precision RTC
        • Grove LoRa Radio
        • Grove NFC Tag
        • Grove NFC
        • Grove 125KHz RFID Reader
        • Grove 315MHz RF Kit
        • Grove 433MHz Simple RF Link Kit
        • Grove Bee Socket
        • Grove BLE v1
        • Grove BLE dual model v1.0
        • Grove DMX512
        • Grove GPS
        • Grove I2C ADC
        • Grove I2C FM Receiver
        • Grove Protoshield
        • Grove RJ45 Adapter
        • Grove Screw Terminal
        • Grove Serial Bluetooth v3.0
        • Grove Serial RF Pro
        • Grove UART Wifi
      • Others
        • Grove Base Booster Pack
        • Grove Base Cape for BeagleBone v2
        • Grove Base HAT
        • Grove Base Shield for NodeMCU V1.0
        • Grove Base Shield for Photon
        • Grove Breakout for LinkIt Smart 7688 Duo
        • Grove Cape for BeagleBone Series
        • Grove Indoor Environment Kit for Edison
        • Grove Inventor Kit for microbit
        • Grove IoT Developer Kit Microsoft Azure Edition
        • Grove IoT Starter Kits Powered by AWS
        • Grove Recorder
        • Grove Shield for Intel Joule
        • Grove Smart Plant Care Kit
        • Grove Speech Recognizer Kit for Arduino
        • Grove Starter Kit for BeagleBone Green
        • Grove Starter Kit for IoT based on Raspberry Pi
        • Grove Starter kit for LinkIt Smart7688 Duo
        • Grove Starter Kit v3
        • Grove AND
        • Grove Base Shield for IOIO OTG
        • Grove BlinkM
        • Grove DC Jack Power
        • Grove Differential Amplifier v1.0
        • Grove Differential Amplifier v1.2
        • Grove GSR Sensor
        • Grove I2C Hub
        • Grove Joint v2.0
        • Grove Mega Shield
        • Grove Mini Camera
        • Grove Mixer Pack V2
        • Grove MOSFET
        • Grove Node
        • Grove NOT
        • Grove NunChuck
        • Grove OR
        • Grove PS 2 Adapter
        • Grove Recorder v2.0
        • Grove Serial Bluetooth
        • Grove Serial LCD V1.0
        • Grove Single Axis Analog Gyro
        • Grove SPDT Relay 30A
        • Grove Starter Kit for LinkIt ONE
        • Grove Starter Kit for mbed
        • Grove Toy Kit
        • Grove Wrapper
        • GrovePi Plus
  • Arduino
    • Graphical coding with Grove sensors
    • Arduino Comparison Sheet
    • Tutorials
      • Setup Arduino Every board in Arduino IDE
      • Arduino Cloud
      • Installing Libraries
      • Motor, Servo for Arduino
      • Sensor for Arduino
    • Examples
      • Genuino 101
        • Prerequisites
        • Shock / Tap Detection
        • LED Control Over Bluetooth
        • Board Orientation Detection
        • Pedometer – Step Counting Over Bluetooth
        • Timer Switch
        • Appendices
          • Appendix A
          • Appendix B
  • micro:bit
    • Examples
      • Servo with micro:bit
  • Halocode
    • Introduction
    • Get Started
    • Upload Mode
    • Speech Recognition
    • User Cloud Message
    • Use Python with HaloCode
    • Code with Mu A Simple Python Editor
      • Examples
        • Basic Project
          • Color Mixer
          • Compare Strength
          • Connect Wi-Fi
          • Control Multiple HaloCodes via LAN
          • Energy Ring
          • Make a Smiling Face with the LED Ring
          • Make a Volume Detector
          • Press the Button to play LED Animation Meteor
          • Rainbow Button
        • Level Up
          • Control HaloCode's LEDs via Voice Command
          • Remote Control
          • Make HaloCode the Steering Wheel of the Car on Stage
          • HaloCode's Remote Control Deck
          • Emotion Detector
          • Deep Learning and Facial Recognition
          • Use Global Variable to Interact with Sprites
        • Workshop
          • A Kitten with Blinking Eyes and a Waving Tail
          • Pedometer
          • Smart Home
  • Troubleshooting
    • Matatalab
      • Matatalab Upgrade
        • Pre Upgrade Instructions - MatataBot
        • MatataBot Upgrade
        • Matata Tower Upgrade
        • Resources for Upgrade
      • Matatalab Pairing
Powered by GitBook
On this page
  • Part List
  • Application
  • define BIT_LEN 0
  • define BIT_START_H 1
  • define BIT_START_L 2
  • define BIT_DATA_H 3
  • define BIT_DATA_L 4
  • define BIT_DATA_LEN 5
  • define BIT_DATA 6
  • define SOFTSERIAL_RX_PIN 5
  • define SOFTSERIAL_TX_PIN 6
  • include
  • include
  • define SOFTSERIAL_RX_PIN 5
  • define SOFTSERIAL_TX_PIN 6
  • include
  • include "DS1307.h"
  • include
  • include
  • define SOFTSERIAL_RX_PIN 5
  • define SOFTSERIAL_TX_PIN 6
  • Resource

Was this helpful?

  1. Grove Ecosystem
  2. Grove Modules
  3. Others

Grove Speech Recognizer Kit for Arduino

PreviousGrove Smart Plant Care KitNextGrove Starter Kit for BeagleBone Green

Last updated 5 years ago

Was this helpful?

The Grove Speech Recognizer Kit for Arduino is designed for prototype of Smart Home which includes some basic home elements such as Speech Recognizer, Infrared Emitter. You can learn the functions and applications of Speech Recognizer quickly via this kit, the guideline shows some common demos, let's say you can play music via your speak command 'Play music', or turn on the light according to the corresponding command.

Part List

  1. Grove - Speech Recognizer SKU:101020232

Application

How to turn on the TV

Sometimes, we want to control something by our voice, such as TV, air condition. Those devices are controlled by Infrared Remote controller, so we need to know what the code of each button of infrared remote controller first, and then put the code under our program. Finally your voice could trigger those button codes and you can control those devices like infrared remote controller.

Before create this demo you should prepare some necessary components:

  • Grove - Infrared Receiver

  • Grove - Infrared Emitter

  • Grove - Speech Recognizer

  • Base Shield

  • Arduino UNO

  • Infrared Remote controller

Get code of a infrared remote controller via Grove - Infrared Receiver

  • Now open the example file of "recv" : File --> Sketchbook --> libraries --> IRSendRev --> recv.

  • Upload the program to your Arduino UNO.

  • Plug Base Shield onto the Arduino UNO,and plug the Grove - Receiver onto the D2 port of Base Shield.

const int pinRecv = 2;

Also you can change another port while modifying the definement of pin. </dd></dl>

  • Open the monitor of Arduino UNO.

Press a button of any Infrared Remote Controller, you'll get the detailed information code of the button, see following:

Write down the detailed information of the button you want to press. Following are the information of a button:

+------------------------------------------------------+
LEN = 9
START_H: 179    START_L: 88
DATA_H: 11    DATA_L: 33

DATA_LEN = 4
DATA: 0x80    0x7E    0x10    0xEF
DATA: 128    126    16    239
+------------------------------------------------------+

Modify the IRSend program

Now we can use the previous information code of a button.

  • Open the example file of "send" : File --> Sketchbook --> libraries --> IRSendRev --> send.

  • Upload the program to your Arduino UNO.

  • Plug Base Shield onto the Arduino UNO,and plug the Grove - Receiver onto the D3 port of Base Shield.

First we need modify the default information of the button:

unsigned char dtaSend[20];

void dtaInit()
{
  ............
}

Modify those information according to the previous one you wrote:

unsigned char dtaSend[20];

void dtaInit()
{
    dtaSend[BIT_LEN]        = 9;            // all data that needs to be sent
    dtaSend[BIT_START_H]    = 179;            // the logic high duration of a button
    dtaSend[BIT_START_L]    = 88;            // the logic low duration of a button
    dtaSend[BIT_DATA_H]     = 11;            // the logic "long" duration in the communication
    dtaSend[BIT_DATA_L]     = 33;            // the logic "short" duration in the communication

    dtaSend[BIT_DATA_LEN]   = 4;            // Number of data which will sent. If the number is other, you should increase or reduce dtaSend[BIT_DATA+x].

    dtaSend[BIT_DATA+0]     = 128;            // data that will sent
    dtaSend[BIT_DATA+1]     = 126;
    dtaSend[BIT_DATA+2]     = 16;
    dtaSend[BIT_DATA+3]     = 239;
    //dtaSend[BIT_DATA+4]     = 192;
    //dtaSend[BIT_DATA+5]     = 63;
}

You can observe that:

DATA_LEN = 4

So you can note or delete those two lines.

   //dtaSend[BIT_DATA+4]     = 192;
    //dtaSend[BIT_DATA+5]     = 63;

Of course you can also define many buttons:

#include <IRSendRev.h>

#define BIT_LEN         0
#define BIT_START_H     1
#define BIT_START_L     2
#define BIT_DATA_H      3
#define BIT_DATA_L      4
#define BIT_DATA_LEN    5
#define BIT_DATA        6

const int ir_freq = 38;

unsigned char OpenTV[20];
unsigned char CloseTV[20];
unsigned char IncreaseTemp[20];
unsigned char DecreaseTemp[20];

void OpenTVInit()
{
    OpenTV[BIT_LEN]        = 11;
    OpenTV[BIT_START_H]    = 179;
    /*............ omit ............*/
}

void CloseTVInit()
{
    CloseTV[BIT_LEN]        = 11;
    CloseTV[BIT_START_H]    = 179;
    /*............ omit ............*/
}

void IncreaseTempInit()
{
    IncreaseTemp[BIT_LEN]        = 11;
    IncreaseTemp[BIT_START_H]    = 179;
    /*............ omit ............*/
}

void DecreaseTempInit()
{
    DecreaseTemp[BIT_LEN]        = 11;
    DecreaseTemp[BIT_START_H]    = 179;
   /*............ omit ............*/
}

void setup()
{
    OpenTVInit();
    CloseTVInit();
    IncreaseTempInit();
    DecreaseTempInit();
}

void loop()
{
    IR.Send(OpenTV, 38);
    delay(200);
    IR.Send(CloseTV, 38);
    delay(200);
    IR.Send(IncreaseTemp, 38);
    delay(200);
    IR.Send(DecreaseTemp, 38);

    delay(2000);
}

Add Speech Recognizer to your IRSend program

  • It's very simple to use Speech Recognizer alone, please see the wiki of it first.

Command

Return Value

Turn on the light

1

Turn off the light

2

Play music

3

Pause

4

Next

5

Previous

6

Up

7

Down

8

Turn on the TV

9

Turn off the TV

10

Increase temperature

11

Decrease temperature

12

What's the time

13

Open the door

14

Close the door

15

Left

16

Right

17

Stop

18

Start

19

Mode 1

20

Mode 2

21

Go

22

The following example uses two commands: "Turn of the TV" and "Turn off the TV"

  • After reading, we can embed the program of Speech Recognizer in the IRSend program. See the following completed program:

    ```

    include

    include

/======== IR type ========/

define BIT_LEN 0

define BIT_START_H 1

define BIT_START_L 2

define BIT_DATA_H 3

define BIT_DATA_L 4

define BIT_DATA_LEN 5

define BIT_DATA 6

const int ir_freq = 38; // 38k

/ ======== How many IR buttons you wanna send ========/

unsigned char OpenTV[20]; unsigned char CloseTV[20];

/========= Choose the pins of Speech Recognizer ==========/

define SOFTSERIAL_RX_PIN 5

define SOFTSERIAL_TX_PIN 6

SoftwareSerial speech(SOFTSERIAL_RX_PIN,SOFTSERIAL_TX_PIN);

/ ======= How to write the IR data ========/ / ==== You can get those data via IR Recevier ==== /

void OpenTVInit() { OpenTV[BIT_LEN] = 9; // all data that needs to be sent OpenTV[BIT_START_H] = 180; // the logic high duration of "OpenTV" OpenTV[BIT_START_L] = 88; // the logic low duration of "OpenTV" OpenTV[BIT_DATA_H] = 11; // the logic "long" duration in the communication OpenTV[BIT_DATA_L] = 33; // the logic "short" duration in the communication

OpenTV[BIT_DATA_LEN]   = 4;            // Number of data which will sent. If the number is other, you should increase or reduce dtaSend[BIT_DATA+x].

OpenTV[BIT_DATA+0]     = 50;            // data that will sent
OpenTV[BIT_DATA+1]     = 166;
OpenTV[BIT_DATA+2]     = 80;
OpenTV[BIT_DATA+3]     = 175;

}

void CloseTVInit() { CloseTV[BIT_LEN] = 9; // all data that needs to be sent CloseTV[BIT_START_H] = 178; // the logic high duration of "CloseTV" CloseTV[BIT_START_L] = 89; // the logic low duration of "CloseTV" CloseTV[BIT_DATA_H] = 10; // the logic "long" duration in the communication CloseTV[BIT_DATA_L] = 33; // the logic "short" duration in the communication

CloseTV[BIT_DATA_LEN]   = 4;            // Number of data which will sent. If the number is other, you should increase or reduce dtaSend[BIT_DATA+x].

CloseTV[BIT_DATA+0]     = 50;            // data that will sent
CloseTV[BIT_DATA+1]     = 166;
CloseTV[BIT_DATA+2]     = 168;
CloseTV[BIT_DATA+3]     = 87;

}

void setup() { OpenTVInit() CloseTVInit() Serial.begin(9600); speech.begin(9600); speech.listen(); }

void loop() { int a=0;

if(speech.available())
{
    a = speech.read();    // Read the return value from the Speech Recognizer
    switch (a)
    {
        case 9:                     //  if (return value) then send (IR data)
        IR.Send(OpenTV, 38);
        delay(1000);
        break;
        case 10:
        IR.Send(CloseTV, 38);
        delay(1000);
        break;
        default:
        break;
    }
}

}

###  How to control music

Watch the commands of Speech Recognizer, there're many commands which are related to music, such as "Play music", "Pause", "Stop", "Previous", "Next". So let's do this Speech Music Box!

Download necessary libraries from github: [Grove_Serial_MP3_Player_V2.0](https://github.com/Seeed-Studio/Grove_Serial_MP3_Player_V2.0)&lt;ref&gt;library, [Grove - MP3 v2.0](/Grove-MP3_v2.0)&lt;/ref&gt;, <font color="Red">pay attention to the path of your libraries: .../arduino/libraries </font>.

**Useful functions about Grove - MP3 v2**

There're some useful basic functions of Grove - MP3:

PlayPause(); // pause music PlayResume(); // restart a music PlayNext(); // next song PlayPrevious(); // previous song PlayLoop(); // loop all songs SetVolume(uint8_t volume); // set volume. default value is "0x0E", the range is 0x00 to 0x1E. IncreaseVolume(); // increase volume DecreaseVolume(); // decrease volume

But there're some special functions you need to pay attention:

*   SelectPlayerDevice(uint8_t device). _The default device value is 0x02, Select SD card as the player device._

SelectPlayerDevice(0x02);

*   SpecifyMusicPlay(uint16_t index). _play a song by name._
<dl><dd>Pay attention to the name of songs, you can set a name like following type:
</dd></dl>

![](https://github.com/SeeedDocument/Grove_Speech_Recognizer_Kit_for_Arduino/raw/master/img/Type_of_songs.png)

<dl><dd>So we can play the song "005" by this function:
</dd></dl>

SpecifyMusicPlay(5);

*   SpecifyfolderPlay(uint8_t folder, uint8_t index);   // play a song by name in a appointed folder
<dl><dd>Furthermore, sometimes we may play music in a new folder, the previous function comes in handy.
</dd></dl>

![](https://github.com/SeeedDocument/Grove_Speech_Recognizer_Kit_for_Arduino/raw/master/img/Form_of_folder.png)

!!!Note
    The folder index range is 01-99, so the folders’ name will only be any number 01 between 99. Pay attention to the number between 1-9, the name of folder should be added to 01-09.

So if we want to play the "005" in the folder "01", we can do this:

SpecifyfolderPlay(1,5);

*   Other attention:
<dl><dd>Each song has its length of time, so if you want to appoint songs one by one, there've two ways you can choose:
</dd></dl>

delay(length of time); // delay the length of time until the song is played out

while(QueryPlayStatus() != 0); // Return: 0: played out; 1: not play out

<dl><dd>Normally, we can use the latter. For example:
</dd></dl>

SpecifyMusicPlay(1); while(QueryPlayStatus() != 0); SpecifyMusicPlay(2); while(QueryPlayStatus() != 0); SpecifyMusicPlay(3); while(QueryPlayStatus() != 0);

**Integrated Program**

OK, let's embed Speech Recognizer and Grove - MP3 together. The following demo can control some MP3 functions: play music, pause music, continue music, next song, previous song.

*   Copy the program and upload it to your Arduino UNO.

*   Plug Base Shield onto the Arduino UNO,and plug the Grove - MP3 v2 onto the D2 port of Base Shield.

include

include

/** Define the pins of MP3 **/ SoftwareSerial mp3(2, 3);

/** Define the pins of Speech Recognizer **/

define SOFTSERIAL_RX_PIN 5

define SOFTSERIAL_TX_PIN 6

SoftwareSerial speech(SOFTSERIAL_RX_PIN,SOFTSERIAL_TX_PIN);

void setup() { mp3.begin(9600); speech.begin(9600); Serial.begin(9600); delay(100);

SelectPlayerDevice(0x02);       // Select SD card as the player device.
SetVolume(0x15);                // Set the volume, the range is 0x00 to 0x1E.

}

void loop() { int a=0; if(speech.available()) { a = speech.read(); // Read the return value from the Speech Recognizer switch (a) { case 3: // speech command : Play music SpecifyMusicPlay(1); // MP3: play the name of "001" break; case 4: // speech command : Pause PlayPause(); // MP3: pause music break; case 19: // speech command : Start PlayResume(); // MP3: continue music break; case 5: // speech command : Next PlayNext(); // MP3: play next song break; case 6: // speech command : Previous PlayPrevious(); // MP3: play previous song break; default: break; }

    delay(1000);
}

}

###  How to broadcast real-time

Did you use Grove - MP3 to broadcast real-time? Let's have a try via Speech Recognizer, Grove - MP3, and Grove - RTC.

**Adjust the real-time**

Download necessary libraries from github: <font color="Red">[RTC_DS1307](https://github.com/Seeed-Studio/RTC_DS1307)&lt;ref&gt;[library, Grove - RTC](/Grove-RTC)&lt;/ref&gt;, pay attention to the path of your libraries: .../arduino/libraries</font> .

*   Open the example file of "SetTimeAndDisplay" : File --&gt; Sketchbook --&gt; libraries --&gt; RTC_DS1307 --&gt; SetTimeAndDisplay.

*   Plug Base Shield onto the Arduino UNO,and plug the Grove - RTC onto the  I2C of Base Shield.

*   Set the right time of RTC.

clock.fillByYMD(2016,1,19);//May 23,2016 clock.fillByHMS(15,28,30);//15:28 30" clock.fillDayOfWeek(Mon);//Saturday

*   Upload the modified program to your Arduino UNO.

**Text-to-speech**

As all we known, it has 60 numbers while broadcasting time (0 ~ 59), and we can mouth some words before the MP3 broadcast the time (It's). So we need to add 61 sound files in SD Card.

<font color="Red">But there're some tips about SD card you need to pay attention to:</font>

*   Form of SD Card: FAT32.

*   Format SD Card before deleting any songs; Nothing should to do while adding any songs.

*   The sequence of playing is depended on the sequence of song addition in SD Card. _so if we want to play some songs in order, we need to add those songs in SD Card in order._

By the way, we have ranked 61 sound files in a folder, you can [download it](https://github.com/SeeedDocument/Grove_Speech_Recognizer_Kit_for_Arduino/raw/master/res/Sound_file.zip) and copy it to your SD Card. Of course you may need to format SD Card first.

<center>
<table>
<tr>
<th> Name of Sound File </th>
<th> <font color="Red">NO. of file in SD Card</font> </th>
<th> Voice Text
</th></tr>
<tr>
<td width="200px"> 000 </td>
<td width="200px"> 1th </td>
<td width="200px"> 0
</td></tr>
<tr>
<td width="200px"> 001 </td>
<td width="200px"> 2th </td>
<td width="200px"> 1
</td></tr>
<tr>
<td width="200px"> ... </td>
<td width="200px"> ... </td>
<td width="200px">  ...
</td></tr>
<tr>
<td width="200px"> 059 </td>
<td width="200px"> 60th </td>
<td width="200px"> 59
</td></tr>
<tr>
<td width="200px"> 060 </td>
<td width="200px"> 61th </td>
<td width="200px"> It's
</td></tr></table></center>

**Integrated Program and broadcast real-time**

*   Plug Base Shield onto the Arduino UNO; plug Grove - MP3 v2 onto the D2 port of Base shield; plug Grove - Speech Recognizer onto the D5 port of Base Shield; plug Grove - RTC onto the I2C port of Base Shield.

*   Copy the following codes on a new sketch of Arduino IDE and upload the program to Arduino UNO.

*   Say "HiCell, What's the time" , the MP3 will broadcast the real-time.

include

include "DS1307.h"

include

include

/* Define the pins of MP3 **/ SoftwareSerial mp3(2, 3);

/* Define the pins of Speech Recognizer **/

define SOFTSERIAL_RX_PIN 5

define SOFTSERIAL_TX_PIN 6

SoftwareSerial speech(SOFTSERIAL_RX_PIN,SOFTSERIAL_TX_PIN);

/* Define a object of DS1307 class **/ DS1307 clock;//define a object of DS1307 class

void setup () { mp3.begin(9600); speech.begin(9600); clock.begin(); Serial.begin(9600); delay(100);

SelectPlayerDevice(0x02); // Select SD card as the player device. SetVolume(0x15); // Set the volume, the range is 0x00 to 0x1E. }

void loop () { int a=0; speech.listen(); // start to receiver data from the software port of Speech Recognizer if(speech.available()) { a = speech.read(); // Read the return value from the Speech Recognizer if(a==13) { clock.getTime(); // get the real-time from Grove - RTC int b=1+clock.hour; // get hour data; because the 1th name of song is the voice "0" , so in order to get the voice "60" (it's) , the number of the name should be added 1. int c=1+clock.minute; // get hour data; because the 1th name of song is the voice "0" , so in order to get the voice "60" (it's) , the number of the name should be added 1.

  mp3.listen();   // start to receiver data from the software port of Grove - MP3
  SpecifyMusicPlay(61);   // The voice "It's" is the name of "61" song in the folder of SD card
  while(QueryPlayStatus() != 0);  // play next song before the previous song is played out
  SpecifyMusicPlay(b);  // play the name of "b" song in the folder of SD card
  while(QueryPlayStatus() != 0);
  SpecifyMusicPlay(c);  //  play the name of "c" song in the folder of SD card
  while(QueryPlayStatus() != 0);
}

} delay(1000); }

```

Resource

Download necessary libraries from github : ,pay attention to the path of your libraries: .../arduino/libraries

We can choose what buttons we need according to the table<ref>Table of return value, </ref> of return value of Speech Recognizer. Following is the table of return value:

Grove - MP3 v2.0
Grove – RTC
Base Shield
Grove - Infrared Receiver
Grove - Infrared_Emitter
IRSendRev
Grove - Speech Recognizer
Github: IRSendRev
Github: MP3
Github: RTC
Sound files of broadcast