Typical Usage

Help Index

Just to let you know how BTInterface works, here is a simple example of a typical usage scenario.

Your micro controller device is turned on and ready to connect via Bluetooth. You run BTInterface on your android device (phone or tablet) and press the Connect button which makes BTInterface connect and send the text string btinterface to your micro controller (or other device) which is listening.

Upon receiving the text string ‘btinterface’ your remote device now knows that it is connected so it sends a command to make BTInterface change to the required ‘screen’ and some more commands to configure the screen and the button labels etc. For example it might issue commands to hide some of the buttons, adjust the position of the slidebar and perhaps put some text in one or two of the labels next to the buttons (there are labels next to the buttons but you can’t see them until you put some text in them).

Now on your Android device you are looking at a configured screen with buttons and perhaps a slidebar control etc. when you activate any of the controls, such as pressing a button then a command is sent over the bluetooth serial interface to your remote device to tell it which control you have activated.

The remote device can then act on that information so for example if the user pressed button 1 on the android device the command b1 would be sent to the remote device which is in a loop listening for these commands, then the remote device upon receiving this command might for example turn on a relay and then perhaps send a command back to BTInterface to play a sound effect or popup a message or speak some text or all of the above.

Let’s say that a relay is connected to a coffee machine which is all setup and loaded, ready to go.

On connecting the remote device might send these commands to BTInterface:

screen1   

b1 Coffee On

And this would cause BTInterface to display screen1 and change the text on button1 to read Coffee On.

Then when the user presses the ‘Coffee On’ button the command b1 is sent to the remote device, when the remote device sees this command it is programmed to turn on the relay and then it could send these commands back over the bluetooth link to BTInterface:

sfx1

toast Coffee Machine Turned On!

say the coffee machine has been turned on.

b1 Coffee Off

Where these commands cause BTInterface to play sound effect number one (sfx1) then popup a message (toast) with the words Coffee Machine Turned On! and then cause the android device to speak the words (say) “the coffee machine has been turned on” and then change the label on button one to read Coffee Off (instead of Coffee On) so that if the micro controller receives the command b1 again it knows to turn the relay off again.

That is obviously a very simple example to give you an idea of how easy and fun it is to use BTInterface.

Oh and just one thing, if your android device has the ability to send/receive SMS (text) messages (if your android device is a phone rather than a tablet) then you could turn the coffee machine on from anywhere in the world by sending a text message to your android device running BTInterface where the text message would look like this:

bti b1

Then upon receiving this text message BTInterface would know to send the command b1 over the bluetooth link to the remote device.

BTInterface can do this as it is always listening for text messages, when it finds one that begins with the password which in this case is bti then it takes that message and treats its contents as one or a series of commands. See Using SMS

So I hope you can start to see the fun possibilities here.

The steps are:

Remote device receives the string btinterface and knows it is connected.

It then sends a series of commands to setup the screen, it then sits in a loop listening for commands from BTInterface so that it can act on these commands etc.

Easy!

Help Index