Grove Speech Recognizer with K64F

Hi everyone!

I’m working with the Grove Speech Recognizer and the FRDM K64F with the Grove Base Shield v2 for connection. The datasheet says that the speech recognizer returns a value between 1 and 22 and examples use the Arduino SoftwareSerial library.

Is there a SoftwareSerial in mbed?

If not, how do I get the return value?

Thank you!

DigitalIn only reads 0 or 1. you need AnalogIn for different values.

Thank you for you quick response. I’m trying to use AnalogIn now but I’m confused about how to convert the analog value to its corresponding digital value?


are you sure with what you exactly want?

The sensor seems to be connected to digital pins but it communicates over UART (default baudrate: 9600) probably. Because in the example according to Grove - Speech Recognizer - Seeed Wiki ( (scroll down to an example code for Arduino) is used a SoftwareSerial library.
So you can not use AnalogIn or DigitalIn.

Just try to connect the sensor to an UART of your board and check the output via some Mbed API - UnbufferedSerial or BufferedSerial
I do not have this hardware so I can not test it but you will see.

For code click here
#include "mbed.h"
#define SERIAL_RX_PIN  D2
#define SERIAL_TX_PIN  D3
BufferedSerial serial(SERIAL_RX_PIN,SERIAL_TX_PIN);
DigitalOut led(LED1);
const char *voiceBuffer[] =
    "Turn on the light",
    "Turn off the light",
    "Play music",
    "Turn on the TV",
    "Turn off the TV",
    "Increase temperature",
    "Decrease temperature",
    "What's the time",
    "Open the door",
    "Close the door",
    "Mode 1",
    "Mode 2",

int main(){
    char buf;
    while(true) {
        if (uint32_t num =, sizeof(buf))) {
            // Toggle the LED.
            led = !led;
            printf("Result - %s\n", voiceBuffer[buf - 1]);

BR, Jan

Thank you so much for you response! I tried with UART but I’m getting 0s all the time.

BufferedSerial speech(PTC17, PTC16);
buf = speech.getc(); //the buffered library does not have read, so I used getc.

I tried printing buf as character and int. %c gives nothing and %d just prints 0.

Basically, the module is recognizing the command whether it’s connected to UART, digital, or analog, but I’m not able to read it from my computer.

Is there any other way to read the values?

Module’s chip ISD9160 send you the result over UART so there is nothing else.

You have no read(...) method because you use an old version of MbedOS, but getc() is also OK.
But try to change this

BufferedSerial speech(PTC17, PTC16);

to this

Serial speech(PTC17, PTC16);

and verify your connection. If connection is ok and the module is not broken, it must work.

BR, Jan