Go Down

Topic: Android Bluetooth joystick (Read 82663 times) previous topic - next topic

kas

#15
Jul 02, 2013, 07:06 am Last Edit: May 22, 2014, 07:29 am by kas Reason: 1
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  8)

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

kas

#16
Jul 04, 2013, 06:40 pm Last Edit: Jul 04, 2013, 06:52 pm by kas Reason: 1
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

jeffmorris

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

kas

#18
Jul 05, 2013, 06:34 am Last Edit: Jul 05, 2013, 08:14 am by kas Reason: 1
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

jeffmorris

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

kas

#20
Jul 05, 2013, 01:45 pm Last Edit: Jul 05, 2013, 01:47 pm by kas Reason: 1
Quote
https://www.sparkfun.com/products/10393

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

oric_dan

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, :-).

kas

Let me have your email address via PM



oric_dan

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, :-).

kas

#26
Jul 08, 2013, 10:19 am Last Edit: Jun 22, 2014, 07:23 pm by kas Reason: 1
Thanks for the feedback, please keep us updated  :)

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

oric_dan

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.

oric_dan

#28
Jul 09, 2013, 08:49 am Last Edit: Jul 09, 2013, 08:53 am by oric_dan Reason: 1
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

kas

#29
Jul 09, 2013, 09:35 am Last Edit: Jul 09, 2013, 02:10 pm by kas Reason: 1
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   ;)

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

Go Up