Talking Arduino

Introduction: Talking Arduino

About: An Electronics engineer and a hobbyist. I love to keep experimenting with microcontrollers.

Hello guys, welcome to a new instructable. Have you guys ever used google home or alexa speakers? Aren't they great and fun to use? Have you ever thought of making a low end version of such a device using Arduino?

Well if yes, then today we will make a talking Arduino. It won't be as good as alexa or google home is but its great to take our Arduino skills to next level. Note : It will only play the clips which you stored on the SD card. So if you are looking for something fancy, I am sorry the Arduino is not capable of that without the use of some speech recognition modules (which are costly). This brings me to the part that this project can be made under 1000 INR i.e approx 14 USD.

So let's have some fun with this project.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Gather the Supplies

I would suggest you to buy the components from UTSource.net . They provide electronic components and modules at very affordable rates. Also the quality is quite good. If you are a PCB Designer and looking for some PCB Services then they also provide PCB's up to 16 layers. Do check them out !!!

Let's take a look at the modules we will be using -

1. Arduino Uno Board

2. Breadboard

3. SD Card Module

4. HC-05 Bluetooth Module

5. Audio Jack

6. Led And 220 Ohm Resistor

7. Header Wires

8. Any Speaker With Built-in Amplifier And An Aux Cable

Step 2: Circuit Diagram

Follow the circuit diagram shown above to make the connections. Both the Sd card module and the Hc-05 module are powered using Arduino's 5V. Also they share a common ground with Arduino.

To avoid the problem while uploading the code I used the Software Serial Library. Because of which I connected the TX pin of HC-05 to D5 of Arduino and the RX pin to D6. These were the Bluetooth connections.

Now coming on to the SD Card Module. Connect the MOSI pin to D11, the MISO pin to D12, the SCK pin to D13 and lastly the CS pin to D4 of the Arduino.

In order to connect the wires to the Audio Jack you need a soldering iron. Connect the right and left channel of the jack together and connect them to D10 of the Arduino. Connect the audio jack's ground to that of the Arduino.

To just make it a bit more realistic I added a led to digital pin 8.

That's it the connections are done.

Step 3: Making the Audio Files & Downloading the Bluetooth Voice Control App

The TMRpcm library I used in this project works only with .wav type of files.

You can record your audio in Mp3 format and then convert it into .wav format from THIS website.

Refer the image above to do the settings of the audio.

If you want to use audio like the one I used in this project then Click on This Link . This website allows you to convert text into speech. There are various languages and accents to choose from.

I have also attached the clips I used in this project.

Extract the rar file and copy paste all the .wav audio files to your SD card.

Download and install the Bluetooth voice control application by Nitin Pandit from the Play Store onto your smartphone.

Link to download the application is given HERE

Now there is just one thing remaining.

Step 4: Coding

The code for this project is shown below. You can also download the .ino file directly.

Now before compiling make sure you have installed the TMRpcm library by TMRh20. Without this library the code won't compile. Also a huge thanks to them for making this library.

#include <SoftwareSerial.h><br>#include "SD.h"
#define SD_ChipSelectPin 4
#include "TMRpcm.h"
#include "SPI.h"
TMRpcm tmrpcm;
SoftwareSerial bluetooth(5, 6);//tx,rx
const int led = 8;
String value;
void setup()
{
  tmrpcm.speakerPin = 10;
  Serial.begin(9600);
  bluetooth.begin(9600);
  if (!SD.begin(SD_ChipSelectPin)) 
  {
  Serial.println("SD fail");
  return;
  }
  pinMode(led,OUTPUT);
  digitalWrite(led,LOW);
  //tmrpcm.setVolume(5);
  //tmrpcm.play("hello.wav"); //Used for testing(Do not include in final code)
  //delay(1000);
}
void loop()
{
  if (bluetooth.available())
   {
    value = bluetooth.readString();
    if (value == "hello")
    {
      tmrpcm.setVolume(5);
      tmrpcm.play("hello.wav"); 
      delay(1000);
    }
    if (value == "could you please turn on the led")
    {
      digitalWrite(led,HIGH);
      tmrpcm.setVolume(5);
      tmrpcm.play("ledon.wav"); 
      delay(1000);
    }
    if (value == "turn off the led")
    {
      digitalWrite(led,LOW);
      tmrpcm.setVolume(5);
      tmrpcm.play("ledoff.wav"); 
      delay(1000);
    }
    if (value == "are you similar to alexa")
    {
      tmrpcm.setVolume(5);
      tmrpcm.play("alexa.wav"); 
      delay(1000);
    }
    if (value == "i am sorry")
    {
      tmrpcm.setVolume(5);
      tmrpcm.play("sorry.wav"); 
      delay(1000);
    }
    if (value == "would you like to say something")
    {
      tmrpcm.setVolume(5);
      tmrpcm.play("sub.wav"); 
      delay(1000);
    }
   }
}

Now upload the code to your Arduino Board.

Lastly, connect the speaker to the Audio Jack and you are good to go.

Attachments

Step 5: Working Video of the Project

You can watch the working video of this project above. I tried to make some conversation with the Arduino board but Its (she's) mad at me because I asked her about Alexa. Something was burning there ! Do watch the video above with full volume as the audio quality is bad when recorded by my phone. If you like the projects which I make then please show your support by sharing them. Also follow me here to get updates on the projects I make. That's it for today. Will be back soon with another project.

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions