Show Posts
Pages: 1 ... 10 11 [12] 13 14 ... 26
166  Using Arduino / Networking, Protocols, and Devices / Re: Sending data TO gps on: September 09, 2013, 12:45:32 am
Found the link to the Fastrax NEMA commands, here it is
167  Using Arduino / Networking, Protocols, and Devices / Re: Sending data TO gps on: September 07, 2013, 10:46:27 am
You can talk to your GPS module using NEMA Commands

For my Fastrax UP501 all sentences start with $PMTK
$PMTK251,38400*27<CR><LF>  will set baud rate @38400
$PMTK300,1000,0,0,0,0*1C<CR><LF>   will set fix interval
$PMTK314 ... will select message to be sent (GGL, RMC, GGA...)

Not sure this protocol is valid for your specific GPS module
168  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: September 06, 2013, 01:57:26 pm
Quote
Quote
What about developing the same type of application, but using the android device built in accelerometers
Control would be performed just by tilting the smartphone/tablet.
The joystick would be a "read only" device, reflecting the device inclination.

      This sister application could be called Acc Bluetooth Commander
       Any interest ???

I think that's a great idea.  Or just add an option to the current app to toggle using the accelerometer instead of your finger to control the joystick.

-transfinite

That's another great idea, thanks transfinite
We could call it  "Total BT Commander"   smiley-wink

BTW, any "unexpected behavior" in V3.0 ???
169  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: September 05, 2013, 12:46:45 am
Quote
First I want to thank you for this great app and sharing it for free
Thanks  smiley-wink

Quote
why you don't make joystick ball to turn in circle instead of square like it's now
To get full range at 45°, 135°, 225° and 315°, the joystick moving area HAS to be square.
With a circle, at 45° max values would be 71 (100/1.414) assuming a -100/+100 data range.

Please let me have your phone/tablet model
170  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 31, 2013, 03:10:23 am
I got an interesting comment/suggestion
Quote
What about developing the same type of application, but using the android device built in accelerometers
Control would be performed just by tilting the smartphone/tablet.
The joystick would be a "read only" device, reflecting the device inclination.

This sister application could be called Acc Bluetooth Commander
Any interest ???
171  Community / Exhibition / Gallery / Joystick Bluetooth Commander on: August 31, 2013, 02:23:22 am
Joystick Bluetooth Commander turns a smartphone/tablet into a remote controller for any Arduino board
The project is now mature and ready for the Exhibition section



This Android app is available on Google Play

The applications in the robotic field are endless: Home Automation, R/C cars, robotic arms, balancing robots

Two quick examples:
Pan & tilt robot


BlinkM LED control


Please keep all technical discussion in the original thread
172  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 28, 2013, 12:16:20 pm
This is the complete Arduino demo sketch for V3.0

Code:
// AndroLED V9

// Arduino test sketch for Joystick BT commander
// V9.0: ** Release for Android BT Commander V3.0 AND HIGHER ONLY **

//  Arduino pin#2 to TX BlueTooth module
//  Arduino pin#3 to RX BlueTooth module

#include "SoftwareSerial.h"

#define    DEBUG        false
#define    STX          0x02
#define    ETX          0x03

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
byte dataByte = 0;                    // second Byte sent to Android device
long previousMillis = 0;              // will store last Buttons status was updated

long interval = 1000;                 // interval to transmit Buttons status (milliseconds)

void setup()  {
  Serial.begin(57600);
  mySerial.begin(57600);              // 57600 = max value for softserial
  Serial.println("AndroLED V9 - demo for Joystick BT commander V3.0");
  delay(300);
}

void loop() {
  if(mySerial.available())  {            // received from smartphone
    delay(5);
    cmd[0] =  mySerial.read();  
    if(DEBUG)  Serial.println(cmd[0]);   // to serial monitor
    if(cmd[0] == STX)  {  
      i=1;      
      while(mySerial.available() && ((cmd[i]=mySerial.read()) != ETX)) {
        if(i>5)  break;
        if(DEBUG)    {Serial.print(i); Serial.print(": "); Serial.println(cmd[i]);}
        i++;
      }
    }
    if(i==2)    setLED(cmd[1]);
    else if(i==5)    setJoystick_Int(cmd);  // 6 Bytes
    else Serial.println("****");
  }  else  {
    unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval) {
      dataByte = GetdataByte();
      sendData(buttonStatus, dataByte);
      previousMillis = currentMillis;  
    }
  }
  delay(5);
}

void setLED(int LEDstatus)  {
  switch (LEDstatus) {
    case '1':
      buttonStatus |= B0001;    // Button_1: ON
      Serial.println("Button_1: ON");
      // your code...      
      break;
    case '2':
      buttonStatus &= B1110;    // Button_1: OFF
      Serial.println("Button_1: OFF");
      // your code...      
      break;
    case '3':
      buttonStatus |= B0010;    // Button_2: ON
      Serial.println("Button_2: ON");
      // your code...      
      break;
    case '4':
      buttonStatus &= B1101;    // Button_2: OFF
      Serial.println("Button_2: OFF");
      // your code...      
      break;
    case '5':                    // configured as momentary button
//      buttonStatus |= B0100;     // Button_3: ON
      Serial.println("Button_3: ON");
      // your code...      
      break;
//    case '6':
//      buttonStatus &= B1011;     // Button_3: OFF
//      Serial.println("Button_3: OFF");
//      // your code...      
//      break;
    case '7':                    // configured as momentary button
//      buttonStatus |= B1000;     // Button_4: ON
      Serial.println("Button_4: ON");
      // your code...      
      break;
//    case '8':
//      buttonStatus &= B0111;    // Button_4: OFF
//      Serial.println("Button_4: OFF");
//      // your code...      
//      break;
  }
  sendData(buttonStatus, dataByte);
}

void setJoystick_Int(byte data[5])    {
  // Demo
  int joyX = (data[1]<<7) + data[2];
  int joyY = (data[3]<<7) + data[4];
  joyX = joyX - 200;               // Transmission offset = 110
  joyY = joyY - 200;               // to avoid negative numbers

  Serial.print("Joystick data:  ");
  Serial.print(joyX);  
  Serial.print(", ");  
  Serial.println(joyY);
 
  // Your code here ...
}

byte GetdataByte()  {
  // Demo
  static byte i=0;
  i +=5;
  if(i >100)    i = 0;
  return i;  

  // Your code ...
}

void sendData(byte button, byte data)    {
  mySerial.write(STX); mySerial.write((button<<2)+4); mySerial.write(data+4); mySerial.write(ETX); // +4: avoid 0x2 & 0x3
}

Buttons 1 & 2 are latch buttons
Buttons 3 & 4 are momentary buttons
173  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 26, 2013, 02:24:40 pm
Thanks CHulla

Good luck for this new project  smiley-wink
174  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 25, 2013, 03:18:11 pm
I just received this message via PM:
Quote
Hey kas!

First off all, I would like to say that you have done a great job in creating the app to control robots. I have made mine, which is a car, and glad say that it works well.

I built it using the 2.5 ~ 2.6 version, in which the version still had the (2, 60, 60, 3) format. My phone automatically updated to the 3.0 version, and unfortunately, the robot is not working. As I understand, the actual sent data has changed?

Anyway, going to the point, I would like to request links to the previous versions of the application, just so to test my older code. Is that possible?

Thanks in advance.

-Gin319

The Google Play auto update feature is a real pain smiley-zipper
For those in the same situation, please let me have your email via PM,
I will send you the previous version

Sorry for the trouble
175  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 25, 2013, 03:17:00 am
Quote
Of course now I can divide the range -180 to +180 by 2 in arduino program, but now is new problem: on small resolution it is imposible to achieve this resolution of joystick movement, and value jumps every 2-3 points.. My suggestion is to give range (-90 to 90) instead of 100-100 or 180-180,
I am not sure that reducing Data Range from -180/180 to -90/90 will help increasing servo resolution
Should you want it, let me have your email via PM, I will send you a special build with -90/90 data range for test


Quote
"reset button" can be used for example to make an cannon ...
But now, if there is two-way communication with button status I think this can be done with existing keys and program on arduino.
You got the point, button behavior is define within the Arduino sketch:
 - Latch button (on-off switch):
Code:
void setLED(int LEDstatus)  {
  switch (LEDstatus) {
    case '1':
      buttonStatus |= B0001;    // Button_1: ON
      Serial.println("Button_1: ON");
      // your code...      
      break;
    case '2':
      buttonStatus &= B1110;    // Button_1: OFF
      Serial.println("Button_1: OFF");
      // your code...      
      break;
    ...............
}

 - Momentary button (reset button):
Code:
void setLED(int LEDstatus)  {
  switch (LEDstatus) {
    case '1':
      Serial.println("Button_1: momentary ON");
      // Fire...
      break;
    case '2':
      // no code here (drop Button1 off case)    
      break;
    .......
}

176  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 23, 2013, 10:31:55 am
Android Bluetooth joystick V3.0 is now available on Google Play

I have added servo's -180/180 data range as per starybryg suggestion
To avoid transmitting negative number, data offset has been increased to 200

Code from reply #74
Code:
void setJoystick_Int(byte data[5])    {
  // Demo
  int joyX = (data[1]<<7) + data[2];
  int joyY = (data[3]<<7) + data[4];
  joyX = joyX - 110;               // Transmission offset = 110
  joyY = joyY - 110;               // to avoid negative numbers
  
  Serial.print("Joystick data:  ");
  Serial.print(joyX);  
  Serial.print(", ");  
  Serial.println(joyY);
 
  // Your code here ...
}

should be modified as follow:
Code:
void setJoystick_Int(byte data[5])    {
  // Demo
.......
  joyX = joyX - 200;               // Transmission offset = 200
  joyY = joyY - 200;               // to avoid negative numbers
.......  

  // Your code here ...
}

Should you find any glitch, please let me know
I will also appreciate any feed back, especially for screen layout

Enjoy  smiley-wink
177  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 22, 2013, 03:46:02 pm
Quote
1. Please add to configuration (Options -> Advanced Options.. -> Data Range) the ability to set a higher resolution - 128 or 180. Servos have 180degree and we lose fluidity of movement: currently every change on joystick is 1,8 degree in servo, but servo can move every 1 degree.
Makes sense, I will add -180 +180 Data range in V3.0 (to be published this week end)

Quote
2. If you made this communication two-way with checking button status, please think about adding 2 (or more) "reset" buttons (not "on-off").
Not sure I understand, please elaborate

Quote
3. Autoconnect function will be nice!!:)
AutoConnect is now ready

Quote
4. Can you share developer version of the application? Or better yet- the source code? I do not I program for android, but certainly a lot of people will be grateful.
Will definitely share source code
178  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 21, 2013, 11:49:55 am
Quote
Thank for releasing this fantastic app!
My first steps with Arduino, and with bluetooth were smoother because of your app!!
Thanks for your feedback  smiley-cool


Quote
Is there a recommended post to learn how to control the joytick with servos?
I just posted the Bluetooth robotic dancer source code here

EDIT: Link is now OK
179  Topics / Robotics / Re: Bluetooth robotic dancer on: August 21, 2013, 11:37:01 am
Hi Rosamunda

Here is the Arduino side code:
Code:
// Andro_Pan&Tilt      V2.6
// Arduino test sketch for Joystick BT commander
// Controls two servo motors

// V2.6 can receive both Byte (Joystick BT commander V2.5)& Integer data (V3.0)
// V2.0: removed SoftwareSerial

//  Arduino pin #0  to  TX Bluetooth module

#include <Servo.h>

#define    DEBUG          false

#define    ledPin         13              // LED pin
#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            // horizontal move limitation
#define    ZERO_Y         60

int i=0;
byte cmd[6] = {0, 0, 0, 0, 0, 0};
Servo myservoX;                         // create servo object
Servo myservoY;

void setup()  {
  Serial.begin(57600);
  myservoX.attach(pinServo_X);  
  myservoY.attach(pinServo_Y);  
  pinMode(ledPin, OUTPUT);
  if(DEBUG)  Serial.println("AndroZinZin V2.5");
}

void loop() {
   if(Serial.available())  {            // received from smartphone
    delay(5);
    cmd[0] =  Serial.read();  
//    if(DEBUG)  Serial.println(cmd[0]);   // ** DEBUG **
    if(cmd[0] == STX)  {  
      i=1;      
      while(Serial.available() && ((cmd[i]=Serial.read()) != ETX)) {
        if(i>5)  break;
//        if(DEBUG)    {Serial.print(i); Serial.print(": "); Serial.println(cmd[i]);}  // ** DEBUG **
        i++;
      }
    }
    if(i==2)    setLED(cmd[1]);
    if(i==3)    setPosition_Byte(cmd[1], cmd[2]);  
    if(i==5)    setPosition_Int(cmd[1]*128+cmd[2], cmd[3]*128+cmd[4]);  
  }
  delay(5);
}

void setLED(int LEDstatus)  {
  switch (LEDstatus) {
    case '1':
      Serial.println("Button_1: ON");
      // your code...      
      break;
    case '2':
      Serial.println("Button_1: OFF");
      // your code...      
      break;
    case '3':
      Serial.println("Button_2: ON");
      // your code...      
      break;
    case '4':
      Serial.println("Button_2: OFF");
      // your code...      
      break;
    case '5':
      Serial.println("Button_3: ON");
      // your code...      
      break;
    case '6':
      Serial.println("Button_3: OFF");
      // your code...      
      break;
    case '7':
      Serial.println("Button_4: ON");
      // your code...      
      break;
    case '8':
      Serial.println("Button_4: OFF");
      // your code...      
      break;
  }
}

void setPosition_Byte(byte posX, byte posY)    {    // Joystick BT commander V2.5
  posX = map(posX, 10, 110, 180, 0);
  posY = map(posY, 10, 110, 0, 180);
  posY+=ZERO_Y;
  posY = constrain(posY, MIN_Y, MAX_Y);
  if(DEBUG)  { Serial.print("(Byte) ");  Serial.print(posX);  Serial.print(", ");  Serial.println(posY); } // ** DEBUG **
  myservoX.write(posX);
  myservoY.write(posY);
}

void setPosition_Int(int posX, int posY)    {        // Joystick BT commander V3.0
  posX = map(posX, 10, 210, 180, 0);
  posY = map(posY, 10, 210, 0, 180);
  posY+=ZERO_Y;
  posY = constrain(posY, MIN_Y, MAX_Y);
  if(DEBUG)  { Serial.print("(Int) ");  Serial.print(posX);  Serial.print(", ");  Serial.println(posY); } // ** DEBUG **
  myservoX.write(posX);
  myservoY.write(posY);
}

Let me know the outcome in the Project main thread

Enjoy
180  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 20, 2013, 03:31:39 pm
Quote
its works, perfect! Great, thanks

Thanks!  smiley-wink
Pages: 1 ... 10 11 [12] 13 14 ... 26