Estudio para el diseño de un prototipo de sistema de ...
Transcript of Estudio para el diseño de un prototipo de sistema de ...
![Page 1: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/1.jpg)
Estudio para el diseño de un prototipo de sistema de
entrenamiento físico basado en Arduino y App móvil
Documento de anexos
Escuela Superior de Ingeniería Industrial,
Aeronáutica y Audiovisual de Terrassa (ESEIAAT)
Nombre: Alejandro Rosa Hernández
Director: Juan Antonio Ortega
Fecha: 20 de Abril de 2017
![Page 2: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/2.jpg)
Alejandro Rosa 1
Índice 1. Código Arduino ...................................................................................................... 2
2. Bloques AppInventor ........................................................................................... 16
2.1. Pantalla Inicio ............................................................................................... 16
2.2. Pantalla creación de usuario ......................................................................... 16
2.3. Pantalla edición usuario ................................................................................ 19
2.4. Pantalla eliminación usuario ......................................................................... 21
2.5. Pantalla gestión de dispositivos .................................................................... 23
2.6. Pantalla de resultados .................................................................................. 28
2.7. Pantalla de creación de entrenamiento ......................................................... 32
2.8. Pantalla de eliminación de entrenamiento .................................................... 49
2.9. Pantalla de ejecución de entrenamiento ....................................................... 52
3. Datasheets .......................................................................................................... 71
![Page 3: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/3.jpg)
Alejandro Rosa 2
1. Código Arduino /*
PROYECTO: Programable Training System
AUTOR: Alejandro Rosa Hernández
VERSIÓN: 1.0
----------------------------------------------------
VERSIÓN 1.0:
AUTOR: Alejandro Rosa Hernández
FECHA: 12/2016
COMENTARIO VERSIÓN: Edición Inicial
----------------------------------------------------
*/
/*----[LIBRERIAS]----*/
#include <SoftwareSerial.h>
#include <EEPROM.h>
/*----[DECLARACIÓN PINOUT]----*/
#define RXD_BLUE 3
#define TXD_BLUE 4
#define VCC_BLUE 5
#define KEY_BLUE 6
#define LED_CONFIG 8
#define RGB_BLUE 9
#define RGB_GREEN 10
#define BUZZER 2
#define RGB_RED 12
#define LED_ON 11
#define SW1 0
#define SW2 1
![Page 4: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/4.jpg)
Alejandro Rosa 3
#define INFRARED 5
/*----[DECLARACIÓN DE VARIABLES]----*/
//BITS
boolean loginfo=1;
//boolean zumbadoractivo=0;
//INTEGERS
int tono=850;
int numdispEEPROM;//Número de dispositivo guardado en la memoria EEPROM
int numdisp;//Número de dispositivo leido por Hardware
int Entreno[6];//Valor recibido por BT que indica al dispositivo en que parte del programa esta
unsigned int enviar;//valor a enviar
unsigned int enviarestado;//valor a enviar
//Variables entrenamiento
boolean Ejecutando=0;
boolean Optico=0;
boolean Acustico=0;
boolean Contacto=0;
boolean IR=0;
unsigned long TiempoInicio;
unsigned long TiempoFin;
int Duracion;
int Multiplicador;
int Red;
int Green;
int Blue;
int LecIRSensor;
//int LecContacto;
![Page 5: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/5.jpg)
Alejandro Rosa 4
unsigned long TiempoInicioZumbador;
unsigned long TiempoFinZumbador;
int miliszumbador;
//CHARS
char recibido;
/*----[DECLARACIÓN DE LA COMUNICACIÓ BT]----*/
SoftwareSerial BT(TXD_BLUE,RXD_BLUE); // RX, TX (PINS ARDUINO) -- TX, RX (MODULO
BT)
/*----[BLOQUE SETUP]----*/
void setup() {
//INICIALIZACIÓN PUERTOS COMUNICACIONES SERIE
if(loginfo==1){
Serial.begin(9600);
}
//INICIALIZACIÓN PINOUT
pinMode(VCC_BLUE,OUTPUT);
pinMode(KEY_BLUE,OUTPUT);
pinMode(LED_CONFIG,OUTPUT);
pinMode(BUZZER,OUTPUT);
pinMode(LED_ON,OUTPUT);
//INICIALIZACIÓN VARIABLES
digitalWrite(LED_ON,HIGH);//Se enciende el led de dispositivo encendido
miliszumbador=250;
//LECTURA MEMORIA
![Page 6: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/6.jpg)
Alejandro Rosa 5
numdispEEPROM=EEPROM.read(0);//Lectura del número de dispositivo guardado en la
memoria EEPROM
numdisp=LecturaSwitch(SW1,SW2);//Lectura del número de dispositivo del Hardware
if(loginfo==1){
Serial.println("Número de dispositivo eeprom: "+String(numdispEEPROM)+" Número de
dispositivo Hardware: "+String(numdisp));
}
if(numdisp==9999){//Si ocurre un error de lectura
ErrorReiniciar();
}
if (numdispEEPROM!=numdisp){//Si los valores de número de dispositivo no coinciden se
cambia la configuración del módulo BT y se guarda el nuevo valor en la EEPROM
CFG_BT(numdisp);
EEPROM.write(0,numdisp);
}
BT.begin(38400);//Se inicia la comunicación BT
digitalWrite(VCC_BLUE,HIGH);//Se enciende el módulo BT
EsperaConexionInicial();//Indicador de espera de la primera conexión
}
/*----[BLOQUE LOOP]----*/
void loop() {
if(BT.available()){
Entreno[0]=BT.parseInt();
if (Entreno[0]>=100){
Entreno[1]=BT.parseInt();
Entreno[2]=BT.parseInt();
Entreno[3]=BT.parseInt();
Entreno[4]=BT.parseInt();
![Page 7: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/7.jpg)
Alejandro Rosa 6
Entreno[5]=BT.parseInt();
if(loginfo==1){
Serial.println("Valores Recibidos:
"+String(Entreno[0])+","+String(Entreno[1])+","+String(Entreno[2])+","+String(Entreno[3])+","+Str
ing(Entreno[4])+","+String(Entreno[5]));
}
if (Entreno[0]==100){//Modo espera
enviar=1;
BT.write(enviar);
analogWrite(RGB_RED,Entreno[3]);
analogWrite(RGB_GREEN,Entreno[4]);
analogWrite(RGB_BLUE,Entreno[5]);
}
if (Entreno[0]==120){//Modo Inicio orden
enviar=120;
BT.write(enviar);
enviarestado=0;
Ejecutando=1;
if (Entreno[1]==0 || Entreno[1]==3){
Acustico=1;
TiempoInicioZumbador=millis();
}else{
Acustico=0;
}
if (Entreno[1]==2 || Entreno[1]==3){
Optico=1;
}else{
Optico=0;
}
if (Entreno[2]==1 || Entreno[2]==3){
IR=1;
![Page 8: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/8.jpg)
Alejandro Rosa 7
}else{
IR=0;
}
TiempoInicio=millis();
Red=Entreno[3]*3;
Green=Entreno[4]*3;
Blue=Entreno[5]*3;
}
if (Entreno[0]==150){//Modo pregunta estado
BT.write(enviarestado);
if(enviarestado==1){
BT.write(Multiplicador);
BT.write(Duracion);
enviarestado=0;
}
}
if (Entreno[0]==200){//Modo fin entrenamiento
enviar=200;
BT.write(enviar);
EsperaConexionInicial();
}
}
}
if (Ejecutando==1){
if (Optico==1){
analogWrite(RGB_RED,Red);
analogWrite(RGB_GREEN,Green);
analogWrite(RGB_BLUE,Blue);
}else{
![Page 9: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/9.jpg)
Alejandro Rosa 8
analogWrite(RGB_RED,0);
analogWrite(RGB_GREEN,0);
analogWrite(RGB_BLUE,0);
}
if (Acustico==1){
TiempoFinZumbador=millis();
if((TiempoFinZumbador-TiempoInicioZumbador)<=miliszumbador){
tone(BUZZER,tono);
if(loginfo==1){
Serial.println("TONO!!! "+String((TiempoFinZumbador-TiempoInicioZumbador)));
}
}else{
if(loginfo==1){
Serial.println("NO TONO "+String((TiempoFinZumbador-TiempoInicioZumbador)));
}
noTone(BUZZER);
}
}else{
if(loginfo==1){
Serial.println("NO TONO "+String((TiempoFinZumbador-TiempoInicioZumbador)));
}
noTone(BUZZER);
}
if(IR==1){
LecIRSensor=LecturaIR();
if(loginfo==1){
Serial.println("Lectura IR: "+String(LecIRSensor));
}
if(LecIRSensor<=15){
![Page 10: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/10.jpg)
Alejandro Rosa 9
Ejecutando=0;
enviarestado=1;
TiempoFin=millis();
Multiplicador=MultiplicadorTiempoRespuesta(TiempoInicio,TiempoFin);
Duracion=TiempoRespuesta(TiempoInicio,TiempoFin,Multiplicador);
if(loginfo==1){
Serial.println("Duracion: "+String(Duracion));
}
analogWrite(RGB_RED,0);
analogWrite(RGB_GREEN,0);
analogWrite(RGB_BLUE,0);
}
}
}
}
/*----[FUNCIONES]----*/
int MultiplicadorTiempoRespuesta(unsigned long Tini,unsigned long Tend){
/*Funcion que calcula el multiplicador para el calculo del tiempo en miliseg. enviado*/
unsigned long resta;
int multip,i,result;
resta=Tend-Tini;
for(i=1;i<255;i++){
result=resta/i;
if(result<255){
multip=i;
break;
}
![Page 11: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/11.jpg)
Alejandro Rosa 10
}
if(loginfo==1){
Serial.println("Multiplicador: "+String(multip));
}
return multip;
}
int TiempoRespuesta(unsigned long Tini,unsigned long Tend,int mult){
return ((Tend-Tini)/mult);
}
void CFG_BT(int numero){
/*Función para la configuración del número de dispositivo BT del HC-05*/
//Inicio del programa
if(loginfo==1){
Serial.println("Inicio CFG BT");
}
digitalWrite(LED_CONFIG,HIGH);//Se enciende el LED para indicar que está en modo
configuración
BT.begin(38400);//Se inicia el puerto serie con la velocidad de CFG
delay(3000);
digitalWrite(KEY_BLUE,HIGH);//Se alimenta el pin de CFG del HC-05
delay(3000);
digitalWrite(VCC_BLUE,HIGH);//Se enciende el módulo BT
delay(2000);
BT.write("AT+ORGL\r\n");//Se resetea el HC-05 al estado de fábrica
delay(1000);
BT.print("AT+NAME=PTSv1_"+String(numero)+"\r\n");//Se cambia el nombre del HC-05 con el
número de dispositivo correspondiente
delay(1000);
digitalWrite(VCC_BLUE,LOW);//Se apaga el módulo
delay(200);
digitalWrite(KEY_BLUE,LOW);//Se apaga el pin de CFG del HC-05
![Page 12: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/12.jpg)
Alejandro Rosa 11
delay(200);
digitalWrite(VCC_BLUE,HIGH);//Se enciende el módulo BT
delay(2000);
digitalWrite(LED_CONFIG,LOW);//Se apaga el LED de CFG
if(loginfo==1){
Serial.println("Final CFG BT");
}
}
int LecturaSwitch(int Pin1, int Pin2){
/*Función para pasar la lectura analógica del switch a un valor*/
int lectura1;
int lectura2;
int resultado_Int;
String result1;
String result2;
String resultado;
boolean error=0;
lectura1=analogRead(Pin1);
lectura2=analogRead(Pin2);
//Gestion Pin 1
if(lectura1<100){
result1="00";
}else if(lectura1<720 && lectura1>650){
result1="01";
}else if(lectura1<650 && lectura1>450){
result1="10";
}else if(lectura1<800 && lectura1>720){
result1="11";
}else{
![Page 13: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/13.jpg)
Alejandro Rosa 12
error=1;
}
//Gestion Pin 2
if(lectura2<100){
result2="00";
}else if(lectura2<720 && lectura2>650){
result2="01";
}else if(lectura2<650 && lectura2>450){
result2="10";
}else if(lectura2<800 && lectura2>720){
result2="11";
}else{
error=1;
}
resultado=result1+result2;
if(loginfo==1){
Serial.println("Resultado codificacion: "+resultado+"-Parte1="+result1+";Parte2="+result2);
}
//Codificacion de los resultados
if(error){
return(9999);
}else{
resultado_Int=BinToInt(resultado);
return(resultado_Int);
}
}
unsigned int BinToInt (String Binario){
/*Función para pasar un String binario a un Integer*/
char bin[9]; //Creamos un array de char
![Page 14: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/14.jpg)
Alejandro Rosa 13
Binario.toCharArray(bin, 9); //Pasamos el string al array de char que hemos creado
int i = 0; //Variable para el contador
unsigned int n = 0; //Variable para calcular el resultado
while ( bin[i] == '0' || bin[i] == '1' ) {
if ( bin[i] == '0' )
n <<= 1;
else {
n ^= 1;
n <<= 1;
}
++i;
}
n >>= 1;
return(n);
}
void ErrorReiniciar(){
/*Función para indicar que ha habido algún error y debe reiniciarse el dispositivo*/
boolean bucle=0;
while(bucle==0){
digitalWrite(LED_ON,HIGH);
digitalWrite(LED_CONFIG,LOW);
delay(1000);
digitalWrite(LED_ON,LOW);
digitalWrite(LED_CONFIG,HIGH);
delay(1000);
}
}
int LecturaIR(){
![Page 15: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/15.jpg)
Alejandro Rosa 14
/*Función que devuelve el valor medido (media de 3 medidas) del sensor IR*/
int lectura,dist1,dist2,dist3,distmedia;
lectura=analogRead(INFRARED);
dist1=pow(3027.4 / lectura, 1.2134);
delayMicroseconds(10);
lectura=analogRead(INFRARED);
dist2=pow(3027.4 / lectura, 1.2134);
delayMicroseconds(10);
lectura=analogRead(INFRARED);
dist3=pow(3027.4 / lectura, 1.2134);
distmedia=((dist1+dist2+dist3)/3);
if(distmedia<6){
distmedia=6;
}else if(distmedia>100){
distmedia=100;
}
return distmedia;
}
void EsperaConexionInicial(){
/*Función de espera a la primera conexión*/
boolean bucle=0;
char recibidochar;
int cntciclos=0;
int cntpin=1;
while(bucle==0){
noTone(BUZZER);
if(BT.available()){
bucle=1;
}else{
![Page 16: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/16.jpg)
Alejandro Rosa 15
delay(100);
cntciclos=cntciclos+1;
if(cntciclos==10){
cntciclos=0;
if(cntpin==3){
cntpin=1;
}else{
cntpin=cntpin+1;
}
switch(cntpin){
case 1:
analogWrite(RGB_RED,255);
analogWrite(RGB_GREEN,0);
analogWrite(RGB_BLUE,0);
break;
case 2:
analogWrite(RGB_RED,0);
analogWrite(RGB_GREEN,255);
analogWrite(RGB_BLUE,0);
break;
case 3:
analogWrite(RGB_RED,0);
analogWrite(RGB_GREEN,0);
analogWrite(RGB_BLUE,255);
break;
}
}
}
}
}
![Page 17: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/17.jpg)
Alejandro Rosa 16
2. Bloques AppInventor
2.1. Pantalla Inicio
2.2. Pantalla creación de usuario
![Page 18: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/18.jpg)
Alejandro Rosa 17
![Page 19: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/19.jpg)
Alejandro Rosa 18
![Page 20: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/20.jpg)
Alejandro Rosa 19
2.3. Pantalla edición usuario
![Page 21: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/21.jpg)
Alejandro Rosa 20
![Page 22: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/22.jpg)
Alejandro Rosa 21
2.4. Pantalla eliminación usuario
![Page 23: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/23.jpg)
Alejandro Rosa 22
![Page 24: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/24.jpg)
Alejandro Rosa 23
2.5. Pantalla gestión de dispositivos
![Page 25: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/25.jpg)
Alejandro Rosa 24
![Page 26: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/26.jpg)
Alejandro Rosa 25
![Page 27: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/27.jpg)
Alejandro Rosa 26
![Page 28: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/28.jpg)
Alejandro Rosa 27
![Page 29: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/29.jpg)
Alejandro Rosa 28
2.6. Pantalla de resultados
![Page 30: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/30.jpg)
Alejandro Rosa 29
![Page 31: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/31.jpg)
Alejandro Rosa 30
![Page 32: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/32.jpg)
Alejandro Rosa 31
![Page 33: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/33.jpg)
Alejandro Rosa 32
2.7. Pantalla de creación de entrenamiento
![Page 34: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/34.jpg)
Alejandro Rosa 33
![Page 35: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/35.jpg)
Alejandro Rosa 34
![Page 36: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/36.jpg)
Alejandro Rosa 35
![Page 37: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/37.jpg)
Alejandro Rosa 36
![Page 38: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/38.jpg)
Alejandro Rosa 37
![Page 39: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/39.jpg)
Alejandro Rosa 38
![Page 40: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/40.jpg)
Alejandro Rosa 39
![Page 41: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/41.jpg)
Alejandro Rosa 40
![Page 42: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/42.jpg)
Alejandro Rosa 41
![Page 43: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/43.jpg)
Alejandro Rosa 42
![Page 44: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/44.jpg)
Alejandro Rosa 43
![Page 45: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/45.jpg)
Alejandro Rosa 44
![Page 46: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/46.jpg)
Alejandro Rosa 45
![Page 47: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/47.jpg)
Alejandro Rosa 46
![Page 48: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/48.jpg)
Alejandro Rosa 47
![Page 49: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/49.jpg)
Alejandro Rosa 48
![Page 50: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/50.jpg)
Alejandro Rosa 49
2.8. Pantalla de eliminación de entrenamiento
![Page 51: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/51.jpg)
Alejandro Rosa 50
![Page 52: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/52.jpg)
Alejandro Rosa 51
![Page 53: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/53.jpg)
Alejandro Rosa 52
2.9. Pantalla de ejecución de entrenamiento
![Page 54: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/54.jpg)
Alejandro Rosa 53
![Page 55: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/55.jpg)
Alejandro Rosa 54
![Page 56: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/56.jpg)
Alejandro Rosa 55
![Page 57: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/57.jpg)
Alejandro Rosa 56
![Page 58: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/58.jpg)
Alejandro Rosa 57
![Page 59: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/59.jpg)
Alejandro Rosa 58
![Page 60: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/60.jpg)
Alejandro Rosa 59
![Page 61: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/61.jpg)
Alejandro Rosa 60
![Page 62: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/62.jpg)
Alejandro Rosa 61
![Page 63: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/63.jpg)
Alejandro Rosa 62
![Page 64: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/64.jpg)
Alejandro Rosa 63
![Page 65: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/65.jpg)
Alejandro Rosa 64
![Page 66: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/66.jpg)
Alejandro Rosa 65
![Page 67: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/67.jpg)
Alejandro Rosa 66
![Page 68: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/68.jpg)
Alejandro Rosa 67
![Page 69: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/69.jpg)
Alejandro Rosa 68
![Page 70: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/70.jpg)
Alejandro Rosa 69
![Page 71: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/71.jpg)
Alejandro Rosa 70
![Page 72: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/72.jpg)
Alejandro Rosa 71
3. Datasheets
![Page 73: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/73.jpg)
GP2Y0A21YK0FGP2Y0A21YK0F
Distance Measuring Sensor UnitMeasuring distance: 10 to 80 cmAnalog output type
■Applications1. Touch-less switch (Sanitary equipment, Control of illumination, etc. )2. Robot cleaner3. Sensor for energy saving (ATM, Copier, Vending machine)4. Amusement equipment (Robot, Arcade game machine)
■Features1. Distance measuring range : 10 to 80 cm2. Analog output type3. Package size : 29.5×13×13.5 mm4. Consumption current : Typ. 30 mA5. Supply voltage : 4.5 to 5.5 V
■Agency approvals/Compliance1. Compliant with RoHS directive (2002/95/EC)
Notice The content of data sheet is subject to change without prior notice. In the absence of confirmation by device specification sheets, SHARP takes no responsibility for any defects that may occur in equipment using any SHARP devices shown in catalogs, data books, etc. Contact SHARP in order to obtain the latest device specification sheets before using any SHARP device.
Sheet No.: E4-A00201ENDate Dec.01.2006
©SHARP Corporation
■DescriptionGP2Y0A21YK0F is a distance measuring sensor unit,composed of an integrated combination of PSD (position sensitive detector) , IRED (infrared emitting diode) and signal processing circuit. The variety of the reflectivity of the object, theenvironmental temperature and the operating durationare not influenced easily to the distance detection because of adopting the triangulation method. This device outputs the voltage corresponding to thedetection distance. So this sensor can also be used asa proximity sensor.
1
![Page 74: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/74.jpg)
■Block diagram
■Outline Dimensions (Unit : mm)
Product mass : Approx. 3.6g
Signalprocessing circuit Voltage regulator
Oscillation circuit
Output circuit
Distance measuring IC
LED drive circuit
GND Vcc
Vo
PSD
LED
Stamp(Example)
Model name Month(1 to 9,X,Y,Z)Year(2005:5)
2Y0A21 F 4 Z
(Stamp)
Light emitter
φ3.2hole
R3.7
5
3.75
*4.5 * 20±0.1
3729.5
10.114.75
Light detector
φ3.2hole
R3.7
5
6.32
8.4
7.2
Lens case
13(1
8.9
)+0
.5-0
.3
(3.3)
1.2PWB
Connector
7.5 4.15 16.3
①②③ 13.5
2-1.
5
Connector signalsignal name
VO
GND
VCC
Connector : J.S.T.TRADING COMPANY,LTD, S3B-PH
Materials Lens :Acrylic acid resin (Visible light cut-off resin) Case :Carbonic ABS (Conductive resin) PWB :Paper phenol
Note 1. The dimensions marked * are described the dimensions of lens center position.Note 2. Unspecified tolerances shall be ± 0.3 mm.Note 3. The dimensions in parenthesis are shown for reference.
GP2Y0A21YK0F
2Y0A21 F 4Z
Sheet No.: E4-A00201EN2
![Page 75: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/75.jpg)
(Ta=25℃,VCC=5V)
Parameter Symbol Rating UnitSupply voltage VCC 4.5 to 5.5 V
■Absolute Maximum Ratings
■Electro-optical Characteristics
GP2Y0A21YK0F
(Ta=25℃,VCC=5V)
* L : Distance to reflective objectNote 1 : Using reflective object : White paper (Made by Kodak Co., Ltd. gray cards R-27・white face, reflectance; 90%)
Sheet No.: E4-A00201EN
Symbol Rating UnitSupply voltage VCC -0.3 to +7 VOutput terminal voltage VO -0.3 to VCC+0.3 VOperating temperature Topr -10 to +60 ℃
Storage temperature Tstg -40 to +70 ℃
Parameter
Parameter Symbol Conditions MIN. TYP. MAX. UnitAverage supply current ICC L=80cm (Note 1) ― 30 40 mADistance measuring ΔL (Note 1) 10 ― 80 cmOutput voltage VO L=80cm (Note 1) 0.25 0.4 0.55 V
Output voltage differential ΔVOOutput voltage differece betweenL=10cm and L=80cm (Note 1) 1.65 1.9 2.15 V
■Recommended operating conditions
3
![Page 76: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/76.jpg)
Fig. 1 Timing chart
GP2Y0A21YK0F
Vcc(Power supply)
nthoutput
nthmeasurement
Secondmeasurement First measurement
Second output First outputUnstable output
MAX 5.0ms
38.3ms±9.6ms
Distance measuring operating
Vo(Output)
Sheet No.: E4-A00201EN4
![Page 77: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/77.jpg)
GP2Y0A21YK0F
Fig. 2 Example of distance measuring characteristics(output)
Distance to reflective object L(cm)0 10 20 30 5040 60 70 80
0
0.5
1
1.5
2
2.5
3
3.5
Out
put v
olta
ge (V
)O
utpu
t vol
tage
(V)
White paper (Reflectance ratio 90%)
Gray paper (Reflectance ratio 18%)
Inverse number of distance (1/cm)0 0.05 0.1 0.15 0.2
White paper (Reflectance ratio 90%)
Gray paper (Reflectance ratio 18%)
0
0.5
1
1.5
2
2.5
3
3.5
80cm
50cm 40cm30cm
25cm20cm
15cm
10cm
8cm
7cm
6cm 5cm
Sheet No.: E4-A00201EN5
![Page 78: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/78.jpg)
GP2Y0A21YK0F
Sheet No.: E4-A00201EN
■Notes
●Advice for the optics • The lens of this device needs to be kept clean. There are cases that dust, water or oil and so on deteriorate the characteristics of this device. Please consider in actual application. • Please don’t do washing. Washing may deteriorate the characteristics of optical system and so on. Please confirm resistance to chemicals under the actual usage since this product has not been designed against washing.
●Advice for the characteristics • In case that an optical filter is set in front of the emitter and detector portion, the optical filter which has the most efficient transmittance at the emitting wavelength range of LED for this product (λ = 870 ± 70nm), shall be recommended to use. Both faces of the filter should be mirror polishing. Also, as there are cases that the characteristics may not be satisfied according to the distance between the protection cover and this product or the thickness of the protection cover, please use this product after confirming the operation sufficiently in actual application. • In case that there is an object near to emitter side of the sensor between sensor and a detecting object, please use this device after confirming sufficiently that the characteristics of this sensor do not change by the object. • When the detector is exposed to the direct light from the sun, tungsten lamp and so on, there are cases that it can not measure the distance exactly. Please consider the design that the detector is not exposed to the direct light from such light source. • Distance to a mirror reflector can not be sometimes measured exactly. In case of changing the mounting angle of this product, it may measure the distance exactly. • In case that reflective object has boundary line which material or color etc. are excessively different, in order to decrease deviation of measuring distance, it shall be recommended to set the sensor that the direction of boundary line and the line between emitter center and detector center are in parallel.
• In order to decrease deviation of measuring distance by moving direction of the reflective object, it shall be recommended to set the sensor that the moving direction of the object and the line between emitter center and detector center are vertical.
●Advice for the power supply • In order to stabilize power supply line, we recommend to insert a by-pass capacitor of 10μF or more between Vcc and GND near this product.
(Incorrect) (Correct)
(Incorrect)
(Moving direction)
(Correct)
(Moving direction)
●Notes on handling • There are some possibilities that the internal components in the sensor may be exposed to the excessive mechanical stress. Please be careful not to cause any excessive pressure on the sensor package and also on the PCB while assembling this product.
6
![Page 79: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/79.jpg)
GP2Y0A21YK0F
Sheet No.: E4-A00201EN
●Presence of ODC etc. This product shall not contain the following materials. And they are not used in the production process for this product. Regulation substances : CFCs, Halon, Carbon tetrachloride, 1.1.1-Trichloroethane (Methylchloroform)
Specific brominated flame retardants such as the PBB and PBDE are not used in this product at all.
This product shall not contain the following materials banned in the RoHS Directive (2002/95/EC). • Lead, Mercury, Cadmium, Hexavalent chromium, Polybrominated biphenyls (PBB), Polybrominated diphenyl ethers (PBDE).
7
![Page 80: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/80.jpg)
GP2Y0A21YK0F
Sheet No.: E4-A00201EN
■Package specification
Packaging method 1.Put products of 100pcs. in tray. packing method is showed in the above fig.(Fig.1) 2.Put them(10-tray) in the packing box. Put pads on their top and bottom. And put pads on each trays(Total 10 sheets) (Fig.2). 3.Seal the packing box with craft tape. Print the model No.,quantity,inspection date (1000 pcs./a packing box)(Fig.3).
Package composition
Pad
Packing case
Craft tape
Model No.QuantityDate
Tray
Product
(2 sheeets/case: top and bottom)
Tray put products(10-tray/case)
Pad(10 sheeets/case)
(Fig.1)
(Fig.2)
(Fig.3)
8
![Page 81: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/81.jpg)
■Important Notices
· The circuit application examples in this publication are provided to explain representative applications of SHARP devices and are not intended to guarantee any circuit design or license any intellectual property rights. SHARP takes no responsibility for any problems related to any intellectual property right of a third party resulting from the use of SHARP's devices.
· Contact SHARP in order to obtain the latest device specifi-cation sheets before using any SHARP device. SHARP reserves the right to make changes in the specif icat ions, characterist ics, data, materials , structure, and other contents described herein at any time without notice in order to improve design or reliability. Manufacturing locations are also subject to change without notice.
· Observe the following points when using any devices in this publication. SHARP takes no responsibility for damage caused by improper use of the devices which does not meet the conditions and absolute maximum ratings to be used specified in the relevant specification sheet nor meet the following condi-tions:(i) The devices in this publication are designed for use in general electronic equipment designs such as: --- Personal computers --- Office automation equipment --- Telecommunication equipment [terminal] --- Test and measurement equipment --- Industrial control --- Audio visual equipment --- Consumer electronics(ii) Measures such as fail-safe function and redundant design should be taken to ensure reliability and safety when SHARP devices are used for or in connection
with equipment that requires higher reliability such as: --- Transportation control and safety equipment (i.e., aircraft, trains, automobiles, etc.) --- Traffic signals --- Gas leakage sensor breakers --- Alarm equipment --- Various safety devices, etc.( i i i ) SHARP dev ices sha l l no t be used fo r o r in connection with equipment that requires an extremely high level of reliability and safety such as: --- Space applications --- Telecommunication equipment [trunk lines] --- Nuclear power control equipment --- Medical and other life support equipment (e.g., scuba).
· If the SHARP devices listed in this publication fall within the scope of strategic products described in the Foreign Exchange and Foreign Trade Law of Japan, it is necessary to obtain approval to export such SHARP devices.
· This publication is the proprietary product of SHARP and is copyrighted, with all rights reserved. Under the copy-right laws, no part of this publication may be repro-duced or transmitted in any form or by any means, electronic or mechanical, for any purpose, in whole or in part, without the express written permission of SHARP. Express written permission is also required before any use of this publication may be made by a third party.
· Contact and consult with a SHARP representative if there are any questions about the contents of this publication.
GP2Y0A21YK0F
Sheet No.: E4-A00201EN9
![Page 82: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/82.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
1 Tech Support: [email protected]
HC-05
-Bluetooth to Serial Port Module
Overview
HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for
transparent wireless serial connection setup.
Serial port Bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps
Modulation with complete 2.4GHz radio transceiver and baseband. It uses CSR Bluecore
04-External single chip Bluetooth system with CMOS technology and with AFH(Adaptive
Frequency Hopping Feature). It has the footprint as small as 12.7mmx27mm. Hope it will simplify
your overall design/development cycle.
Specifications
Hardware features
Typical -80dBm sensitivity
Up to +4dBm RF transmit power
Low Power 1.8V Operation ,1.8 to 3.6V I/O
PIO control
UART interface with programmable baud rate
With integrated antenna
With edge connector
![Page 83: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/83.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
2 Tech Support: [email protected]
Software features
Default Baud rate: 38400, Data bits:8, Stop bit:1,Parity:No parity, Data control: has.
Supported baud rate: 9600,19200,38400,57600,115200,230400,460800.
Given a rising pulse in PIO0, device will be disconnected.
Status instruction port PIO1: low-disconnected, high-connected;
PIO10 and PIO11 can be connected to red and blue led separately. When master and slave
are paired, red and blue led blinks 1time/2s in interval, while disconnected only blue led
blinks 2times/s.
Auto-connect to the last device on power as default.
Permit pairing device to connect as default.
Auto-pairing PINCODE:”0000” as default
Auto-reconnect in 30 min when disconnected as a result of beyond the range of connection.
Hardware
![Page 86: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/86.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
5 Tech Support: [email protected]
AT command Default:
How to set the mode to server (master):
1. Connect PIO11 to high level.
2. Power on, module into command state.
3. Using baud rate 38400, sent the “AT+ROLE=1\r\n” to module, with “OK\r\n”
means setting successes.
4. Connect the PIO11 to low level, repower the module, the module work as server
(master).
AT commands: (all end with \r\n)
1. Test command:
Command Respond Parameter
AT OK -
2. Reset
Command Respond Parameter
AT+RESET OK -
3. Get firmware version
Command Respond Parameter
AT+VERSION? +VERSION:<Param>
OK
Param : firmware version
Example:
AT+VERSION?\r\n
+VERSION:2.0-20100601
OK
![Page 87: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/87.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
6 Tech Support: [email protected]
4. Restore default
Command Respond Parameter
AT+ORGL OK -
Default state:
Slave mode, pin code :1234, device name: H-C-2010-06-01 ,Baud 38400bits/s.
5. Get module address
Command Respond Parameter
AT+ADDR? +ADDR:<Param>
OK
Param: address of Bluetooth
module
Bluetooth address: NAP: UAP : LAP
Example:
AT+ADDR?\r\n
+ADDR:1234:56:abcdef
OK
6. Set/Check module name:
Command Respond Parameter
AT+NAME=<Param> OK Param: Bluetooth module
name
(Default :HC-05)
AT+NAME? +NAME:<Param>
OK (/FAIL)
Example:
AT+NAME=HC-05\r\n set the module name to “HC-05”
OK
AT+NAME=ITeadStudio\r\n
OK
AT+NAME?\r\n
+NAME: ITeadStudio
OK
7. Get the Bluetooth device name:
Command Respond Parameter
AT+RNAME?<Param1> 1. +NAME:<Param2>
OK
2. FAIL
Param1,Param 2 : the address
of Bluetooth device
Example: (Device address 00:02:72:od:22:24,name:ITead)
AT+RNAME? 0002,72,od2224\r\n
+RNAME:ITead
OK
8. Set/Check module mode:
Command Respond Parameter
AT+ROLE=<Param> OK Param:
0- Slave AT+ ROLE? +ROLE:<Param>
![Page 88: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/88.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
7 Tech Support: [email protected]
OK 1-Master
2-Slave-Loop
9. Set/Check device class
Command Respond Parameter
AT+CLASS=<Param> OK Param: Device Class
AT+ CLASS? 1. +CLASS:<Param>
OK
2. FAIL
10. Set/Check GIAC (General Inquire Access Code)
Command Respond Parameter
AT+IAC=<Param> 1.OK
2. FAIL
Param: GIAC
(Default : 9e8b33)
AT+IAC +IAC:<Param>
OK
Example:
AT+IAC=9e8b3f\r\n
OK
AT+IAC?\r\n
+IAC: 9e8b3f
OK
11. Set/Check -- Query access patterns
Command Respond Parameter
AT+INQM=<Param>,<Param2>,
<Param3>
1.OK
2. FAIL
Param:
0——inquiry_mode_standard
1——inquiry_mode_rssi
Param2: Maximum number of
Bluetooth devices to respond
to
Param3:
Timeout (1-48 : 1.28s to
61.44s)
AT+ INQM? +INQM: <Param>,<Param2>,
<Param3>
OK
Example:
AT+INQM=1,9,48\r\n
OK
AT+INQM\r\n
+INQM:1, 9, 48
OK
![Page 89: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/89.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
8 Tech Support: [email protected]
12. Set/Check PIN code:
Command Respond Parameter
AT+PSWD=<Param> OK Param: PIN code
(Default 1234)
AT+ PSWD? + PSWD :<Param>
OK
13. Set/Check serial parameter:
Command Respond Parameter
AT+UART=<Param>,<Param2>,<
Param3>
OK Param1: Baud
Param2: Stop bit
Param3: Parity
AT+ UART? +UART=<Param>,<Param2>,
<Param3>
OK
Example:
AT+UART=115200,1,2,\r\n
OK
AT+UART?
+UART:115200,1,2
OK
14. Set/Check connect mode:
Command Respond Parameter
AT+CMODE=<Param> OK Param:
0 - connect fixed address
1 - connect any address
2 - slave-Loop
AT+ CMODE? + CMODE:<Param>
OK
15. Set/Check fixed address:
Command Respond Parameter
AT+BIND=<Param> OK Param: Fixed address
(Default
00:00:00:00:00:00)
AT+ BIND? + BIND:<Param>
OK
Example:
AT+BIND=1234,56,abcdef\r\n
OK
AT+BIND?\r\n
+BIND:1234:56:abcdef
OK
16. Set/Check LED I/O
Command Respond Parameter
AT+POLAR=<Param1,<Param2> OK Param1:
0- PIO8 low drive LED
1- PIO8 high drive LED
AT+ POLAR? + POLAR=<Param1>,<Param2>
OK
![Page 90: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/90.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
9 Tech Support: [email protected]
Param2:
0- PIO9 low drive LED
1- PIO9 high drive LED
17. Set PIO output
Command Respond Parameter
AT+PIO=<Param1>,<Param2> OK Param1: PIO number
Param2: PIO level
0- low
1- high
Example:
1. PIO10 output high level
AT+PI0=10,1\r\n
OK
18. Set/Check – scan parameter
Command Respond Parameter
AT+IPSCAN=<Param1>,<Param2
>,<Param3>,<Param4>
OK Param1: Query time
interval
Param2:Query duration
Param3:Paging interval
Param4:Call duration
AT+IPSCAN? +IPSCAN:<Param1>,<Param2>,<P
aram3>,<Param4>
OK
Example:
AT+IPSCAN =1234,500,1200,250\r\n
OK
AT+IPSCAN?
+IPSCAN:1234,500,1200,250
19. Set/Check – SHIFF parameter
Command Respond Parameter
AT+SNIFF=<Param1>,<Param2>,
<Param3>,<Param4>
OK Param1: Max time
Param2: Min time
Param3: Retry time
Param4: Time out
AT+ SNIFF? +SNIFF:<Param1>,<Param2>,<Par
am3>,<Param4>
OK
20. Set/Check security mode
Command Respond Parameter
AT+SENM=<Param1>,<Param2> 1. OK
2. FAIL
Param1:
0——sec_mode0+off
1——sec_mode1+non_seAT+ SENM? + SENM:<Param1>,<Param2>
![Page 91: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/91.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
10 Tech Support: [email protected]
OK cure
2——sec_mode2_service
3——sec_mode3_link
4——sec_mode_unknow
n
Param2:
0——hci_enc_mode_off
1——hci_enc_mode_pt_t
o_pt
2——hci_enc_mode_pt_t
o_pt_and_bcast
21. Delete Authenticated Device
Command Respond Parameter
AT+PMSAD=<Param> OK Param:
Authenticated Device
Address
Example:
AT+PMSAD =1234,56,abcdef\r\n
OK
22. Delete All Authenticated Device
Command Respond Parameter
AT+ RMAAD OK -
23. Search Authenticated Device
Command Respond Parameter
AT+FSAD=<Param> 1. OK
2. FAIL
Param: Device address
24. Get Authenticated Device Count
Command Respond Parameter
AT+ADCN? +ADCN:<Param>
OK
Param: Device Count
25. Most Recently Used Authenticated Device
Command Respond Parameter
AT+MRAD? + MRAD:<Param>
OK
Param: Recently
Authenticated Device
Address
26. Get the module working state
Command Respond Parameter
![Page 92: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/92.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
11 Tech Support: [email protected]
AT+ STATE? + STATE:<Param>
OK
Param:
“INITIALIZED”
“READY”
“PAIRABLE”
“PAIRED”
“INQUIRING”
“CONNECTING”
“CONNECTED”
“DISCONNECTED”
“NUKNOW”
27. Initialize the SPP profile lib
Command Respond Parameter
AT+INIT 1. OK
2. FAIL
-
28. Inquiry Bluetooth Device
Command Respond Parameter
AT+INQ +INQ: <Param1>, <Param2>,
<Param3>
….
OK
Param1:Address
Param2:Device Class
Param3 : RSSI Signal
strength
Example:
AT+INIT\r\n
OK
AT+IAC=9e8b33\r\n
OK
AT+CLASS=0\r\n
AT+INQM=1,9,48\r\n
At+INQ\r\n
+INQ:2:72:D2224,3E0104,FFBC
+INQ:1234:56:0,1F1F,FFC1
+INQ:1234:56:0,1F1F,FFC0
+INQ:1234:56:0,1F1F,FFC1
+INQ:2:72:D2224,3F0104,FFAD
+INQ:1234:56:0,1F1F,FFBE
+INQ:1234:56:0,1F1F,FFC2
+INQ:1234:56:0,1F1F,FFBE
+INQ:2:72:D2224,3F0104,FFBC
OK
28. Cancel Inquiring Bluetooth Device
Command Respond Parameter
AT+ INQC OK -
![Page 93: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/93.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
12 Tech Support: [email protected]
29. Equipment Matching
Command Respond Parameter
AT+PAIR=<Param1>,<Param2> 1. OK
2. FAIL
Param1:Device Address
Param2:Time out
30. Connect Device
Command Respond Parameter
AT+LINK=<Param> 1. OK
2. FAIL
Param:Device Address
Example:
AT+FSAD=1234,56,abcdef\r\n
OK
AT+LINK=1234,56,abcdef\r\n
OK
31. Disconnect
Command Respond Parameter
AT+DISC 1. +DISC:SUCCESS
OK
2. +DISC:LINK_LOSS
OK
3. +DISC:NO_SLC
OK
4. +DISC:TIMEOUT
OK
5. +DISC:ERROR
OK
Param:Device Address
32. Energy-saving mode
Command Respond Parameter
AT+ENSNIFF=<Param> OK Param:Device Address
33. Exerts Energy-saving mode
Command Respond Parameter
AT+ EXSNIFF =<Param> OK Param:Device Address
![Page 94: Estudio para el diseño de un prototipo de sistema de ...](https://reader035.fdocuments.mx/reader035/viewer/2022062912/62ba0b58ad6ada6deb2e53f3/html5/thumbnails/94.jpg)
HC-05 Bluetooth module iteadstudio.com 06.18.2010
13 Tech Support: [email protected]
Revision History
Rev. Description Release date v1.0 Initial version 7/18/2010