View previous topic :: View next topic |
Author |
Message |
RamShop55
Joined: 04 Feb 2020 Posts: 18
|
Explanations about bluetooth modules |
Posted: Thu Feb 06, 2020 1:28 pm |
|
|
Hi guys,
I am using the standard HC05 and HC06 bluetooth modules with RS232 at 9600kbps. When I send something in Proteus, it works and the information is shown on the virtual terminal on the other side. I know Proteus is not good, but unfortunately its all I have. My question is as follows, how does the phone interpret this information, for example if I send "Initialization finished\n\r", how will the phone interpret it and how to use buttons from the phone in order to control some devices? The examples do not cover this part, maybe the correct way to format the question is what is the coding sent and received from the phone? Also any good android app for this will be helpful. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Thu Feb 06, 2020 2:32 pm |
|
|
The phone doesn't.
You need an app on the phone that is configured to talk to the Bluetooth
serial. The data will then be handled by this.
This can have buttons that send strings to control the device. |
|
|
RamShop55
Joined: 04 Feb 2020 Posts: 18
|
|
Posted: Thu Feb 06, 2020 2:52 pm |
|
|
So I have to know what the app uses or if I am using 2 modules to define this by myself.
And how does the pairing part work? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Fri Feb 07, 2020 2:47 am |
|
|
'Pairing', is like waving flags at one another. Imagine the 'Bluetooth'
environment in your location, is like a crowd of people at a dance. Some
just listening to the music, others having conversations with each other.
New person walks in, and can't hear anything over the general racket.
There are other people having conversations, but they will pick up almost
nothing. However they have been told to look out for their friend who will
be waving a blue flag, and they too have such a flag. After a few seconds,
they see the flag and walk over and can then start talking to their friend
over the general 'hubbub'. This is pairing. Makes the two devices actually
start to listen to one another over the background.
Look at:
<http://www.brainboxes.com/faq/items/how-to-i-communicate-with-bluetooth-serial-device-from-android>
The apps that will talk to the device are those that support SPP.
CCS have their own app designed to make setting this up fairly easy.
EZ app Lynx. This is designed to allow you to have things like buttons,
gauges etc., and design how you want this to appear on the phone.
You actually design how you want it to appear on the phone, in your
PIC code. Run the app on the phone and this accepts the commands
from your PIC code to give the display. |
|
|
RamShop55
Joined: 04 Feb 2020 Posts: 18
|
|
Posted: Fri Feb 07, 2020 11:27 am |
|
|
Thank you very much for the explanation. I don't mean to offend you, but I prefer technical explanations with general terms, the dance party is a complete blank for me.
I know what pairing does, I need to understand how it happens. The command that is sent, preferably in binary code, does it go to some register, is it ncessary to apply a rising of falling front and these details which help me to visualize the situation. My previous post was rather stupid actually. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Fri Feb 07, 2020 1:44 pm |
|
|
The paired device appears as a logical 'serial port' device on the
phone. Data srriving on this goes into a software buffer, and if nothing
reads this it eventually will be lost.
A suitable app 'opens' this port, and can then process this data. What
happens to it is depndant on what the app does. |
|
|
RamShop55
Joined: 04 Feb 2020 Posts: 18
|
|
Posted: Fri Feb 07, 2020 4:08 pm |
|
|
Ttelmah wrote: | The paired device appears as a logical 'serial port' device on the
phone. Data srriving on this goes into a software buffer, and if nothing
reads this it eventually will be lost.
A suitable app 'opens' this port, and can then process this data. What
happens to it is depndant on what the app does. |
There are no likes in the forum. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Fri Feb 07, 2020 11:27 pm |
|
|
This forum does not support 'likes'.
If you mean any examples or questions, there have been a couple of
threads about this. There is at least one example with the compiler.
Search the compiler examples directory, for 'ezapp'. This should give
you the example code for this. |
|
|
|