Voice to Arduino: Control LEDs Using MIT Speech Recognizer





Introduction: Voice to Arduino: Control LEDs Using MIT Speech Recognizer

Hello, everybody!!! It has been some time I had not updated my post here. Today I would like to share with you guys an experiment I made. I am going to control LEDs using MIT app inventor speech recognizer. Oh before I forget, I had also started a blog where I post some other Arduino Experiments. Feel free to visit to my blog at


Ok now, let's see what is needed to accomplish this experiment.

Step 1: Items Needed

The Items needed for this experiment are as follows:


1.Arduino UNO

2.LED x 4

3.Resistors x4 (recommended but not used for this experiment)

4.Male to male to jumper

5.Android Smartphone



1.Arduino IDE

2.MIT app inventor

Well, that wraps up for the items needed. On to the next step!!!!

Step 2: Circuit Assembly!!!!

Well, the circuit assembly is not difficult. The circuit consists only of LEDs, resistors, HC-06 and Arduino. The long "leg" of the LED will be connected to the pinouts while the shorter "led" will be connected to the GND. For the HC-06, the VCC is connected to 5V, GND to GND, RX of HC-06 to Arduino TX, while TX of HC-06 to Arduino RX. From here I will divide the codes into two parts, MIT and Arduino. First let's see the MIT code.

Step 3: MIT App Inventor Code Block

The important aspect of this app is that it implements the Speech recognizer function alongside the Clock and the Bluetooth client function. A google Speech recognizer(you need to be connected to the internet) will be activated when the speak button is pressed. Whatever spoken will be shown in the label "What do you speak" and be sent to Arduino. The arduino will do the rest of the processing.

Step 4: Arduino Code

The Arduino code is pretty simple as shown below:

int led1 = 8;
int led2 = 9;

int led3 = 10;

int led4 = 11;//change led position accordingly

int value = 0;//initial serial read value

void setup()

{ Serial.begin(9600);//this is important. the baud rate between arduino bluetooth and smartphone

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);

pinMode(led4, OUTPUT);


void loop()



{//if serial reading is available

delay(1000);//delay for a second, avoid overloading

value = Serial.read(); //value = serial value(led value)

Serial.print(value);//print the serial value


if (value == 1)//the value which corresponds the MIT appinventor 2 byte sent. change accordingly to your own value here and MIT appinventor 2 code block







if (value == 2)







if (value == 3)







if (value == 4)










Upload the Arduino code to Arduino UNO board (remember to unplug the TX and RX while uploading and plug in back after uploading). Download the apk file from MIT and install it in the android smartphone and test the experiment. The sample video of this experiment can be seen in the link below:

Well,that's all from me. Hope to see you guys again in near future!!



  • Epilog Challenge 9

    Epilog Challenge 9
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge

We have a be nice policy.
Please be positive and constructive.




if i wanted to send words what alteration would need to be made in the arduino code

When I hit reply it didn't show your latest comment: "Hi, I think I kind of did what you were asking. Safe to say it works!!! You can see it in my blog:http://halim930112.blogspot.my/"

I checked it out and it's brilliantly simple. Start adding more and more functionality and string parsing and you could make this so flexible and dynamic!

Does Hc-06 work with iPhone?

I think HC-06 is not supported with iPhone as iPhone does not have Serial Protocol over Bluetooth

Can you only send it integer values? What about strings?

I wonder how hard it would be to embed the android phone into, for example, a virtual presence device and give it verbal control commands like, "rotate left 90 degrees," "move forward three meters," "power down," "report battery status," etc...

In my opinion, i think it could be done. In this experiment, I had initialized the values as integer, maybe ( I had not try it yet) if we change the initialization into string/text, we might be able to send text commands. Thanks for the comment though, you gave me an Idea on what to do next.

Oh, I really look forward to seeing what you come up with!

Hi, I think I kind of did what you were asking. Safe to say it works!!! You can see it in my blog:


interesting. I have used the voice recognition on MIT app inventor as well. But I dont think you need to be connected to the internet while using the Speech recognizer in the created app. So I tried my app with the WiFi switched off and that works just as fine.
Anyway, I used the same voice recognition as you did so I am sure your app also works without being connected to the internet as it picks up the speechrecognizer on your phone