Luis Daniel Bolaños
Member level 2
- Joined
- Apr 4, 2014
- Messages
- 47
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 8
- Activity points
- 342
Can you post your circuit/ code ... in the mean time check following links
https://www.instructables.com/id/Arduino-AND-Bluetooth-HC-05-Connecting-easily/
https://developer.mbed.org/users/edodm85/notebook/HC-05-bluetooth/
Do you have an USB/Blutooth key on your PC ?
Do you have a PC program to catch the Virtual COM ( like BlueSoleil) ?
is it a true HC05 or HC06 ?
One is only a SLAVE ..
Factory config is SLAVE,SSP mode, so in theory ,
you d'ont have to configure it with AT commands, when using as UART link.
When power on, the led must blink on HC-05
then you paire the HC05 device with your PC application
The led must be fixe = linked to PC
Your PC application must support a virtual COM port
connect it ,to get the PIC UART data .
or you can try to connect with an Android Phone or Tablet (with BlueTooth possibility !).
I wrote an application with Appinventor 1 and another with RFObasic
to drive PIC devices trough UART link .
you can see**broken link removed** some tests about BT link.
Before to use with your PIC, You better have to test your HC05 direct connected to
a PC terminal RS232 trough a Max3223 (3,3V TTL side) adapter
and try to connect to your same PC or another PC with a BT/USB Key.
and test some AT command... to evaluate your device by yourself.
because HC-05 name cover many different version..
and RPC vendor doesn't provide the own Datasheet .. of there product.
void main( void )
{
//Declaración de variables.
int X=0;
char DATO;
TRISD = 0xFF;
TRISC = 0x00;
PORTC = 0x00;
UART1_Init(9600);
UART1_Write_Text("REGISTRO DE ALARMA");
UART1_Write(13);
UART1_Write(10);
UART1_Write_Text("Estado: DESACTIVADA");
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
while(1)
{
if (PORTD.F0 == 1)
{
X = 0;
PORTC.F0 = 0;
UART1_Write_Text("Estado: DESACTIVADA");
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
delay_ms(500);
}
if (PORTD.F1 == 1)
{
X = 1;
PORTC.F0 = 1;
UART1_Write_Text("Estado: ACTIVADA");
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
delay_ms(500);
}
if (PORTD.F2 == 1 && X == 1)
{
X = 2;
UART1_Write_Text("Estado: SONANDO");
UART1_Write(13);
UART1_Write(10);
UART1_Write_Text("Causa: Puerta conductor");
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
while (PORTD.F0 == 0)
{
PORTC.F1 = 1;
delay_ms(500);
PORTC.F1 = 0;
delay_ms(500);
}
}
}
}
Mine HC05 (sell as a HC05) but is in reality a HC-06 slave only !
can be use at 9600,N,8,1 (factory setting) without any AT command..
but, the main probleme is the Init at Power ON..
sometimes it doesn't blink at power ON.. impossible to paire with other PC or Tablett
and impossible to enter in AT mode..
The Reset pin 34 of the device goes not outside the breakboard
and need a special strap to do , to recover Factory setting
Before to use with your PIC, You better have to test your HC05 direct connected to
a PC terminal RS232 trough a Max3223 (3,3V TTL side) adapter
and try to connect to your same PC or another PC with a BT/USB Key.
and test some AT command... to evaluate your device by yourself.
because HC-05 name cover many different version..
and RPC vendor doesn't provide the own Datasheet .. of there product.
may be they are not ASCII. Convert them into ASCII
Maybe something with baudrate ?
Does the module has 5V TTL pins or is it 3.3V TTL pins and you are interfacing it to 5V TTL pins of PIC ?
The module has 3.3V TTL and the PIC has 5V, so can that be the issue?
Yes, I think that is the issue. Maybe your BT modules is already damaged. I think PIC16LF887 is not available. So, try to use any other PIC18LF device which are 3.3V devices or use a logic level converter between PIC and BT module.
If you are using these modules then it is mentioned that they can work with both 3.3V and 5V TTL devices.
https://www.banggood.com/HC-06-Wire...F-Main-Module-Serial-For-Arduino-p-80364.html
https://www.banggood.com/HC-05-Wire...sceiver-Module-Slave-And-Master-p-908621.html
Code C - [expand] 1 UART1_Init(9600);
Code C - [expand] 1 UART1_Init(9615);
Which is master and which is slave ? BT at PC side is slave ? BT connected to PIC is master ?
Change
Code C - [expand] 1 UART1_Init(9600);
to
Code C - [expand] 1 UART1_Init(9615);
and try.
You might be getting 0.16% error in baudrate in messages window of mikroC. I don't know how much that affects.
Have you read this ?
https://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/
https://www.youtube.com/watch?v=-z_0aU8VHzk
Edit
https://alselectro.wordpress.com/2014/10/21/bluetooth-hc05-how-to-pair-two-modules/
Please zip and post your complete mikroC project files. I will check it once.
Try the attached code. When you tested in Proteus was it working ? What are you using internal RC oscillator or external 8 MHz crystal ?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?