Go Down

Topic: Where to advertise my android bluetooth interface software? (Read 7 times) previous topic - next topic



jack_fr  has made it, looks good!


Yay! you got it working! welldone.

As I thought, your module can:
•User can connect 3.3 to 5VDC and connect TX and RX to your control IO (general 3.3 to 5V digital input output of MCU or arduino IO is ok, or general TLL IO)
They're pretty indestructable :) You can connect them to 3.3volt or 5volt logic with no problems.

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.

This is exactly what I need, someone to constructively criticise so that I can figure out what people want and what they need to fine tune BTInterface to be the best that it can be.


I shall put another panel of options in the settings (Menu button/Settings) where I'll make both the 'connected' annoying sound and the 'disconnected' annoying sound optional :D

Actually I think I'll make them numbers so that you can choose your own annoying sound effects :D (or leave them blank for none).

Thanks Michael, please keep the ideas coming!


Feb 03, 2013, 05:00 am Last Edit: Feb 03, 2013, 05:06 am by MichaelMeissner Reason: 1
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:
Code: [Select]

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 pressed
if(intMode == 1) { 'then I know that b1 has been pressed while I'm in Mode1 so I'll do a mode1 button1 press thing
send("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:
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.

Here is the actual sketch from my 'A little Scary' video ... please forgive the prehistoric programming techniques :) I've never done C/C++ before.
Code: [Select]
#include <SoftwareSerial.h>
#include <Servo.h>
#include <stdlib.h>

Servo myservo;
SoftwareSerial softSerial(10, 11); // RX, TX
String command = "";
int r1 = 0;
int RelayPin = 2;
int val;
int pr1 = 3;
int pr2 = 4;
int pb1 = 5;
int pb2 = 6;

void setup() 
  Serial.begin(9600); //Remember to set the Arduino Serial Monitor to 9600 Baud and no line ending if you want to get AT commands to work before you connect.
  softSerial.begin(9600); // SoftwareSerial "com port" data rate. JY-MCU v1.03 defaults to 9600.
  softSerial.println("Arduino Ready!");
  pinMode(2, OUTPUT);
  pinMode(pr1, INPUT_PULLUP);
  pinMode(pr2, INPUT_PULLUP);
  pinMode(pb1, INPUT_PULLUP);
  pinMode(pb2, INPUT_PULLUP);
  digitalWrite(RelayPin, LOW);
void screen1set(){
void loop()

  if (Serial.available()) softSerial.write(Serial.read());
  while(softSerial.available() > 0) { // While there is more to be read, keep reading.
    command += (char)softSerial.read();

  if(command != "") Serial.println(command);
  if(command == "btinterface") screen1set(); //
  if(digitalRead(pr1) == LOW){
    send("say you pressed, red? 1.");
    send("say stand by. I shall initiate the turning on and off of relay 1.");
    send("say in. 5. 4. 3. 2. 1. ");
    command = "b1";
  if(digitalRead(pr2) == LOW){
    send("say self destruct sequence aborted. phew!");
  if(digitalRead(pb1) == LOW){
    send("say no? that was a blackwon. stupid?");
  if(digitalRead(pb2) == LOW){
    send("say self destruct sequence has been initiated. this system will self destruct in 30 seconds. press any red button to abort self destruct.");
  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);
    send("l4 " + command.substring(2));
  if(command == "b2") {
   send("sms 07951123456 This apparatus will self destruct in 10 seconds!");
   digitalWrite(RelayPin, HIGH);
  if(command == "b1"){
    if(r1 == 0){
      r1 = 1;
      send("b1 Relay Off"); 
      digitalWrite(RelayPin, HIGH);
    if(r1 == 1){
      r1 = 0;
      send("b1 Relay On"); 
      digitalWrite(RelayPin, LOW);
  if(command == "b3") send("say Hello Ian. Remember to get to work on be tee interface?");
  command = "";
}// End Loop

int stringToNumber(String thisString) {
  int i, value = 0, length;
  length = thisString.length();
  for(i=0; i<length; i++) {
    value = (10*value) + thisString.charAt(i)-(int) '0';
  return value;

void send(String s){


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:

issue the clear command:


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.

Jetduino  :D


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.

Go Up