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

Here it is
This sketch will scan the BT board and display actual Baud rate and firware rev level
The menu also allows to change Baud value
I suggest to set the board @57600

Connection:
 TX BT board pin to Arduino D2
 RX BT board pin to Arduino D3
 5V BT board pin to Arduino 5V
 GND BT board pin to Arduino GND

Finally, for joystick operations:
adjust Serial.begin(XXX) in AndroLED V5  
reload sketch
move D2 cable to DO
remove D3 cable
and you should be all set  smiley-cool

Tested with  JY-MCU rev1.05    HC-06 (LINVOR)
Should work with any board
EDIT: doesn't work with Bluetooth Mate Silver board
EDIT 2: another sketch has been developped for HC-05 board

Please confirm actual BT board Baud rate and firmware rev level

* JY_MCU_Config.ino (3.17 KB - downloaded 84 times.)
« Last Edit: May 22, 2014, 12:29:33 am by kas » Logged

0
Offline Offline
Sr. Member
****
Karma: 18
Posts: 402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino sketch is attached to the previous message
You may not have access to it if you browse this forum using a tablet
Please download using a PC, alternatively I can include the sketch code within a new post
« Last Edit: July 04, 2013, 11:52:37 am by kas » Logged

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

Searching ............
ERROR: Bluetooth Module not responding!
Make sure there are no active bluetooth connection and try again
Logged

0
Offline Offline
Sr. Member
****
Karma: 18
Posts: 402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is the Baud rate testing setup, please check:



This is a screenshot of the expected info:



Quote
Searching ............
ERROR: Bluetooth Module not responding!
Make sure there are no active bluetooth connection and try again

For checking/setting Baud rate, the BT card should _not_ be connected (Bluetooth connected) to the tablet/Android device,
To enter AT command mode, the BT card LED should _blink_

Just in case, try inverting D2 and D3 cables


Have you already successfully used this board for other projects ??
Please let me have a link to the specific BT board you purchased
« Last Edit: July 05, 2013, 01:14:14 am by kas » Logged

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

https://www.sparkfun.com/products/10393
Logged

0
Offline Offline
Sr. Member
****
Karma: 18
Posts: 402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Have you already successfully used this board for other projects ??
 JY_MCU_Config configuration sketch won't work with this board as initialization strings are different

The datasheet for your board is here
Please have a look at page 5
Default Baud rate is 115200
Modify AndroLED V5 sketch setup() accordingly, should be OK
« Last Edit: July 05, 2013, 06:47:17 am by kas » Logged

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

I just bought an Android tablet with BT [off brand CN thing] to try using BT with my
robots. I know this is asking a lot, but is it possible to get the joystick app, as well as
maybe Sena BTerm, somewhere other than on Google Play? I just find that signing up
for Google Play is very intrusive, and requires giving them personal info that I really
don't want to part with, bummer. Every single Android download website I've looked
at forwards you to Google Play. What a great world.

Other than that, the BT Joystick app looks really cool, :-).
Logged

0
Offline Offline
Sr. Member
****
Karma: 18
Posts: 402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Let me have your email address via PM
Logged

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

Done.
Logged

0
Offline Offline
Sr. Member
****
Karma: 18
Posts: 402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Check your mail  smiley-wink
Logged

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

Hey kas, thanks. Just an update. I received the joystick apk, and got it installed and running on my new Android tablet. I also have a couple of BT modules which are virtual clones of the JY-MCU, and your app pairs ok. Tomorrow, see if I can get the Arduino-BT side of things to go, shake a servo. Cool, :-).
Logged

0
Offline Offline
Sr. Member
****
Karma: 18
Posts: 402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the feedback, please keep us updated  smiley

Quote
Tomorrow, see if I can get the Arduino-BT side of things to go, shake a servo. Cool, :-).
do not use SoftwareSerial together with the servo library, doesn't work
Just use hardware serial. You will still be able to display debug info's on the Serial Monitor
« Last Edit: June 22, 2014, 12:23:10 pm by kas » Logged

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

Yeah, thanks. I've had very poor luck with SoftSerial in the past so will try different things. I do have 1284 boards with 2 UARTs. Also, I did get the little BT dongles to pair with my tablet, and talk to terminal emulators  a couple of days ago, but the AT cmds didn't fully work [only the 'OK' part], plus they won't intercommunicate, so I need to wring that all out. It's always a muckaround with this stuff.
Logged

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

Hi kas, here's an update - everything works A-Ok. Very cool.

I am running the Arduino sketch shown in your original post, except that I am using an ATmega1284P with 2 UARTs, so the BT data comes in on Serial1 and goes out Serial to the terminal emulator. Joystick, haptic, and button on/off all work good. The control menu on my tablet is as shown in reply #9.

The only question I have is that, when the joystick is at rest position shown as (0,0) on my tablet, the data received at the Arduino end = 60,60, and then it goes from 10...110 as I move the joystick. Obviously, the data range is set to -50,+50. So, what's the 60,60 business, I didn't see it mentioned anywheres?

Here is my system:
1. ATmega1284P board.
2. BT module = generic clone:
http://www.amazon.com/Arduino-Wireless-Bluetooth-Transceiver-Module/dp/B0093XAV4U/
3. 7" tablet, quadcore 1.3Ghz, Android 4.2.1, 1280x800 res, joystick display snapshot is attached.
http://www.walmart.com/ip/Hisense-Sero-7-Pro-7-Tablet-Quad-Core-Processor-with-8GB-Memory/24805142


* Screenshot_2013-07-08-23-39-09.png (34.16 KB, 1280x800 - viewed 80 times.)
« Last Edit: July 09, 2013, 01:53:12 am by oric_dan » Logged

0
Offline Offline
Sr. Member
****
Karma: 18
Posts: 402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Hi kas, here's an update - everything works A-Ok. Very cool.
Thanks for the feedback

Quote
The only question I have is that, when the joystick is at rest position shown as (0,0) on my tablet, the data received at the Arduino end = 60,60, and then it goes from 10...110 as I move the joystick. Obviously, the data range is set to -50,+50. So, what's the 60,60 business, I didn't see it mentioned anywhere?


OK, this is the story   smiley-wink

I am working on V2.4 that will include a calibration screen for fine tuning
This will allow a -10 +10 correction for the Joystick Zero position
I want to fit the transmitted data on a signed Byte, as a positive value (0 to 128)
The maximal range including calibration is -60 to +60
By adding a 60 offset, transmitted data is now 0 to 120, uncalibrated Zero position being 60,60

So far I was unsuccessful transmitting negative values.  Any smarter solution ??

FYI   "Option/Data Display/actual sent Bytes", will display actual transmitted value
« Last Edit: July 09, 2013, 07:10:20 am by kas » Logged

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