Show Posts
Pages: 1 2 [3] 4 5 ... 26
31  Using Arduino / Networking, Protocols, and Devices / Version 5.0 coming soon on: June 14, 2014, 03:03:17 pm
Version 5.0 to be released

Early Warning

Backgroung:
Initial communication protocol was developped one year ago
At that time the App was simple (two buttons only, joystick values coded on a single Byte, no feedback communication from Arduino to Android)
Time has evolved, with added features, transmitted data amount has rapidly inflated

In some situations (RF noise environment) Arduino may receive erratic values and joystick values may be seen as button commands

Version 5.0 will feature a pure ASCII transmission protocol and definitely address this problem

This new version will be online next week
For those who want to anticipate and start modifying their code,
I will post the new communication protocol, together with the relevant demo sketch (AndroTest V2.0)
32  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 14, 2014, 12:06:44 pm
Quote
Would it be possible for you to set it to sensorLandscape instead, that way it will automatically flip if the user turns their device upside down
Thanks joepro for this suggestion, makes a lot of sense, will definitely be included in V5.0


Quote
However the Joystick BT Commander app looks nothing like my UI design/theme, most notably you have a dark theme while my UI uses a "light" theme with a white background.
Let me have the code snippet with your theme definition
33  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 13, 2014, 05:04:45 am
@billcat
Quote
But there is just one little problem....have a look at the screenshots  smiley-grin

Second try
Check your mail  smiley-wink
34  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 12, 2014, 03:08:17 pm
Quote
But there is just one little problem....have a look at the screenshots  smiley-grin

Oops... Looks pretty much the same  smiley-red
Seems I edited the wrong template
Let me have another try
35  Using Arduino / Networking, Protocols, and Devices / Pan & Tilt demo on: June 12, 2014, 02:07:23 pm
@thornlv

I updated the Andro_Pan&Tilt code to make it compatible with Joystick BT commander V4.0,
should work right out of the box  smiley-wink

EDIT:   now  Android BT Commander V5.x  compatible

Code:
#define VERSION     "\n\nAndro_Pan&Tilt V3.6 - @kas2014\n** Stepper demo for V5.x App **"

// Controls two servo motors

// V3.6: Android BT Commander V5.X compatible, no button data management
// V3.0: Android BT Commander V3.X compatible, no button data management
// V2.5 can receive both Byte & Integer data
// V2.0: removed SoftwareSerial

// Android BT Commander settings:
// Options/Options for advanced users/Data Range        >>>  -100 to +100
// Options/Options for advanced users/Refresh interval  >>>  50ms

//  Arduino pin #0 to TX BlueTooth module
// BT TX to be disconnected from D0 during sketch upload

#include <Servo.h>

boolean    DEBUG =         true;

#define    pinServo_X     9
#define    pinServo_Y     10
#define    STX            0x02
#define    ETX            0x03
#define    MIN_Y          45             // vertical move limitation
#define    MAX_Y          180
#define    ZERO_Y         60             // vertical offset

byte cmd[8] = {0, 0, 0, 0, 0, 0, 0, 0};
Servo myservoX;                         // create servo objects
Servo myservoY;

void setup()  {
  Serial.begin(57600);
  myservoX.attach(pinServo_X);  
  myservoY.attach(pinServo_Y);  
  if(DEBUG)    Serial.println(VERSION);
}

void loop() {
   if(Serial.available())  {                            // data received from smartphone
    delay(2);
    cmd[0] =  Serial.read();  
    if(cmd[0] == STX)  {
      int i=1;      
      while(Serial.available())  {
        delay(1);
        cmd[i] = Serial.read();
        if(cmd[i]>127 || i>7)                 break;     // Communication error
        if((cmd[i]==ETX) && (i==2 || i==7))   break;     // Button or Joystick data
        i++;
      }
      if(i==7)     setServoPosition(cmd);
    }
  }
}

void setServoPosition(byte data[8])    {
  int joyX = (data[1]-48)*100 + (data[2]-48)*10 + (data[3]-48);       // obtain the Int from the ASCII representation
  int joyY = (data[4]-48)*100 + (data[5]-48)*10 + (data[6]-48);
  joyX = joyX - 200;                                                  // Offset to avoid
  joyY = joyY - 200;                                                  // transmitting negative numbers

  if(joyX<-100 || joyX>100 || joyY<-100 || joyY>100)     return;      // commmunication error
  
  joyX = map(joyX, -100, 100, 180, 0);   //  << adjust to change motor direction
  joyY = map(joyY, -100, 100, 0, 180);   //  <<

  joyY+=ZERO_Y;
  joyY = constrain(joyY, MIN_Y, MAX_Y);
  myservoX.write(joyX);
  myservoY.write(joyY);
  if(DEBUG)    {Serial.print(joyX); Serial.print(", "); Serial.println(joyY);}
}

Tell me if it works
36  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 12, 2014, 12:13:55 pm
@john_lenfr
Quote
Ok, c'est bien l'appli avec le retour vidéo possible?
oops... désolé  smiley-red

The video App is not yet mainstream and will be available after Joystick BT Commander V5.0 release
Not too familiar with FPV equipment...

Video is acquired by any standalone IP camera, or any Android device with integrated camera + IP webcam App
Stream is sent via WiFi to the App through a router (for IP cameras) or directly (for Android cameras)

I use this mini router

Did you already test Joystick BT Commander V4.0 ??


37  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 12, 2014, 08:05:53 am
Quote
Hi,
I can't find the Total RC Commander apk on GooglePlay, is that normal?

https://play.google.com/store/apps/details?id=org.projectproto.btjoystick&feature=search_result

Just checked, still there  smiley-wink


I should really change this V1.0 photo  smiley-roll
38  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 12, 2014, 01:21:31 am
@billcat
Quote
Quote
I can easily compile a "billcat's special" with fully visible joystick
Let me know   smiley-wink
 smiley-mr-green smiley-mr-green    
Greetings Kas, well I would feel too guilty to ask,

Check your mail  smiley-cool


@all
Please post a screenshot of the App
This will help me to optimize screen layout

39  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 12, 2014, 12:52:03 am
Hi Vic,

First, congratulation for your very professional work
I went on your flickr gallery and I am impressed  smiley-eek  smiley-eek  smiley-eek



Back to your gimball project
It should basically operate as this pan/tilt demo project

Let me have a link to your tripod


40  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 10, 2014, 03:33:16 pm
Hi billcat   smiley

Thanks for the info
I did know that Fire OS is based on Android, but I wasn't too sure it would work

Quote
The joystick is a bit far to the right and may interfere with the menu there, I am not sure yet
I can easily compile a "billcat's special" with fully visible joystick
Let me know  smiley-wink
41  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 04, 2014, 01:44:44 pm
Quote
I was wondering if you are able to help me. If so, I can email you the code and explain more about the problem I got.
Obviously if we get it to work, we share it here for everyone else to use

Hi jaapdemaat,
Let me have your email address via PM
42  Community / Exhibition / Gallery / Re: Android controlled RC tank with on-board Video on: June 04, 2014, 03:41:21 am
This sketch has been updated to AndroTest.ino V1.41

Code:
#define VERSION     "AndroTest V1.41A - @kas2014\ndemo for V4.X  (6 button version)"


// V1.41A Sabertooth version
// V1.3A Sabertooth version
// Demo setup: motor only, no buttons

// Arduino pin#2 to TX BlueTooth module
// Arduino pin#3 to RX BlueTooth module
// make sure your BT board is set @57600 bps
// better remove SoftSerial for PWM based projects

// For Mega 2560:
// remove   #include "SoftwareSerial.h", SoftwareSerial mySerial(2,3);
// search/replace  mySerial  >> Serial1
// pin#18 to RX bluetooth module, pin#19 to TX bluetooth module

#include "SoftwareSerial.h"

#include <Servo.h>                // Sabertooth  XXX
Servo motor_R;                    // Sabertooth  XXX
Servo motor_L;                    // Sabertooth  XXX
#define    PWM_R         5        // Sabertooth  XXX  PWM output
#define    PWM_L         6        // Sabertooth  XXX  PWM output

#define    STX          0x01
#define    ETX          0x00
#define    ledPin       13
#define    SLOW         1000                           // Datafields refresh rate (ms)
#define    FAST         250                            // Datafields refresh rate (ms)

boolean DEBUG = false;

SoftwareSerial mySerial(2,3);                           // BlueTooth module: pin#2=TX pin#3=RX
int i=0;
byte cmd[6] = {0, 0, 0, 0, 0, 0};                       // bytes received
//byte buttonStatus = 0;                                  // first Byte sent to Android device
//long previousMillis = 0;                                // will store last time Buttons status was updated
//boolean setButtonFeedback = false;                      // momentary buttons feedback to Android device
//long sendInterval = SLOW;                               // interval between Buttons status transmission (milliseconds)
//String displayStatus = "xxxx";                          // message to Android device

void setup()  {
  Serial.begin(57600);
  mySerial.begin(57600);                                // 57600 = max value for softserial
  pinMode(ledPin, OUTPUT);     
  Serial.println(VERSION);
  motor_R.attach(PWM_R);             // Sabertooth  XXX
  motor_R.attach(PWM_L);             // Sabertooth  XXX
}

void loop() {
  if(mySerial.available())  {                            // data received from smartphone
    delay(2);                                                              //  <<mod XXXXXXXX
    cmd[0] =  mySerial.read(); 
    if(cmd[0] == STX)  {
      i=1;     
      while(mySerial.available())  {
        delay(1);                                                          //  <<mod XXXXXXXX
        cmd[i] = mySerial.read();
        if(cmd[i]>127 || i>5)                               break;   // Communication error << XXX Mod
        if((cmd[i]==ETX) && ((i==2 && cmd[1]>2) || i==5))   break;   // Button or Joystick data
        i++;
      }
      if     (i==2 && cmd[1]>48 && cmd[1]<68)     getButtonState(cmd[1]);                         // 3 Bytes
      else if(i==5 && cmd[1]<3  && cmd[3]<3 )     getJoystickState(cmd);                          // 6 Bytes
      if(DEBUG)       printDebug(i);
    }
  }
  sendBlueToothData();                                                       //  <<mod XXXXXXXX
}


void getJoystickState(byte data[5])    {
  int joyX = (data[1]<<7) + data[2];
  int joyY = (data[3]<<7) + data[4];
  joyX = joyX - 200;               // Offset to avoid
  joyY = joyY - 200;               // transmitting negative numbers

  if(!DEBUG)  {
    Serial.print("Joystick position:  ");
    Serial.print(joyX); 
    Serial.print(", "); 
    Serial.println(joyY);
  }
 
// Your code here ...

  joyX = map(joyX, -100, 100, 0, 180);             // Sabertooth  XXX
  joyY = map(joyY, -100, 100, 0, 180);             // Sabertooth  XXX
 
// 180: full forward,  0: full reverse, 90: stop
  motor_R.write(joyX);                             // Sabertooth  XXX
  motor_L.write(joyY);                             // Sabertooth  XXX
}

void getButtonState(int bStatus)  {
  // do nothing
}

void sendBlueToothData()  {
  // do nothing
}

//String getButtonStatusString()  {
//}

//int GetdataInt1()  {              // Data dummy values sent to Android device for demo purpose
//}

//float GetdataFloat2()  {           // Data dummy values sent to Android device for demo purpose
//}

void printDebug(int nByte)  {
  if(nByte ==2)    {   
//    Serial.print("buttonStatus: "); Serial.print(buttonStatus);
//    Serial.print("  bin: "); Serial.println(getButtonStatusString());   
//    Serial.print("Button: < ");
  }
  else if(nByte ==5)  Serial.print("Joystick: < ");
  else                Serial.print("*error*: < ");
  for(int j =0; j<nByte+1; j++) { Serial.print(cmd[j]); Serial.print(" "); }
  Serial.println(">");
}


Quote
When the joystick goes left the bot goes forward, when the joystick goes right the bot goes backward.
The forward and backward movement of the stick does nothing to the bot.
smiley-roll smiley-roll smiley-roll
Left motor should turn Forward/Backward with joystick moving North/South
Right motor should turn Forward/Backward with joystick moving East/West
Double check your cabling and let me know the status
43  Community / Exhibition / Gallery / Re: Android controlled RC tank with on-board Video on: June 02, 2014, 03:15:38 pm
Quote
I really appreciate all your help. Keep up the great work on this fantastic application.
Thanks to you tolisn63, as you are the one who suggested to add Video to Joystick bluetooth Commander
44  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: June 02, 2014, 03:16:41 am
Quote
Hello Kas,

First I would like to say thank you for the great piece of software you have written.  It has made implementing this type of controls into my project SO much easier.

I do have one question for you, but it would probably be better to give you a little background first...

I'm currently developing an autonomous mobile robot platform, with the UI to control it on an Android tablet.  I've developed most of the UI already for my device, and included a button that opens your Joystick BT Commander app directly from within my UI, for when the end user needs to manually control the robot.

However the Joystick BT Commnader app looks nothing like my UI design/theme, most notably you have a dark theme while my UI uses a "light" theme with a white background.

So my question for you is are you planning on implementing any sort of customization in this area into your app in the near future at all?  If not, is there some way that I can change the colors so our software would better compliment eachother?  I know I can go back and redesign my UI to match your app, but for my particular application (outdoors and/or in direct sunlight) a dark theme is a lot harder for the end user to see.

Thanks in advance for any assistance you can provide.  It is greatly appreciated.

Hi joepro
Thanks for the comments
Should be included in V5.0, to be posted within 4 weeks
45  Community / Exhibition / Gallery / Re: Android controlled RC tank with on-board Video on: June 01, 2014, 02:15:51 pm
DHCP Server Setup
Start IP Address     192.168.1.2
End IP Address       192.168.1.254

Alternatively, try unchecking  Enable DHCP server
Pages: 1 2 [3] 4 5 ... 26