This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
Problema con bluetooth y comandos AT
#41
(03-08-2014, 01:22 PM)sejiozosky escribió: Quería comentaros un problema que tengo con el modulo bluetooth es un HC-05 y esque lo estoy conectando por el monitor serial le mando el comando AT y no me devuelve nada.
Ha habido un par de veces que si se me ha conectado pero ahora nada...
Tengo todo bien conectado.. El txd con el rxd y viceversa el vcc con el voltaje y el gnd con gnd.
Aqui os dejo el codigo:
[Imagen: e6a2ane3.jpg]
Gracias y un saludo!

A mí me sucedió lo mismo y en ningún foro hacían referencia a el modo de comandos AT del HC-05, te dejo el programa que me sirvió a mí explicado, ojalá soluciones tu problema, saludos. 

//Para que este programa funcione es necesario configurar el HC 05 en modo AT 2 
//PASOS:
/*
 * 1. Hacer las conexiones respectivas del HC 05
 *  -VCC->5 V Arduino
 *  -GND->GND Arduino
 *  -TX->RX Arduino (pin 2)
 *  -RX->TX Arduino (pin3)
 * 2. Desconectar VCC del HC05  
 * 3.Subir el programa al Arduino
 * 4. Una vez subido conectar el VCC a 5V de Arduino manteniendo el botón presionado hasta realizar la conexión (los leds deben mantenerse encendidos 2 segundos y apagados 2 segundos)
 * 5.Abrir el monitor Serial de arduino y configurarlo así:
 *  -9600 baudio
 *  -Ambos NL & CR
 * 6. Enviar comandos *
 */
//En el monitor serial escribir:
//AT->OK (Si no responde OK revisar conexiones)
//AT+UART=9600,0,0 (lo normal es 9600 si se necesita otra velocidad cambiar 9600 por la que se necesite)
//AT+UART DEBE DAR LO ANTERIOR (para verificar que quedó configurado a la velocidad deseada)
//AT+ROLE=0 (Para asignarlo como esclavo si se desea como maestro se asigna el número 1)

#include <SoftwareSerial.h>


int keyPin=8;//Pin del Key
int txPin=3;//Pin TX del serial virtual
int rxPin=2;//Pin RX del srial virtual

SoftwareSerial bluetooth(rxPin,txPin);

void setup() {

  //Se configura el puerto serial virtual y su baud rate
  bluetooth.begin(38400);//Baud Rate a 38400
  Serial.begin(9600);  //Se inciliza serial Arduino a 9600 
  Serial.write("Comandos AT:");
}

void loop() {
  // put your main code here, to run repeatedly:
  if(Serial.available())
  {
    bluetooth.write(Serial.read());//se envía comando AT    
  }

  if(bluetooth.available())
  {
    Serial.write(bluetooth.read());//se recibe respuesta al comando AT
  }
  
}
  Responder
#42
Resulta que tenía un módulo ZS-040 (también pasaba con los GW-040) y no entraba en comandos AT de manera correcta. Lo solucioné gracias a este blog http://digirobs.blogspot.com.es/2015/10/...th-hc.html para poner en HIGH el pin 34 o KEY. Espero que le sirva a alguien.
  Responder


Posibles temas similares…
Tema Autor Respuestas Vistas Último mensaje
  APORTE mp3 catalex y bluetooth hc 06 katxarix 0 873 18-04-2020, 10:20 AM
Último mensaje: katxarix
  CONSULTA AUMENTAR ALCANCE MÓDULO BLUETOOTH AT-09 CON ANTENA Alvaro Braca 3 2,704 14-03-2019, 09:12 AM
Último mensaje: Merenat
  APORTE Control de Persiana por bluetooth kuadri 0 1,467 16-06-2018, 11:33 PM
Último mensaje: kuadri
  CONSULTA ayuda con modulo bluetooth f-6188 kcho26 0 1,405 25-02-2018, 07:29 PM
Último mensaje: kcho26
  medidor de distancia a con bluetooth o wiffi homer32 4 3,107 28-10-2017, 11:28 AM
Último mensaje: homer32