Go Down

Topic: Wireless Audio Streaming and Speech Recognition (PART 1) (Read 9272 times) previous topic - next topic

msb4180

Jan 04, 2013, 09:49 pm Last Edit: Jan 04, 2013, 09:52 pm by msb4180 Reason: 1
In this project I connect my Arduino Board to a WiFly module (https://www.sparkfun.com/products/10822) from Roving Networks and stream audio to the PC, so that BitVoicer (http://www.bitsophia.com/BitVoicer.aspx) can perform speech recognition. By using a wireless module, I managed to add speech recognition features to my microcontroller without the need of a physical connection with the PC.

The LEDs do the same basic things they did in my last project (http://arduino.cc/forum/index.php/topic,138246.0.html), but now I eliminated the PC wire connection, so I can finally have a speech activated Arduino anywhere my wireless network reaches.

Here is the YouTube video of the project:

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

I used a WiFly module from Roving Networks (https://www.sparkfun.com/products/10822) because I read somewhere that it would work with the XBee Shield I had (https://www.sparkfun.com/products/9976). Unfortunately, I found out the hard way that a diode between the Arduino TX and the WiFly RX was blocking the signal. I had to rip out the diode and add a voltage divider between the TX/RX pins of the Arduino and the WiFly module because the RX pin of the WiFly is 3.3V tolerant and the Arduino TX works at 5V. It does not seem to be the best approach, but it worked and I was able to send and receive data from the module. I found out that Sparkfun released a new version of the XBee Shield (https://www.sparkfun.com/products/10854) and that the diode level shifter was replaced with a more robust MOSFET level shifter. This should solve the diode problem.

This is how my project looked like after I added the voltage divider:



I believe any of the following wireless modules could be used. You just have to find out which one of them best fits your needs:



The setup process of the WiFly module can be tricky, so I'm also adding a step-by-step tutorial on how to do it. In my case, I use a regular access point/router from D-Link to implement my private wireless network. This tutorial should work with any access point out there.


  • 1.   Disconnect your computer from any wireless network

  • 2.   Set the GPIO9 pin of the WiFly module to high (3.3V) at power up. This enables adhoc mode on the module. I used the 3.3V source from the Arduino board and an ordinary jumper wire. Right after the power up, remove the wire and follow the next steps. Module datasheet: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Wireless/WiFi/WiFly-RN-XV-DS.pdf

  • 3.   On your computer, search for available networks and connect to the WiFly module network (WiFly-GSX-XX). It may take a few seconds before your computer gets an IP address from the module.

  • 4.   Download and run a free software called TeraTerm (http://www.rovingnetworks.com/resources/download/86/Teraterm)

  • 5.   Enter the following settings and click on OK: IP Address: 169.254.1.1; TCP port: 2000; Service: Telnet; Protocol: IPv4

  • 6.   You should see the word "*HELLO*" on the screen

  • 7.   Type $$$ to enter command mode

  • 8.   Type scan and hit enter to scan for available access points

  • 9.   If your network uses WPA authentication, use the command set wlan phrase <string> to set the pass phrase. For WEP, set the key using the set wlan key <num> command. My network is WEP secured, so I had to use the second command. The problem is that the key must be entered ASCII/HEX encoded and it MUST have exactly 26 characters. I found this page that converts text to ASCII/HEX: http://www.string-functions.com/string-hex.aspx.

  • 10. Type set wlan ssid <XXXX>, where XXXX is the SSID of you network (look at the results of step 8 )

  • 11. Type save

  • 12. Type join <YOUR NETWORK> (look at the results of step 8 )

  • 13. The WiFly-GSX-XX will disappear from the windows network list

  • 14. Close Teraterm

  • 15. Reconnect your computer to your local wireless network

  • 16. Turn your Arduino board OFF and back ON

  • 17. Write down the IP number assigned to the WiFly module by your access point (usually, you can find this info on the access point DHCP page)

  • 18. Open Teratem using the new IP address and the other settings from step 5

  • 19. Type $$$ to enter command mode

  • 20. Type set comm close 0 and hit enter

  • 21. Type set comm open 0 and hit enter

  • 22. Type set comm remote 0 and hit enter

  • 23. Type set comm size 1460 and hit enter

  • 24. Type set comm time 1000 and hit enter

  • 25. Type set comm baud 115200 and hit enter (the same baud rate I used in my sketch)

  • 26. Type save and hit enter

  • 27. Type exit and hit enter

  • 28. Close Teraterm



Now your WiFly module should be able to communicate with BitVoicer and your PC. The WiFly user's manual can be downloaded here: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Wireless/WiFi/WiFly-RN-UM.pdf

This post ended up too big, so I had to split it into 2 posts. Here is the second part: http://arduino.cc/forum/index.php/topic,140766.0.html

#1
Jan 09, 2013, 10:29 pm Last Edit: Jan 09, 2013, 10:34 pm by BrunoCubi Reason: 1
Hi msb4180..
Congratulations, very interesting project!

I am doing a project like this.... I want to send data from my PC to Arduino Mega through the Wifly.. My module is RN 131-C..
When I set the communication TCP ( set comm timer 1000 or set comm match 65 ) I didn't get send packets.
Maybe because I didn't config the size of frame as did you do ... ( I will try it at the time using the command set comm size 1460 ).
When I typed the command open the wifly returned me ERR: Connected!  Do you know if it's right?

However I would to know if you could send me the code used in your project?
It would help me a lot..

Thank you!

msb4180

The second part of this post has all the code I used (http://arduino.cc/forum/index.php/topic,140766.0.html).

The set comm match, size and time commands of these wireless modules are intended for communication from the module to the remote host, so using them will not help you receive data from the PC. I didn't have to setup anything to receive data from the PC and forward it to the Arduino through RX/TX. As far as I understood, the module fowards data as soon as it receives a complete packet.

I think you are getting the ERR: Connected! message because you are already connected to the IP address and port you are trying to connect. If no arguments are provided to the open command, the device will attempt to connect to the stored remote host IP address and remote port number. Try using a different port and make sure that port is listening for incoming connection.

What data are you trying to send to Arduino and which program is sending it?


I will explain to you a part of my project that has this trouble..
Because is bigger... but after I want post it completely here and on you tube..

I hope could help me..

I have a router Wirelles providing my network and the module RN 131-C and my PC are connected in that network.
Till now this two devices are responding the command ping and I am getting make a telnet to Wifly, then I want send data from my PC to RN 131-C via wirelles network.

I read on the manual of RN131-C that using the commands ( set comm xxxxx ) I can forward packets TCP.
I am thinking that I can to open a telnet connection and send data to RN 131-C and he forward to arduino via serial,  typing  that  data.

I need to send exactly the follow data.      2415.8796
It is a GPS coordinate.

Do you agree ?

Thank you for your reply!

msb4180

Once again, the "set comm xxxxx" commands are for communication from the wireless module to the PC. They are useless when sending data from the PC to the module.

I don't think you are able to send data to the wireless module from a Telnet connection. In the module's manual there is no command to do that. You need to do it through software or making an HTTP request from the module to a web server.

pavol

Hi,

I have a question. I need at least 15 LEDs outputs. Does it mean I need 5 Arduinos?
Second question, is this possible to embed in attiny45 and use it as a standalone device? Does attiny45 manage speech recognition?
Thanks,

pavol

I actually found attiny2313. That should give me enough I/O. And here is how to program it : http://www.ernstc.dk/arduino/2313.htm

Hopefully the voice recognition will work...

msb4180

If the microcontroller you are using is able to capture and send 8000 samples per second from the mic, it should work with BitVoicer.

Just a tip: microcontrollers do not have the processing power nor the memory to perform speech recognition as shown in the video, so you will need external help.

i am having a bit of trouble with this, any ideas?

#include <BitVoicer11.h>

BitVoicerSerial bvSerial = BitVoicerSerial();
boolean sampleTest = false;
byte dataType = 0;

int ledRED = 3;
int lightLevel = 0;

void setup()
{
  bvSerial.setAnalogReference(BV_EXTERNAL);
  bvSerial.setAudioInput(0);
  pinMode(ledRED, OUTPUT);

}


void loop()
{

  if (sampleTest == true)
  {
    bvSerial.processAudio(46);
  }

 
  if (bvSerial.engineRunning)
  {
    bvSerial.processAudio(46);
  }
}

void serialEvent()
{
  dataType = bvSerial.getData();
  if (dataType == BV_COMMAND)
      sampleTest = bvSerial.cmdData;
  if (dataType == BV_STATUS && bvSerial.engineRunning == true)
    bvSerial.startStopListening();
  if (dataType == BV_STR)
    redLEDS;
}


void redLEDS()
{
   if (bvSerial.strData == "red")
   {
     digitalWrite(ledRED, HIGH);
     delay(200);
     Serial.print('red');
     lightLevel = 255;
   }
   else
   {
     digitalWrite(ledRED, LOW);
     delay(200);
     lightLevel = 0;
   }
}

VAM

Great job and thanks for sharing!
It should be possible to do this via Bluetooth right? Say with BlueSmirf? Any sources you might know about? I've been Google-ing around and still haven't found anything. I will update this post if I find anything.
Thanks for any helps.

Go Up