UpdateI have figured out how to connect it to PCs and Laptops using built-in Bluetooth or a dongle. http://btinterface.com/BTInterface/forum/viewtopic.php?f=2&t=23&p=40#p40Will be figuring out how to do this with the Raspberry Pi next.Will be brushing off the C# skills to make a windows program to use it with.Special offer on Basic4android for anyone wishing to program their own Android apps. See this thread.

Hi folks.

I don't want to tread on any toes.

I've made some software for android phones which I will want to sell on the Google Play Store though there will be a free trial version which has nag screens but no advertising.

The idea is that you use a bluetooth serial module or shield and it will work with the Arduino (which I'm testing it on now) or any other uController with a bluetooth module.

Would it be ok to advertise it here?

I would like to get some people to try it and let me know what changes to make to it etc. before I publish it on the Google Play Store, is this the best place to advertise it?

Just to let you know, the app acts as the buttons for the device (don't they all) fully configurable/re-configurable on the fly, get it to send an sms or more excitingly get it to act on a series of commands in a received sms, kind of 'remotely control your remote controlled device' , commands can be sent from the uController to get it to speak (text to speech) and play sound effects etc.

Most importantly, its fun to use and easy in the same spirit as the Arduino.

I was just playing with bluetooth right now (though on my teensy 3.0 and not an official Arduino). I have a HC-05 that I bought off of ebay, and I hook it up to one Teensy's 3.0 serial ports. Using the Connection Terminal app, I am able to connect to the device, and send/receive text. With your app, it never pairs with the HC-05, and it only sees my my wife/daughter's phones and not the HC-05.

Specifically because you can change its mode between Master and Slave. I may have to get me one of those

The module must be set to Slave mode, I suspect that your other phones can't see it either but otherwise when it is set correctly it should display a fairly rapidly blinking LED (which is blinking evenly) and then it is 'discoverable' so you can go into bluetooth settings and 'scan for devices' to find it.

Firstly congratulations on purchasing both bits! You purchased the bluetooth module plus the backplane where it is really easy to accidentally purchase just the bluetooth module without the backplane or just the backplane without the bluetooth module everyone should read the posts on my forum at BTInterface.com before purchasing one!

By default when its found your module should show up as 'HC-05' (mine is 'Linvor').

Otherwise its the same as mine, you don't need to connect those extra two pins up, Key or State, you just need the power pins and the TX/RX.

Note that even without the TX & RX pins connected to anything and only with the power pins connected if the module is in the correct mode (Slave mode) then the LED will flash and you can scan for it and find it and pair with it from any bluetooth phone (mine flashes at a constant 4 hertz (ish)).

So I suspect that your only problem is that it is in Master mode and as such IT is the one who would do the discovering and not the other phones.

You can change its mode by issuing AT commands to it (modems anyone )

You can issue AT commands only while it is not paired and connected.

Use your terminal app to just send the two letters AT ... try with lower case, then upper case, when it is working sending the command AT will get it to send back 'Ok' You may have to try different settings in your terminal app. For the Arduino its called the 'Serial Monitor' and it may or may not require a 'line ending', I leave mine set to 9600 baud which is the default that the Bluetooth module comes set at and the default that BTinterface works at.

In mine it must be an uppercase AT to get it to return OK

Then you can issue AT commands to it, and one of the commands that you need to issue to yours is the one to put it into Slave mode.

By the way you can also do other cool things with AT commands such as:

AT+VERSION returns the software version' This is a harmless command to send, use this to make sure you are sending AT commands correctly.

Note it must be exactly as above, AT in uppercase then the plus sign and then the word VERSION also in uppercase, then mine returns: OKlinvorV1.5

AT + NAMEname Returns OKname max 20 chars so for example issuing the command AT+NAMEBTInterface.com changes the module's name to BTInterface.com so when it is in Slave/Discover mode that's what you'll see when you scan for devices Remember that when you make your cool doohickeys.

AT+PINxxxx Returns OK setpin You can change the password!!! usually set at 1234 you can use this to change it to something else... be careful!!!

AT+BAUD1 Returns OK1200 'now set to 1200 baud

AT+BAUD2 Returns OK2400 'now set to 2400 baud

table: (you want number 4)

AT+BAUD4 to set it to 9600 baud which is the rate that BTInterface is designed for.

I would leave it set to the default 9600 baud, note that if you change the baud all of a sudden you may start receiving rubbish characters in your serial monitor, that's cause you have to now change the serial monitor's baud rate to match

And now.... tadaaaaa...... you will need to issue the command:

AT+ROLE=0

To set it to slave mode.

Lastly, I lied about those AT commands above, it would seem that they are different for the HC-05 as attested to in this really REALLY horrible manual that I found...

Yes, look at this masterfully crafted wording from the horrid manual about the HC-05:

Quote

Typical method: On some specific conditions, master device and slave device can make pair with each other automatically. (This is the default method.)

So a translation means that the HC-05 by default is set to Master and it can pair automatically with another module set to slave.

This is pretty cool, it means that theoretically you could take both ends of an RS232 cable, replace them with these modules, one in Slave mode and one in Master mode (you would need some TTL to RS232 voltage level converters) and without any other work you have changed the wired connection to a wireless connection.

Earlier societies would have viewed stuff like this as black magic and accused you of witchcraft! (back in the 1980s).

Specifically because you can change its mode between Master and Slave. I may have to get me one of those

Yep, it took some searching to find one that is switchable, and available from a US reseller. Though for an Arduino, I may go with a BT shield, rather than mess around with voltage converters (the HC-05 is 3.3 volt, which is why I was trying it out on the teensy 3.0 first).

The module must be set to Slave mode, I suspect that your other phones can't see it either but otherwise when it is set correctly it should display a fairly rapidly blinking LED (which is blinking evenly) and then it is 'discoverable' so you can go into bluetooth settings and 'scan for devices' to find it.

Maybe I wasn't clear. With my phone, using its normal bluetooth menu, I can find and pair with the HC-05 without doing anything to the HC-05. Similarly, with another app (Connection Terminal by HPS Technologies), I was able to connect to the HC-05 and send characters to the device, and read what it sent. Using the same setup with your trial app installed, it is not able to find the device. So there is something that you are doing that can't find the HC-05, that Connection Terminal and my Samsung Galaxy S II phone can do.

Firstly congratulations on purchasing both bits! You purchased the bluetooth module plus the backplane where it is really easy to accidentally purchase just the bluetooth module without the backplane or just the backplane without the bluetooth module everyone should read the posts on my forum at BTInterface.com before purchasing one!

Yep, I almost purchased one of those backplanes, until it kicked in that price was too low compared to the competition.

By default when its found your module should show up as 'HC-05' (mine is 'Linvor').

Yes. I do plan on changing the name and pass key, eventually, but it did come up as HC-05. As somebody who has connected modems to computers way back to 300 baud modems, and I had setup UUCP connections and created dialer scripts, I was familiar with the Hayes AT instruction set, and I had downloaded the AT commands, but I hadn't gotten around to putting them in the setup function.

Note that even without the TX & RX pins connected to anything and only with the power pins connected if the module is in the correct mode (Slave mode) then the LED will flash and you can scan for it and find it and pair with it from any bluetooth phone (mine flashes at a constant 4 hertz (ish)).

So I suspect that your only problem is that it is in Master mode and as such IT is the one who would do the discovering and not the other phones.

No, the problem is your app doesn't connect when other devices can. It may be because I had the device already listed as being paired with the phone may have interfered with the connection. I did try it with the device already paired and not paired, but I didn't tell the phone to forget the connection.

I would leave it set to the default 9600 baud, note that if you change the baud all of a sudden you may start receiving rubbish characters in your serial monitor, that's cause you have to now change the serial monitor's baud rate to match

IIRC, as a trivia point, the AT letters were chosen by Hayes, because the encoding of 'A' and 'T' (0x41 0x54) allowed the modem to better guess what the baud rate and parity were.

Well being a fellow modem guy you obviously know about AT commands, I built a 300baud modem for my commodore 64 once

If the device is set to slave mode then the only thing I can think of why it might not work with BTInterface is the baudrate.Should be 9600 for BTInterface which is usually the default for these modules.

I suspect that the hardware of these modules is the same and this guy called Byron made a reflasher:http://byron76.blogspot.co.uk/2011/09/hc05-firmware.htmlTo flash the software where I believe I could flash the HC-05 software on to my module which I think is the HC-06 (slave only).If it is the same hardware then I can assure you that it works fine on the 5v Arduino, should work between 3.3 and 6v.

All BTInterface does is start the Android pairing process which you can do manually if you prefer.Once the device is paired it should be just a normal serial bluetooth device although I have noticed that it always says 'paired but not connected' even while it is sending and receiving to it

You say

Quote

the problem is your app doesn't connect when other devices can.

Do you mean 'where other software can' ? Can you connect other apps but not mine?There's another app called ArduinoCommander, can you get that one to work with your module? on the same Android device?Its just that I'm not sure if its something to do with the Android device or if its specific to BTInterface?

Well being a fellow modem guy you obviously know about AT commands, I built a 300baud modem for my commodore 64 once

If the device is set to slave mode then the only thing I can think of why it might not work with BTInterface is the baudrate.Should be 9600 for BTInterface which is usually the default for these modules.

I suspect that the hardware of these modules is the same and this guy called Byron made a reflasher:http://byron76.blogspot.co.uk/2011/09/hc05-firmware.htmlTo flash the software where I believe I could flash the HC-05 software on to my module which I think is the HC-06 (slave only).If it is the same hardware then I can assure you that it works fine on the 5v Arduino, should work between 3.3 and 6v.

All BTInterface does is start the Android pairing process which you can do manually if you prefer.Once the device is paired it should be just a normal serial bluetooth device although I have noticed that it always says 'paired but not connected' even while it is sending and receiving to it

You say

Quote

the problem is your app doesn't connect when other devices can.

Do you mean 'where other software can' ? Can you connect other apps but not mine?There's another app called ArduinoCommander, can you get that one to work with your module? on the same Android device?Its just that I'm not sure if its something to do with the Android device or if its specific to BTInterface?

The app 'Connection Terminal by HPS Technologies' connects fine to the HC-05. As I thought earlier, the fact that I had previously paired the device with the phone might be interfering with BTInterface. When I told the phone to completely forget about HC-05, then BTInterface could pair to it, and I was able to connect. There after, it remembers the HC-05.

I just did a search, and I could not find an Arduino Commander app. There is an Arduino Uno Commander app, but that only works on the USB cable (and it does not work with teensy 3.0).

Note, Connection Terminal can turn on/off the bluetooth device in my phone (Galaxy S II for t-moble), while with BTInterface, you have manually turn on bluetooth before entering the program, or you get a Java error message: Unable to start discovery.

I really, really, really hate that BTInterface makes a sound when connecting and disconnecting. There appears to be no way to shut up the program.

What I really want is to have a set of 'buttons' displayed on the phone, and each button has a text sequence that when pressed, that text is sent. For example, in my test setup, I have 4 LEDs, and if I get 'a'..'d', it turns off the LED, if I get 'A'..'D', it turns on the LED, '*' turns all on, '0' turns all off, and '.'/',' sleep for a given period of time. In fact, I would prefer if there were two texts associated with the button, one for when the button is pressed, and another when it is release after being pressed. In button mode, perhaps have some amount of screen to show the output text. Basically, I want to have remote push buttons, using the phone instead of an infrared controller. I want to swipe to turn on the phone, push a button, and then turn off the phone.

It would be nice to be able to have different text on the display of the buttons than something like '0', '1', etc.

Like the other app, the text output area is flawed in that it doesn't scroll to the bottom when you get new output (and there isn't a scroll bar or other indication you got new output). It is useless (IMHO) if I have to continually scroll down to see new output. At least have an option to automatically scroll down or not like the Arduino Uno Commander does for USB output.

Extra points if you can interpret ANSI text controls to display output in bold, italic, underlined, blinking, and in the 16 colors.

Also, IMHO, on both apps, I find it undesirable to have to enable the keyboard to enter text, and then you have to hit the back arrow key to be able to actually send text. This may be an Android thing, but it is annoying. Yeah, I should have gotten a phone with a real keyboard, but I didn't like the features on the phones with keyboards compared to the Galaxy.

I'm not sure I would ever use the SMS feature, and I do not want the app 'phoning home'.

With BTInterface your main loop would be listening out for the string 'btinterface' this is to detect when it is connected. Then when it heard it you would have a routine to change to screen1 where you could configure the controls.You would hide all the controls that you don't need and change the labels on the buttons etc. and if necessary write some text in the labels that align with the main 4 buttons.

This configuring of screen1 might initially be in a function and then you might have several functions to configure screen1 in different ways.

Pressing any of the buttons will always send that buttons value and this can't be changed so pressing the b1 button will send the string 'b1' over the serial connection.You would be responsible for knowing where you are in your code and what that b1 means at that point.

Here is a simple bit of pseudo code to illustrate where the character ' designates comments:

void loop(){if(command == "btinterface"){ config1() 'if I see the string btinterface then I know that we have a connection, either for the first time or after a disconnect so I'll call the function config1() to configure screen1: intMode = 1 'set variable so that I know I'm in 'config1' mode} 'end of if statement

if(command == "b1") { 'then I know that b1 has been pressedif(intMode == 1) { 'then I know that b1 has been pressed while I'm in Mode1 so I'll do a mode1 button1 press thingsend("say Ooh. I see you are in mode one and that the button which currently reads as. Action One!. has been pressed.")send("sms 0123456789 this is a text message from your microcontroller just to let you know that I am currently in Mode 1 and the button Action One! has been pressed.")'do other Mode1 Action One! things here.'perhaps Action One! needs the screen1 to be reconfigured into mode 2? if so then:config2()intMode == 2}

} 'end of loop

void config1(){send("screen1") 'this causes BTInterface to change to screen1, also if BTInterface was sitting in the background this will cause screen1 to appear, it is only while screen1 is displayed that you can configure its controls.send("pad hide")send("sb hide")send("b1 Action One!") 'this changes the text on button1 (b1) to read Action One!send("b2 Action Two!")send("b3 Action Three!")send("b4 Action Four!")'there, I have finished configuring screen1 into 'config1' mode. } 'end of config1() function.

if(command.startsWith("sb")){ // Then the slidebar has been moved so alter the position of the servo! val = stringToNumber(command.substring(2)); val = map(val, 100, 0, 0, 179); myservo.write(val); send("l4 " + command.substring(2)); }

Like the other app, the text output area is flawed in that it doesn't scroll to the bottom when you get new output

From this I deduce that you are talking about the Terminal screen (in my BTInterface app).

The Terminal screen will mostly be used for debugging to see exactly what your microcontroller sent over the bluetooth link.There is a limitation to the Terminal screen which I don't plan on changing just yet and that is that if a line of text is too long it is lost off the right hand side of the Terminal screen. You do get to see a bit more if you orient to landscape and in the future I may make it sideways scroll but just now this is a limitation.

While the terminal screen is being viewed, and it can be called up even from standby by sending the string 'terminal' to BTInterface, you can send the command 'clear' to clear it.I would call it 'input' rather than output, that is when you receive something from the microcontroller into the terminal screen I'd say that was input and when you enter something into the send field and press send, i'd call that output but tomatoes potatoes I did program it so that upon receiving 'input' from the microcontroller its supposed to scroll down to the last line automatically. Is it not doing that for you? what device are you using?

The Terminal screen can be used for collecting data from a user, you could switch to the terminal screen:send("terminal");

issue the clear command:

send("clear")

and then tell the user what you want:

send("please input your credit card details");send("so that I may syphon off a bit");send("thank you");

and after all this setting up your sketch would be waiting for the user to type something and press the Send button.

In the future I may introduce other 'screens' and cunningly call them names like screen2 screen3 etc. but I feel it necessary at the moment to test the waters with a basic version of BTInterface, get people using that and then see what the popular demands are before making any radical changes, always trying to keep new changes backwards compatible.

I think this first version does pretty good. I may introduce flashy texts and bold and italic and all-singing all-dancing colours and perhaps even have it vibrate when you stick it in your pocket which will be nice but not until I have a clear indication of the direction that people want it to go in

When I get it to control my jet engine oh yes... I will configure screen1 to have just the slidebar (to control the throttle) then b1 will be 'Bendix On' (for the bendix clutch 12v motor that spins the turbine) and when I press it, it will turn the motor on and change the text on b1 to read 'Bendix Off' etc. then b2 will read 'Gas On' which activates the electric valve for the butane/propane starter gas cannister then b3 will read 'Glow On' which turns on the glow plug.

I'm thinking of making b4 into 'Auto Start' so it'll do it all automatically and get the jet running up to a reasonable speed because I put the engine on the back of my moped and its otherwise a bit awkward to do it manually when you're trying to navigate bumpy roads.

While that might be interesting to some, to me it is over-complicating things. If I wanted to do complete custom programming, I would program the Android myself. I don't want to have to send text from the device to program the phone

As I said, I want a remote button interface that sends short sequences (typically 1 character) to the microprocessor at a distance. At the moment, I have one button that I want two different texts sent (one for the button being touched on the screen, and one for it being released), and several toggles where I don't need both up/down, just button being pressed. I want to have as little interaction with the phone as possible, and I need to be able to do it one handed on the phone. Typing in text is 4 different key motions on different parts of the phone, and I would not be able to do it while holding something else in my other hand. Yes, I could do this with a second microprocessor, but that requires another set of batteries, etc.