Show Posts
Pages: 1 ... 7 8 [9] 10 11 ... 27
121  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: March 10, 2014, 05:14:27 am
Quote
Joystick BT Commander is working perfectly with the LG G2 phone, the Adafruit  EZ-link 315a bluetooth, and the Parallax Quickstart demo board.
Nice to hear, I started learning microcontrollers with Basic Stamps  smiley
http://forums.parallax.com/showthread.php/103850-Yet-another-balancing-robot?daysprune=-1

Quote
Not sure what "Data XXX" is used for.  Is there any chance the MCU can send and display a serial message in your APP?
YES !!!      see reply #74
Joystick BT Commander listens to the MCU and expect a 4 Byte data frame
            <STX    button status Byte    data Byte (your choice)    ETX>

This is the relevant code snippet in the Arduino demo sketch (V10.3):
Code:
 mySerial.write(STX); mySerial.write((button<<2)+4); mySerial.write(data+4); mySerial.write(ETX); // +4: avoid 0x2 & 0x3

There is another version with 4 data bytes and 6 buttons

For those interested, contact me via PM


Quote
The joystick image is displayed a little above center but that's okay
I need that type of feedback, please let me have a screen shot of the App on your LG G2 phone


122  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: March 07, 2014, 06:35:06 am
@wildatheart
also for billcat and others  smiley-wink
Quote
Hello Kas.

Thank you for sharing your joystick app.  I am reading 6 bytes (decimal)  2, 1, 72, 1, 72, 3.  I understand the 2 & 3 are framing bytes.  And I also understand that 1 is the MSB and 72 is the LSB, and I believe you subtract 200 (decimal) to eliminate negative values.  But I do not understand the relationship between 173 and 0 being at the center.  Would you please tell me how these values relate to 0,0 with stick in center position.

Thank you

Joystick data is transmitted as an integer = 2 Bytes (Most Significant Byte + Less Significant Byte)
according to this data frame:
         <STX  MSB-X  LSB-X  MSB-Y  LSB-Y  ETX>


This is the relevant Android (Java) code snippet from Joystick Bluetooth Commander:
Code:
    final int XvalB = Xval + 200;
     final int YvalB = Yval + 200;
     if((((Xant!=Xval) || (Yant!=Yval)) || (mTimeoutCounter>=mMaxTimeoutCount && mMaxTimeoutCount>-1)))   // joystick position changed, or timeout occurred
     sendMessage( new String(new byte[] {STX, (byte) (XvalB / 128), (byte)(XvalB % 128), (byte)(YvalB / 128), (byte)(YvalB % 128), ETX } ));

So, for Xval=0 Yval=0:
  XvalB = YvalB = 200
  XvalB / 128 = YvalB / 128 = 1
  XvalB % 128 = XvalB % 128 = 72
Data frame:   <2  1  72  1  72  3>

for Xval=100 Yval=100:
  XvalB = YvalB = 300
  XvalB / 128 = YvalB / 128 = 2
  XvalB % 128 = XvalB % 128 = 44
Data frame:   <2  2  44  2  44  3>

The data frame is send via BlueTooth to the arduino board and decoded.
This is the Arduino code snippet from Joystick Bluetooth Commander:
Code:
 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

VoilĂ     smiley
Should you have additional questions, let me know

EDIT:
The 6 button, 4 data field App and the video App both have a slightly different protocol
(STX & ETX values are different)
123  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: March 02, 2014, 09:55:50 am
Quote
It may be off/topic but I hope you don't mind if I put a link to my robot here: https://www.youtube.com/watch?v=E7C9-4SR41o&feature=youtube_gdata_player
You are very welcome  smiley

This his my own work in progress:


The bot is based on a Rover 5 frame
PID motor control yet to be finalised
124  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: February 27, 2014, 04:08:54 pm
@Bill
thanks for the feedback

Quote
I think the joystick may still be moved slightly more to the right yet.
The version I sent you yesterday should take care of that

Quote
I also think there may be a slight problem when choosing to view the data  as bytes sent....see screenshot.  Seems to be missing the closing ")"  and possibly some data
Can see that, to be fixed in next revision

Quote
Perhaps I am mistaken, I still remain very unclear on how 1's and 0's are sent and received!
Welcome is the communication protocols Univers  smiley-twist smiley-twist smiley-twist

Quote
I cannot seem to get anything out of the haptic feedback options,
This option brings a vibrating feedback when moving the joystick
It is device dependant (works on my Motorola G, doesn't work on my Galaxy Tab3)
This feature is useless, to be removed in next build

Quote
Also, I do have some interest regarding the Beta testing for video.  I do not own an IP camera, but that is a simple fix  smiley-money
Let me know when you are ready


@powermik
Quote
Just (re-)discovered your software and this thread. Is there a possibility for a second joystick?
Sorry no plan for a second joystick
As most of us, my limiting factor is time  smiley-neutral
I am currently building a R/C tank with built in IP camera; my focus is embeding the video stream in the App
125  Using Arduino / Networking, Protocols, and Devices / Call for beta tester(s) on: February 25, 2014, 01:33:16 am
I am finalising the video embeded application



and need another beta tester with a different IP camera brand (Foscam or others), not Wanscam
Please contact me via PM
126  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: February 12, 2014, 12:07:46 pm
Quote
hi, bro estoy tratando de usar tu app de android, es la mejor que e visto, con la parte de los botones no tengo problemas pero no entiendo como usar la el joystick para controlar motores dc con un puente H, si me pudieras dar una orientacion seria exelente, es lo que me falta para terminar el proyecto, te dejo el link del puente h que yo uso.
http://www.pololu.com/product/713


Hi nemesis159

For general matters such as DC motor control, Google is your best friend  smiley-wink
This is a quick basic example for one motor, using joyY (joystick vertical moves)
Pin configuration is based on 328P chip



Code:
*** AndroLED V10.3 modification: ***

/* add this code in the define section */
#define AIN1  4   // connect AIN1 to Arduino pin 4 ...
#define AIN2  5
#define PWMA  6
#define STBY  7
 

/* add this code in the setup function */
pinMode(AIN1,OUTPUT);
pinMode(AIN2,OUTPUT);
pinMode(PWMA,OUTPUT);
pinMode(STBY,OUTPUT);
digitalWrite(STBY, HIGH);


/* replace getJoystickState() with this one */
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
  
  joyY = map(joyY, -100, +100, -255, 255);
  joyX = map(joyX, -100, +100, -255, 255);
 
  if(!DEBUG)  {
    Serial.print("Joystick data:  ");
    Serial.print(joyX);  
    Serial.print(", ");  
    Serial.println(joyY);
  }

  if(joyY > 0) {
    digitalWrite (AIN1,HIGH);
    digitalWrite (AIN2,LOW);
  }  else if(joyY < 0)  {
    digitalWrite (AIN1,LOW);
    digitalWrite (AIN2,HIGH);
  }  else  {
    digitalWrite (AIN1,LOW);
    digitalWrite (AIN2,LOW);

  analogWrite(PWMA,joyY);
}

Option/Data Range should be set to -100 +100

Please note that DC motors do not work well with low PWM values
Should you have motors with built in rotary encoders, consider adding PID control
Full discussion here

Let us know how it works (can't test it now)
127  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: February 12, 2014, 09:34:23 am
@Billcat,
Based on your feedback, I will slightly move the joystick on the right, for the next release
I will appreciate you test the app when you have time (no rush smiley-wink)

@nemesis159
I will answer you questions later today
128  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: January 28, 2014, 05:03:50 am
Quote
I had just been thinking it would be great if there were a few more buttons, and a way to send more data info.  
Do you know if this version would work with my galaxy s3 and if so, is it also available on the google store?

hi Billcat
Check your mail
Six buttons + 4 data bytes  smiley-wink

This is how it looks on my Sony Xperia Mini (3" 320X480)


Please let me have a screen shot from your Samsung galaxy S3 (4.8" 1280X720)

129  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: January 27, 2014, 03:47:52 pm
Quote
But refuse to pair your app..
Not sure I understand
Pairing is an operation between your phone and the BT card
Apps are not involved in this process
Do you mean "connect" ??
Please clarify
Also let me know at which step (1 to 10) you are getting in trouble

Quote
so i belive the BT Joystick app is not compatible with Android 2.3.5
The app is compatible with Android V2.2 (API level 8 ) and higher

Quote
even so...if i had BT connection i couldn't get any movement ,joystick or Leds.
So you got connected ??
Please clarify

Quote
Could you post the first versions of the Bluetooth Joystick Aplicacion so i can trie it out?
Sure, let me have your email via PM
130  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: January 24, 2014, 12:30:42 pm
No needs to load any sketch, this is a pure RF affair between Bluetooth module and Android device  smiley-wink
Arduino board is not involved at this stage

 1- Just make sure to connect 3V + Ground to BT board
 2- BT board led should blink red
 3- Pair the Android device with BT board, if not already done
 4- Open BT Joystick Commander
 5- Make sure "Option for advanced users/Auto connect" is unchecked
 6- (exit/relaunch the application if any change)
 7- Press "connect", make sure you see your BT device in the paired section
 8- Select your BT device
 9- BT device led should change from blinking to solid red
 10- Android BT Commander should report: "connected to XXXXXX"

Let me know the outcome
131  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: January 21, 2014, 01:31:26 am
Quote
This is looking better and better Kas, i belive you should go for the app,...
...,so one again,im telling you,this app will have succes,you should look at how many visit this post had.Nice job..Thank you  smiley-wink
Thanks juycce for the kind word  smiley-cool
The App is ready, but rather demanding in term of processing power (bluetooth + wifi)
Together with tolisn63 we are busy optimising the code

@all
Any candidate as a second beta tester ??
required:
 - high end tablet (google, Samsung...)
 - a different IP camera (not Wanscam)
132  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: January 17, 2014, 02:51:17 am
Quote
Works perfect!  Thanks for the fix, I am now able to do what I want with the leds I mentioned
@billcat
Glad it now works  smiley smiley smiley

@all
AndroLEDV10.2 introduced a nasty bug: buttonStatus was both declared as global and local
buttonStatus (global) was therefore never updated  smiley-red
Please  discard V10.2 and download V10.3 (see reply #129)

Quote
Now I need to address the r/c servo scenario. I will try to figure it out myself first, but will probably end up needing advice on that later
Joystick Bluetooth Commander was specificaly developped for driving up to two r/c servo's. should you have any problem with the code, please ask  smiley-wink


Quote
I just now noticed your recent proposed "total rc commander", which looks   smiley-grin smiley-grin smiley-grin.  I had just been thinking it would be great if there were a few more buttons, and a way to send more data info.  
Do you know if this version would work with my galaxy s3 and if so, is it also available on the google store?
Total RC Commander (with video stream display) is in development with tolisn63 support, now nearly ready
I invested quite a lot of time (and some money) in this project  smiley-roll
My plan is to propose this application on Google Store for a couple of bucks, but I am concerned by Google privacy policy...

@all
Should you be interested by this App, please contact me via PM
133  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: January 15, 2014, 12:30:27 pm
Quote
Great News

I got it working with this URL
http://IPaddress:port/videostream.cgi?user=admin&pwd=&resolution=32&rate=0

Now, let me think out-loud some functionality questions if I may.

1. is it possible to increase the number of buttons ?
2. What data can the controller poll?
can I split it up and show for example
Battery=
Heading=
Lasers=
Mode=
Control=
e.t.c

3. Can you increase the video size ?
4. Can you decrease the size of the joystick ? (to conserve space ?)
5. Can you add another option so instead of a joystick it shows 4 arrows to control the bot?
6. Is it possible to include toggle indicators ?

Sorry for all the loud thinking but I'm really exited with this. I was searching for something like this for a long time.
Thanks very much for all you hard work and sharing

OK  smiley-wink

Previous design:



Proposed layout based on your comments:


 - 640X480 video stream
 - 1 joystick
 - 6 buttons (latch or momentary)
 - 4 robot parameter displays sent back from Arduino (voltage, heading, rpm, temp ...)


Quote
Actually I had to lower the resolution of the camera (320x240) because there was a terrible video lag of about 1 second or so
I don't get any lag with my Xperia Mini configured as an IP camera, check your camera settings, you may have to reduce fps value

Please let me have your comments
Thanks again for your suggestions and your positive feedback  



134  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: January 14, 2014, 04:25:34 pm
Quote
best wishes and thanks again for the cool app
Thanks billcat
Please let us have your feedback whenever you can
135  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: January 13, 2014, 09:47:43 am
Hi billcat

I finally could reproduce the problem, my fault   smiley-red
Please download and run attached sketch (V10.3)

 - button #1 controls on board LED (D13)
 - button #2 controls debug mode (output to Serial Monitor)
 - button #3 and #4 are just configured as push button (momentary contact)

Please let me know the outcome, especially for button #1
Pages: 1 ... 7 8 [9] 10 11 ... 27