IoT Speech Recognition

IoT Speech Recognition © LGPL

Control a servo, LED lamp or any device connected to WiFi, using Android app.

  • 6,123 views
  • 0 comments
  • 14 respects

Components and supplies

Apps and online services

About this project

Overview

The Internet of Things (IoT) is a new emerging technology these days, a self configurable and adaptive system consisting of networks of sensors and other object including intelligent objects whose purpose is to interconnect with all things, including everyday and industrial objects, in such a way that they become intelligent, programmable and more capable of interacting with humans.

All the applications that involve IoT, whether industrial, home, etc. are controlled and monitored by certain parameters which are implemented and executed by the user or "other." Therefore, their implementation and execution differs with the sets of parameters, for the execution that is specified or desired by the user.

Arduino board is one of the important objects in this ecosystem, since it facilitates us to connect and control different devices like sensors, LEDs, step motors, servos and mobile phones.

This Tutorial

This tutorial describes how to create an Internet of Things with Android and Arduino:

Android application to control a generic servo motor and an LED, according to user speech over mobile phone.

Values of Implementation

All objects are in the same network for simplicity. The above images shown a above diagram of the system. It consist of 1 Servo Motor is capable of to take in 6 volts and deliver 44.4 oz-in. of maximum torque at 0.18 sec/60° at normal voltage inputs Torque: 38.8/44.4 oz-in. (4.8/6.0V) Speed: 0.20/0.18 sec/60° (4.8/6.0V) and rotate from 0 to 180 degrees and a commercial matrix led lamp of 24 10000 MCD (milli-candela's) leds with features:

  • Supply Voltage:----------------------------------- 5 VOLTS
  • Voltage Drop Across LED (Forward V):--- 3.4 VOLTS
  • Maximum LED Current:------------------------- 20 MILLIAMPS
  • # of LEDs connected in parallel:------------ 24 LEDs

The resistor value needed for the current limiting resistor used when powering the LEDs.

  • Calculated Limiting Resistor:------------------- 3.333 OHMS
  • Nearest higher rated 10% resistor:----------- 3.9 OHM
  • Calculated Resistor Wattage:------------------ 0.768 WATTS
  • Recommended Resistor power rating of:-- 1.28 WATTS

Then we have IOT implementation taking place with the help of CC3000 which is then allowing us to send parameters in this case "speech words" using mobile App which in this case is above is a hosting platform.

The mobile device sends information "lowercase text string type" to the IOT "CC3000" which is interfaced with the Arduino Micro, the Servo Motor and led lamp, this information is obtained from the mobile application when the user speaks with the microphone that the application recognizes the word and sends the text match or matches "you can select that on the app", to the Arduino Micro via a UDP or TCP client "you can set on the app" that runs on the mobile application and with the help of the CC3000, so the micro Arduino can either power the servomotor or turn off the led lamp.

Video

Code

ATmega32u4_IOT_LED_ServoArduino
/*
*	Author		: Zavala Ortiz Vicente Arturo.
*	language	: .cpp
*	Created		: 3/11/2015 11:56:57 AM
*	Name		: ATmega32u4_IOT_LED_Servo.cpp
*	Update		: 1/9/2017 02:29:15 PM
*/

#include <util/delay.h>
#include <stdlib.h>

#include "Servo.h"
#include "Network.h"

/*****		wifi Global Variables		*****/
// Connection info data lengths
#define MAX_MSG_LEN							100
#define SERVO_PIN								10
#define LED_PIN								  9

// Constants
char ap_ssid[]				    = "SSID of network";
char ap_password[]			  = "Password of network";

unsigned int ap_security	= WLAN_SEC_WPA2;	// Security of network
unsigned long timeout	  	= 3000;				// Milliseconds

// Global Variables
CC3000		wifi		= CC3000();
NETWORK		client  = NETWORK(wifi);

char in_message[MAX_MSG_LEN]	= {0};

/*****		Other Global Variables		*****/
uint8_t	  	i;
static char data[20];
double		  value = 0;

Servo servo;	// create servo object to control a servo

/*****		Motors Global Variables		*****/
void setup()
{
	/* add setup code here */
	ConnectionInfo connection_info;
	
	// Initialize CC3000 (configure SPI communications)
	#ifdef CC3000_DEBUG
		Serial.begin(115200);
	#endif
	
	// Initialize CC3000 (configure SPI communications)
	if(!wifi.init(SS)) {
		#ifdef CC3000_DEBUG
			DEBUGPRINTLN(PSTR("Initialize CC3000 FAIL!"));
		#endif
		return;
	}

	else {
    #ifdef CC3000_DEBUG
		  DEBUGPRINTLN(PSTR("Initialize CC3000 OK"));
		#endif
	}
	
	uint8_t connection_cnt = 0;
	while(connection_cnt <= WL_MAX_ATTEMPT_CONNECTION)
	{
		#ifdef CC3000_DEBUG
			DEBUGPRINT(PSTR("Connection try: "));
			printDec(connection_cnt);
			DEBUGPRINT(PSTR("\n"));
		#endif

		if(!wifi.connect(ap_ssid, ap_security, ap_password, timeout)) {
			#ifdef CC3000_DEBUG
				DEBUGPRINTLN(PSTR("Error: Could not connect to AP!"));
			#endif
		}

		else
		break;
		
		connection_cnt++;
		_delay_ms(2000);
	}
	
	// Gather connection details and print IP address
	if(!wifi.getConnectionInfo(connection_info) )
	{
		#ifdef CC3000_DEBUG
			DEBUGPRINTLN(PSTR("Error: Could not obtain connection details"));
		#endif
		
		return;
	}
	
	else
	{
		#ifdef CC3000_DEBUG
			DEBUGPRINT(PSTR("IP Address: "));
			printIPAddr(connection_info.ip_address);
		#endif
	}
	
	pin_mode(LED_PIN, OUTPUT);
	servo.attach(SERVO_PIN);  // attaches the servo on pin 9 to the servo object
	servo.write(0);
	_delay_ms(20);
}

void loop()
{
	/* add main program code here */	
	if(!client.isOpen())	
	{
		if(client.open(UDP_SOCKET) == 0) {
			DEBUGPRINT(PSTR("Create SOCKET ERROR!"));
			client.close();
		}
		
		if(!client.Bind(4443)) {
			#ifdef CC3000_DEBUG
				DEBUGPRINTLN(PSTR("Binding SOCKET Error!"));
			#endif
		}
	}
	
	#ifdef CC3000_DEBUG
		DEBUGPRINTLN(PSTR("WAITING FOR MESSAGE!"));
	#endif
	
	if(client.readFrom(4443, in_message, MAX_MSG_LEN, SOCKOPT_RECV_TIMEOUT) == -1) 
	{
		#ifdef CC3000_DEBUG
			DEBUGPRINTLN(PSTR("NO MESSAGE RECEIVED"));
		#endif
	}
	
	else 
	{
		if(client.http_gets(data, "word", in_message))
		{
			if((strcmp(data, "left") == 0 )) {
				servo.write(180);                  // sets the servo position according to the scaled value
				_delay_ms(20);
			}
		
			else if((strcmp(data, "center") == 0)) {
				servo.write(90);                  // sets the servo position according to the scaled value
				_delay_ms(20);
			}
		
			else if((strcmp(data, "right") == 0)) {
				servo.write(0);                  // sets the servo position according to the scaled value
				_delay_ms(20);
			}
			
			else if((strcmp(data, "on") == 0)) {
				 value = atoi(data);				 
				 digitalWrite(LED_PIN, HIGH);
				
				_delay_ms(20);
			}
			
			else if((strcmp(data, "off") == 0)) {
				value = atoi(data);
				digitalWrite(LED_PIN, LOW);
				
				_delay_ms(20);
			}	
		}
	}
	
	client.fulsh_buffer(in_message);
	client.fulsh_buffer(data);
	_delay_ms(20);
}

Schematics

basic schematic
Iot led bb fizln5qdxj

Comments

Similar projects you might like

IoT Face Tracking and Recognition

by vicente zavala

  • 7,248 views
  • 1 comment
  • 21 respects

IoT Speech Recognition

Project tutorial by vicente zavala

  • 1,202 views
  • 0 comments
  • 5 respects

Speech Recognition with Arduino and BitVoicer Server

Project tutorial by Marcio Tamagushi

  • 24,339 views
  • 14 comments
  • 44 respects

IoT Face Tracking and Recognition

Project tutorial by vicente zavala

  • 3,406 views
  • 1 comment
  • 18 respects

Speech Recognition and Synthesis with Arduino

Project tutorial by Marcio Tamagushi

  • 45,840 views
  • 3 comments
  • 66 respects

IoT Dimmer

Project showcase by vicente zavala

  • 2,425 views
  • 0 comments
  • 6 respects
Add projectSign up / Login