Hola resulta que compre un modulo HC-05 y copie un sketch basico de arduino uno para hacer funcionar el modulo y resulta que nunca enciende(como si no estuviera conectado a ninguna fuente de energia) he probado casi todo y resulta que la unica manera de que muestre alguna ''señal de vida'' es que conecte 5V a VCC y el cable GND a STATE pero aun asi se que no debiera ser asi aparte se calienta tanto que no aguanta 3 segundos hasta que lo desconecto por precaucion y no encuentro nada al respecto en internet
http://forum.arduino.cc/index.php?topic=551242.0
Por favor, muestre una imagen del HC-05, con conexiones eléctrica
Ya lo has preprogramado con comandos AT?
La primera vez que se usa debe, o mas bien, se recomienda que lo programes, ademas de que hay unas instrucciones especificas para esto, te adijunto el codigo para Preprogramar, todos los pasos vienen comentados y explicdos (solo que estan en ingles, espero no sea problema)
//Code for setup and configuration of a HC-05 ~By Giovanni Bernal
//Arduino Bluetooth module
#include <SoftwareSerial.h> //BEFORE CONNECTING the module to +5, run the code and, if your module has a button, keep it pressed and
// connect to +5 while pressing
SoftwareSerial Bluetooth (11, 10); //Tx & Rx of Module
const int LED = 13; //Declare a LED indicator
// Once the code is running and the module is slowly blinking open the Serial monitor ******** Up in the corner
// CONFIGURATION IN SERIAL PANEL: IF AT FIRST NOT WORKS, do not worry, try with other commands and it
// will work with the time
// Write in the Monitor with 9600 BAUD and with "Both NL & CR"
// AT = OK
// AT +NAME:________ (Show or change the name)
// AT +PSWD:________ (Show or change PIN)
// AT +UART:________ (Show or change speed. It should be in 9600,0,0)
// AT +ROLE:________ (Show or change role. Master - Slave)
void setup() {
pinMode (LED, OUTPUT); //Declare Output
Serial.begin(9600); //Declare the monitor
while (!Serial){ //For Leonard's
;
}
Bluetooth.begin(38400); //Bluetooth modules are configured at this speed
Serial.println("Configuration"); //A print indicator
}
void loop() {
if (Bluetooth.available())
Serial.write(Bluetooth.read());
//For transmition and reception of data trough Arduino and Computer
if (Serial.available())
Bluetooth.write(Serial.read());
}
Y si ese no es problema, aqui te dejo un codigo que uso para Bluetooth, aunque este es un poco mascomplicado, pero funciona casi igual que uno normal, si tienes alguna duda con algun codigo no dudes en preguntarme
#include <SoftwareSerial.h> //Include the library for Virtual Tx and Rx
const int led = 13;
const int rele = 2;
const int boom = 4;
char numbers[25]; //Array for the Numbers "State" of selection
String state;
char letters[25]; //Array for the letters "MODE" of selection
String MODE = "mode";
int n = 0; //Counter for letters Array
int num = 0; //Counter for numbers Array
int count = 0; //For blinking indicator Protocol
SoftwareSerial Bluet (11, 10); //Tx & Rx of Bluetooth module
void setup() {
pinMode (led, OUTPUT); //Declare
pinMode (rele, OUTPUT);
pinMode (boom, OUTPUT);
Serial.begin(9600); //Declare the Serial
Bluet.flush(); //"Start" the Bluetooth module
delay (500);
Bluet.begin(9600); //Declare Bluetooth module speed
}
void loop() {
if (Bluet.available() > 0) //If Bluetooth receive Bytes
{
Serial.println("Receiving Bytes..."); //Advice we are receiving Information
if (MODE == "mode"){ //If MODE == mode (For selecting a Protocol)
while (Bluet.available() > 0){ //We are adding characters to letters Array until we have no more bytes
letters[n] = char(Bluet.read()); //Characters = The informaton received by the Module
Serial.println("Byte rcvd = True"); //Just esthetic
n++;
}
MODE = letters; //Once Array is completed, we equal our 'MODE' to the String of Array
Serial.print("\n");
Serial.print("Mode:");
Serial.println (MODE);
Serial.print("\n");
if (!((MODE == "lights") || (MODE == "fan"))) //If our MODE is NOT a valid Protocol
MODE = String ("mode"); //Then, ask again
while (n >= 0){
letters[n] = '\0'; //Clear or Array
if (n == 0)
break; //Prevents our counter to get a negative value
n--;
}
///////////////////////////////////////////// ELSE's TURN ///////////////////////////////////////////
//** IN THIS PART WE TAKE THE NUMBERS SENT AS CHARACTERS (char) DUE TO DIFFICULTIES WITH NUMBERS AND (int)'s **\\
} else{ //If our MODE = A valid Protocol. Then
while (Bluet.available() > 0){ //We are adding characters to numbers Array until we have no more bytes
numbers[num] = char(Bluet.read()); //Characters = The informaton received by the Module
Serial.println("Byte rcvd = True"); //Just esthetic
num++;
}
state = numbers; //Once Array is completed, we equal our 'state' to the String of Array
Serial.print("\n");
Serial.print("State:");
Serial.println(state);
Serial.print("\n");
while (num >= 0){
numbers[num] = '\0'; //Clear or Array
if (num == 0)
break; //Prevents our counter to get a negative value
num--;
}
}
}
///////////////////////////////////////// SELECTION TIME ////////////////////////////////////////
if (MODE != "mode")
{
if (MODE == "lights"){ //If our 'MODE' == "lights" we start the 1st Protocol
//DESCRIPTION:
//This protocol is made on Digital options, ON || OFF
if (count == 0){
delay(300);
digitalWrite (led, HIGH); //Here we generate a Blinking Indicator to our protocol. 1st = 1 Blink
delay(700);
count = 1;
}
if (!((state == "0") || (state == "1"))){ //If any option has been selected we remain in wait mode
digitalWrite (led, HIGH);
delay(100);
digitalWrite (led, LOW);
delay(900);
}
if (state == "0"){
digitalWrite (rele, LOW);
digitalWrite (boom, LOW);
}
if (state == "1"){
digitalWrite (rele, HIGH);
digitalWrite (boom, HIGH);
}
}
else if (MODE == "fan"){ //If our 'MODE' == "detonator" we start the 2nd Protocol
//DESCRIPTION:
//This Protocol is made for "Remote Detonator", Once activated, it deactivates for avoiding possible
//electrical fails in the components
if (count == 0){
delay(300);
digitalWrite (led, HIGH);
delay(700); //Here we generate a Blinking Indicator to our protocol. 2nd = 2 Blinks
digitalWrite (led, LOW);
delay(200);
digitalWrite (led, HIGH);
delay(700);
digitalWrite (led, LOW);
count = 1;
}
if (!((state == "0") || (state == "1"))){ //If any option has been selected we remain in wait mode
digitalWrite (led, HIGH);
delay(100);
digitalWrite (led, LOW);
delay(900);
}
if (state == "1"){
digitalWrite (rele, HIGH);
delay (1000);
state = "0";
}
if (state == "0"){
digitalWrite (rele, LOW);
}
}
if (state == "mode"){
MODE = String ("mode");
count = 0;
state = String('\0');
}
}
}
Zhiko:
Hola resulta que compre un modulo HC-05 y copie un sketch basico de arduino uno para hacer funcionar el modulo y resulta que nunca enciende(como si no estuviera conectado a ninguna fuente de energia) he probado casi todo y resulta que la unica manera de que muestre alguna ''señal de vida'' es que conecte 5V a VCC y el cable GND a STATE pero aun asi se que no debiera ser asi aparte se calienta tanto que no aguanta 3 segundos hasta que lo desconecto por precaucion y no encuentro nada al respecto en internet
ESTE ES EL CODIGO QUE ESTOY USANDO QUE POSTEARON MAS ARRIBA
//Code for setup and configuration of a HC-05 ~By Giovanni Bernal
//Arduino Bluetooth module
#include <SoftwareSerial.h> //ANTES DE CONECTAR el módulo a 5V, ejecute el código y, si su módulo tiene un botón, manténgalo presionado y
// conecta a 5V mientras presiona
SoftwareSerial Bluetooth (11, 10); //Tx & Rx of Module
const int LED = 13; //Declare a LED indicator
// Una vez que el código se está ejecutando y el módulo parpadea lentamente, abra el monitor serie ******** Arriba en la esquina
// CONFIGURATION IN SERIAL PANEL: SI AL PRINCIPIO NO FUNCIONA, no se preocupe, intente con otros comandos y
// funcionará con el tiempo
// Write in the Monitor with 9600 BAUD and with "Both NL & CR"
// AT = OK
// AT +NAME:________ (Show or change the name)
// AT +PSWD:________ (Show or change PIN)
// AT +UART:________ (Show or change speed. It should be in 9600,0,0)
// AT +ROLE:________ (Show or change role. Master - Slave)
void setup() {
pinMode (LED, OUTPUT); //Declare Output
Serial.begin(9600); //Declare the monitor
while (!Serial){ //For Leonard's
;
}
Bluetooth.begin(38400); //Bluetooth modules are configured at this speed
Serial.println("Configuration"); //A print indicator
}
void loop() {
if (Bluetooth.available())
Serial.write(Bluetooth.read());
//For transmition and reception of data trough Arduino and Computer
if (Serial.available())
Bluetooth.write(Serial.read());
}
Y ADJUNTE LA FOTO DE COMO HICE LAS CONEXIONES, PD: EL MODULO SIGUE SIN ENCENDER DESPUES DE HACER TODO LO QUE DECIA EL SKETCH :C NO ENCIENDE NI UNA LUZ, ES COMO SI ESTUVIERA MUERTO Y SOLO ENCIENDE CUANDO CONECTO SU STATE A MI GND DE ARDUINO
Zhiko:
la unica manera de que muestre alguna ''señal de vida'' es que conecte 5V a VCC y el cable GND a STATE pero aun asi se que no debiera ser asi aparte se calienta tanto que no aguanta 3 segundos hasta que lo desconecto
Si está utilizando un módulo HC-05 estándar y su LED no está parpadeando a 2Hz, no tiene energía, ni GND, o el módulo está defectuoso. Me imagino que el problema ahora es el último(!)
Cualquier "requisito" para usar comandos AT en la primera instancia es una tontería engañosa. El módulo debería funcionar tal como sale de la caja, y es posible que nunca necesite usar comandos AT, nunca.
AFAIK, HC-05 modules use 3.3v for Tx and Rx, but Arduino pins use 5v. You have to split the voltage with resistors.
Most HC-05 modules require a 5V operating voltage. However, the TX/RX pins work at 3.3V.
Although most modules have on-board current limiting circuit which allows the TX/RX pins to work with 5V signal, a 5V to 3.3V circuit (a simple voltage divider) at the Arduino TX pin is recommended.
The above quote is from here. That is if you haven't fried it by connecting to VCC.
The above is not really relevant. In order to get the the module to turn on and the LED flashing - the ''señal de vida'', all that is required is a kosher power connection. No code, not even an Arduino connected. Hence reply#1. This could be some dopey battery problem.
Igual creo que si conecto el VCC y el GND del modulo al arduino con o sin sketch deberia emitir aun que sea la luz led de encendido pero eso no sucede asi que como no encuentro nada relacionado con eso en internet supongo que esta defectuoso
Zhiko:
Igual creo que si conecto el VCC y el GND del modulo al arduino con o sin sketch deberia emitir aun que sea la luz led de encendido pero eso no sucede asi que como no encuentro nada relacionado con eso en internet supongo que esta defectuoso
I guess you're right!
"Ka-ching!!" $AU 4.41 - envio gratis.........