Pages: 1 2 [3] 4 5 ... 12   Go Down
Author Topic: Android Bluetooth joystick  (Read 27896 times)
0 Members and 1 Guest are viewing this topic.
the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi kas, I got the Android Joystick Commander controlling pan'n'tilt servos connected to my ATmega1284 Arduino board this morning, pretty cool. The one thing I might suggest is providing a shorter Refresh Interval in the Advanced Options menu, eg as little as 20 or 40 msec if possible, then the servo responsiveness would be maximal.

I looked at your data protocol some more, and think it's pretty good the way it is. You use 1-byte to send both control codes and data, so I wouldn't worry about trying to send signed data. It's easy enough to subtract off the offset = 60, once you know what the coding is.

Also, I think the resolution of +/-50 ultimately producing +/-500 usec servo pulse changes is ok, considering you're doing the control manually by moving the on-screen joystick. After all, 10-usec is only 0.9 deg of servo movement.

All in all, nice job, :-).

My next task is learning how to write my own Android BT apps. BTW, can you tell me which tools you used?

EDIT: thinking of the coding a little more, you could actually scale it up to 120 +/-100 and get 2X the current servo movement resolution, and still have space left over at the low end for the various control codes. This would give 0.45 degree servo resolution, although it probably wouldn't be noticeable when using the joystick. OTOH, you'd have an improved format that could also be used by other Android apps for control of the same Arduino h.w. systems, without having to change the latter's code.

EDIT2: FYI, this afternoon, we loaded Joystick Commander into a friend's Samsung Galaxy 3 cellphone running Android 4.1, and it worked perfectly in commanding my BT-Arduino1284 board and servos, so everything good. He was impressed, and not even an Arduino guy.
« Last Edit: July 09, 2013, 08:06:40 pm by oric_dan » Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The one thing I might suggest is providing a shorter Refresh Interval in the Advanced Options menu, eg as little as 20 or 40 msec if possible, then the servo responsiveness would be maximal.
Easy to do... let's see...

Quote
My next task is learning how to write my own Android BT apps. BTW, can you tell me which tools you used?
Android programming is a fascinating universe
Three very different approches are available on the market, with increasing learning curves
App Inventor
A full graphic cloud based application, just fitting together puzzle pieces
still in development, very intuitive but a bit limited for the moment

Basic4android  
using a syntax MS Visual Basic syntax, creates native Android applications

Eclipse + Android SDK
for full blown applications, a bit frustrating at startup  smiley-eek smiley-eek smiley-eek
A first experience with Java will definitly help
Tons of help and snippets, at XDA developpers
lots of tuto's on Youtube

I tried App Inventor and finally choosed the hard way... smiley-cool

Quote
this afternoon, we loaded Joystick Commander into a friend's Samsung Galaxy 3 cellphone running Android 4.1, and it worked perfectly in commanding my BT-Arduino1284 board and servos, so everything good. He was impressed, and not even an Arduino guy.
Thanks for this excellent feedback smiley

Out of curiosity, where is the Land of sun+snow ??
« Last Edit: July 10, 2013, 12:39:28 am by kas » Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the dev tool info, will look them up.

BTW, the Galaxy phone guy [non-techie] was totally amazed how he could suddenly use his Android phone to control the world, ;-), ie besides just placing calls and surfing the web. Land here is northern Nevada, hot and sunny desert, sitting below 11,000 foot mountain peaks covered with snow, at least in the winter. Sleep time now.
Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Quote
The one thing I might suggest is providing a shorter Refresh Interval in the Advanced Options menu, eg as little as 20 or 40 msec if possible, then the servo responsiveness would be maximal.

Easy to do... let's see...

Check your mail for V2.35
I added 25ms and 50ms
At 25ms, you may have to increase your BT board Baud rate to 57600

Edit:
I just tested V2.35 with the Pan/Tilt robot
At 25ms, movements are much smoother  smiley
I will upload this version to Google Play later today
Thanks for your suggestion

Edit2:
Quote
BTW, the Galaxy phone guy [non-techie] was totally amazed how he could suddenly use his Android phone to control the world, ;-),
I had this very same feeling smiley-cool, this is the reason I decided to share
« Last Edit: July 10, 2013, 02:13:46 pm by kas » Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Edit:
I just tested V2.35 with the Pan/Tilt robot
At 25ms, movements are much smoother  smiley
I will upload this version to Google Play later today
Thanks for your suggestion

Done
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi kas, I tested the new version of Joystick Commander. The servo movements definitely are much smoother now, especially for very slow changes of the joystick position. Looks good. I also looked at the wording on all the menus like you suggested, and they all look good too, I think.

Considering BT works on the 2.4Ghz band, I'm also surprised that the servo response latency is so quick, as where I live there are about 30 routers that I can pick up. See attached. I might have expected some interference, and slower responsiveness.

The only thing left that I might comment on is that you cannot tell from the Android screen what is the state of the  Led on the Arduino, in the sense that you don't know what was the last keypress made - on or off. I guess there is no option for feedback from the Arduino board back to the Android device, but it might help to put some marker on the Android screen to indicate the last key pressed. Like a little marker that comes on, separate from the on,off keys.


* Screenshot_2013-07-10-20-31-59.jpg (99.99 KB, 1280x800 - viewed 46 times.)
Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
...you cannot tell from the Android screen what is the state of the  Led on the Arduino, in the sense that you don't know what was the last keypress made - on or off. I guess there is no option for feedback from the Arduino board back to the Android device, but it might help to put some marker on the Android screen to indicate the last key pressed. Like a little marker that comes on, separate from the on,off keys.

I will have a look at it when back from holydays
My background is Process Control, in term of strategy, I agree, a feedback from the Arduino is much better
This should be feasible  smiley-roll-blue
« Last Edit: July 10, 2013, 11:37:49 pm by kas » Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Holydays? Where the heck does one go on a holiday when he lives in a resort town like you do? LOL. Maybe the beach. Bon chance.

FYI, there appears to be a bunch of BTBees around,
http://www.google.com/search?hl=en&site=imghp&tbm=isch&source=hp&biw=1025&bih=870&q=bluetooth+bee

I happen to have this one on hand, so I plugged it into my Arduino1284 board [which just happens to have a convenient XBee socket], and the JoystickCommander worked right off without any muckaround, so it looks like the "default" mode of the BTBee is the same as for the other small BT modules cited earlier. Again, 2 wire control - Rx, Tx, 9600bps, code=1234 - and go. So, versatility increases.
http://www.robotshop.com/dfrobot-bluetooth-bee-2.html
« Last Edit: July 11, 2013, 02:09:32 pm by oric_dan » Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Holydays? Where the heck does one go on a holiday when he lives in a resort town like you do? LOL. Maybe the beach. Bon chance.
I wont tell it over the Web (_your_ Big Brother is watching us) smiley-wink

Quote
I happen to have this one on hand, so I plugged it into my Arduino1284 board [which just happens to have a convenient XBee socket], and the JoystickCommander worked right off without any muckaround, so it looks like the "default" mode of the BTBee is the same as for the other small BT modules cited earlier. Again, 2 wire control - Rx, Tx, 9600bps, code=1234 - and go. So, versatility increases.
Good to know, thank for the information
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You'll notice that most of the BTBees in those pictures use the same same BT module as the little boards we've been using, and the Bee is just a carrier board to plug into an XBee socket.  And never tell anyone in public what your specific plans are, just general stuff like "Well, maybe we'll head south, or maybe east, have to see how it goes", LOL. Talk about intrusiveness, this article may be of interest! Do a google search on
"WSJ How Kid Apps Are Data Magnets". I find the direct link gets highjacked. "Big Data" knows more about you than your own govt. C'est la vie. Neuromancer in action.
Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And never tell anyone in public what your specific plans are, just general stuff like "Well, maybe we'll head south, or maybe east, have to see how it goes", LOL. Talk about intrusiveness, this article may be of interest! Do a google search on
"WSJ How Kid Apps Are Data Magnets". I find the direct link gets highjacked. "Big Data" knows more about you than your own govt. C'est la vie. Neuromancer in action.
I suggest to go back to the original subject of this thread
Words _Google_, _FaceBook_, _NSA_ have nothing to do with Bluetooth control, even if European and Gaia citizens have hard feelings about that  smiley-mad smiley-mad smiley-mad

Hoops...  I heard a strange click on my phone line  smiley-sad-blue

« Last Edit: July 13, 2013, 12:02:30 am by kas » Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Best not to kick the tiger in the a**, when he's sleeping. But that's old news. The WSJ article is about g**gle, yah**, f*ceb**k, am*z*n, and eb*y, the new 4-letter word agencies that know 100X more about you than the g*vt will ever know. L*L.

On other matters, I've started reading a book on Android development. Install about 700-800 MB of dev tools (java sdk, eclipse, eclipse android plugin, android sdk, maybe some others), and learn how they work, and maybe 3 months later you'll have a nice 47KB .apk app. More L*L.
Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I've started reading a book on Android development. Install about 700-800 MB of dev tools (java sdk, eclipse, eclipse android plugin, android sdk, maybe some others), and learn how they work, and maybe 3 months later you'll have a nice 47KB .apk app
You choosed the hard way  smiley-eek-blue smiley-eek-blue
Bonne chance  smiley-wink
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll look up your links too, but see you also mentioned Eclipse + Android SDK, which is where the book starts from too.
Logged

0
Offline Offline
Sr. Member
****
Karma: 11
Posts: 292
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I posted a BlinkM (RGB LED) project based on Joystick Bluetooth Commander, in the LEDs and Multiplexing Section


Logged

Pages: 1 2 [3] 4 5 ... 12   Go Up
Jump to:  

Powered by SMF 1.1.19 | SMF © 2013, Simple Machines