Pages: [1] 2 3 ... 22   Go Down
Author Topic: Android Bluetooth joystick  (Read 55104 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Edit:    **  Current Versions  **

         - Joystick bluetooth Commander:     V5.2
         - AndroTest.ino demo sketch:             V2.0

          * New *   Code for Parallax Propeller
 (thanks twm47099)

        - Samsumg Galaxy Tab 4 users,
please look here

  scroll to the end of this message to get latest information


Hi,
I developed an Android application that turns a smartphone into a virtual Bluetooth joystick.
The applications in the robotic field are endless: Home Automation, R/C cars, robotic arms and of course  balancing robots smiley-wink



By default, the device transmits data every 200ms
Data format: [STX  X  Y  ETX]  
example: [0X02  0X2A  0X30  0X03]

The application is available (for free smiley-cool) here
From you smartphone, access Google Store and search for "Joystick bluetooth Commander"

This demo Arduino sketch will parse data on the serial monitor, and control the pin13 LED
Code:
// AndroLED V5
// Arduino test sketch for Joystick BT commander
// LED control for buttons + joystick echo to serial monitor

//    ** deprecated, please use AndroTest_V13.ino **
//    see reply #181



The Hardware setup is rather straightforward, should you need additional info, just let me know

Enjoy

Edit:
Updated Arduino sketch,
 set Baud rate to default 9600
 removed softserial
For sketch upload, don't forget to disconnect board TX from Arduino D0

Edit2:
Joystick Bluetooth Commander Version 2.3 is now compatible with Android V3.X and V4.X (Honeycomb, Ice Cream Sandwich, Jelly Bean)

Edit3:
added   Serial.println("Bluetooth Commander simulation") in setup() for communication testing purpose

Edit4:
Joystick Bluetooth Commander Version 2.4

Four toggle buttons with visual feedback

Change Log and Arduino sketch modification: please refer to reply #51

Edit5:
Joystick Bluetooth Commander Version 2.5


Change Log: refer to reply #70

Edit6:
 Joystick Bluetooth Commander Version 3.0

** major Upgrade **
Joystick Bluetooth Commander is now a full blown two way Bluetooth communication application
Arduino sends back a button status Byte and a user defined data Byte to be displayed on the phone/tablet screen (Bot battery level is a nice candidate)

Communication protocol has changed
Joystick data is now transmitted as an integer = 2 Bytes (Most Significant Byte + Less Significant Byte)
<STX  MSB-X  LSB-X  MSB-Y  LSB-Y  ETX>
Your V2.5 Arduino sketch needs to be modified for V3.0


See full change Log at reply #74
Updated demo Arduino sketch at reply #90

Edit7:
Fixed link to Balancing robot for dummies

Edit8:
New Arduino demo sketch (V10.1)
Improve decoding algorithm, see reply #98

Edit9:
Joystick Bluetooth Commander Version 3.1
Maintenance release, see reply #100

Edit10:
New Arduino demo sketch (V10.3)                    << for Artouste   smiley-wink
Bug fix, see reply #129

Edit11:
Joystick BT Plus  has been released with 6 buttons and 4 data bytes



The actual number of buttons and data fields is adjustable within the Option menu
Fields and buttons labels are fully customizable
See reply #165

Edit11:
Detailed info re Communication Protocol (send and receive)
See reply #154 & #156

Edit12:
Joystick BT Plus (6 buttons, 3 datafields)
and
Total RC Commander (video from IP camera)
are now available see reply #177

 


Edit13:
Joystick BT Plus (up to 6 buttons, up to 3 free format datafields) is now
                     - Joystick bluetooth Commander V4.0 -
and is available on Google Play as a free upgrade.

To allow text datafield, Communication Protocol has changed
Please use and adapt AndroTest_V13.ino demo sketch to your own needs  
  ** deprecated, please use AndroTest_V14.ino **
See reply #181


Edit14:
Communication Protocol for Joystick bluetooth Commander V4.x and Total RC Commander
now fully documented
See reply #188


Edit15:
A video showing tank control using Total RC Commander. has been posted in the Exhibition Section




Edit16:
AndroTest_V14.ino
This updated sketch features optimized timing and better transmission error management
Make sure your BT board is set @57600bps
See reply #210

Edit17:
AndroTest_V141.ino
See reply #212

Edit18:
BT boards types and configuration tools
See reply #227

Edit19:
Joystick bluetooth Commander Version 5.0 has just been published on Google Play

** Communication protocol has changed **    see reply #252
 - Change log:   see reply #259
 - Demo sketch: AndroTest V2.0      see reply #256

Edit20:
Joystick bluetooth Commander Version 5.2 now on Google Play
 - Change log:   see reply #292
 - Demo sketch: AndroTest V2.0      see reply #256




« Last Edit: August 28, 2014, 11:15:27 am by kas » Logged

0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I posted a pan/tilt project based on Joystick Bluetooth Commander, in the Robotic Section

« Last Edit: June 24, 2013, 01:22:53 pm by kas » Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have Samsung Galaxy Tab 7" tablet and Arduino Uno. The X and Y values on the tablet screen don't display the position of the joystick and nothing is displayed on the serial monitor. How can I fix the problem?
Logged

0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bluetooth applications are difficult to debug in Eclipse IDE, as Virtual Devices do not emulate Bluetooth activity
Actual debugging has to be made on a specific real device (Sony Xperia Mini)

Quote
I have Samsung Galaxy Tab 7" tablet
what is your tablet API level and display resolution ??

Quote
The X and Y values on the tablet screen don't display the position of the joystick

Make sure that options are as follow:
Data Range:   -50 to +50
Data display:    Joystick position
Data format:   STX and ETX

Are the buttons and the "not connected" string displayed on the tablet screen ??
Does the Joystick actually move when touched??
does it produce haptic feedback when this option is selected ??

Quote
nothing is displayed on the serial monitor
Your Bluetooth serial board may be still configured @9600BPS
please adjust  mySerial.begin(57600) to your specific Baud rate
Also make sure that your Bluetooth serial board is already paired with your tablet

finally uncomment
Code:
//        Serial.print(i);  Serial.print(": ");  Serial.println(cmd[i]);
   
and let me know the outcome

@all
My specific configuration is working flawlessly
Should you have installed this application on a different device, please post feedback
« Last Edit: June 24, 2013, 01:23:59 pm by kas » Logged

0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@jeffmorris
I beleave you are facing two non related problems

 - Communication with your BT card (your task)
check pairing, Baud rate, connection to Arduino (Menu/Connect)
I use a JY-MCU rev1.05 board
Onboard LED should be flashing when powered and gets solid red when connected
Connect TX board to RX (D0) Arduino


Above Arduino sketch has been updated to V5 (removed SoftwareSerial)
For sketch upload, don't forget to disconnect board TX from Arduino D0


 - UI display on tablets (my task)
I will publish today on Google Play a new version insuring compatibility with tablets

Edit: Joystick Bluetooth Commander V2.2 is now available
Please make sure that application is configured as follow:
 - Data Range  -50 to +50
 - Data display   Joystick position
 - Data format STX and ETX
 - Refresh interval   100ms
 - Button1 data to send    '1'
 - Button2 data to send    '2'

« Last Edit: June 28, 2013, 07:00:07 am by kas » Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The screen shown on the second screenshot at https://play.google.com/store/apps/details?id=org.projectproto.btjoystick&feature=search_result#?t=W251bGwsMSwxLDEsIm9yZy5wcm9qZWN0cHJvdG8uYnRqb3lzdGljayJd doesn't show up. How can I fix this?
Logged

0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The X and Y values on the tablet screen don't display the position of the joystick
Can you move the joystick ??
Are the data now displayed on the tablet screen ??


Quote
The menu is displayed when pressing the hardware menu button at the bottom of your tablet
Can you access it ??

You need to enter this menu to establish a Bluetooth communication

Please let me have more detailed information

I will post a new version including a "reset configuration" option
The initial configuration should work right out of the box with the above Arduino sketch
« Last Edit: June 29, 2013, 11:44:13 am by kas » Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't find the hardware menu button at the bottom of the tablet screen. When I move the joystick, the X and Y values at the bottom left corner of the screen change. A red message at that corner says "Not Connected".
Logged

0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it your model?


What happens when you launch Joystick Bluetooth Commander and press the button on the left ?

EDIT
Not sure this is the right one   smiley-slim
The option button is this one (red circle)

Can somebody jump in and explain how to access applications menu or options on the Galaxy Tab tablet ??
« Last Edit: June 29, 2013, 03:27:15 pm by kas » Logged

0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I now realize that beginning with Android 3.0 (API level 11), Android-powered devices are no longer required to provide a dedicated Menu button  smiley-sad-blue

Joystick Bluetooth Commander Version 2.3 now adds full compatibility with Android 3.X  and 4.X
The menu that allows BT connection can be accessed though the added 'action overflow button' (red square)
some other devices have a different icon at bottom left

thanks for bringing this point to my attention, sorry for being GingerBread centric

The application has been tested and is fully operative on my son's 7" Samsung Galaxy tablet (jelly beans)
Thanks to Julian for his contribution  smiley-wink
« Last Edit: August 19, 2013, 02:56:35 pm by kas » Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Samsung Galaxy Tab 7.0 Plus has display resolution of 1024x600.

http://www.samsung.com/global/microsite/galaxytab/7.0/spec.html?type=find
Logged

0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK

Just install Version 2.3, and let me know the outcome.
You should now have a Menu button available for establishing connection.


Next step is to get your BT board connected. With a JY-MCU type, the on board LED should change from blinking to solid red
Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think that version 2.3 works but I don't see anything on the Serial Monitor after changing #define DEBUG from false to true. I can connect my tablet to the Arduino UNO board with Bluetooth module but the Pin 13 LED doesn't work when I touch the buttons next to the "joystick". The values change when I move the "joystick". The LEDs on the Bluetooth module changed from flashing red to non-flashing green.
Logged

0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 397
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK

Please check those 3 points:

1) Arduino sketch
Add
Code:
Serial.println("***");
as the last line of setup()
Please confirm the stars are displayed on the serial monitor

D0 should be disconnected to allow sketch upload
(and reconnected afterward  smiley-wink)
   

2) Hardware connection
please refer to message #4
Only 3 wires
5V to 5V
GND to GND
TX board to D0 (Arduino RX)


3)BT board Baud rate
Some BT boards default to 19200BPS
Please adjust "Serial.begin(9600)" and Serial Monitor Baud rate accordingly
Should you require it, I will upload an Arduino sketch for checking BT board Baud rate and/or setting a new value. This sketch also insure that the BT board is OK
Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please send me the sketch that for checking and setting Bluetooth baud rate. I added

Serial.println("***");

as the last line of setup() and the stars show up on the serial monitor.
Logged

Pages: [1] 2 3 ... 22   Go Up
Jump to: