0

BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by mcpackin on Mon Sep 22, 2014 9:15 pm

Hello, I recently got my Bluefruit EZ-Link in the mail and I have had no problems with it connecting to my Windows PC, Mac, or Android phone. I can receive data from my ECU to any of my computers but when I try to receive data on my Android phone I only get the two values 128 and 248 or 80 and F8 in hex. Here is my receive code snippet:

Code: Select all | TOGGLE FULL SIZE
                try {
                    int bytesAvailable = mmInStream.available();
                    if(bytesAvailable >= 16) //16 bytes per sample
                    {
                        Log.i(TAG, "bytesAvailable = " + bytesAvailable);
                        byte[] packetBytes = new byte[bytesAvailable];
                        int totalRead = mmInStream.read(packetBytes);
                        for(int e = 0; e < totalRead; e++) {
                           int tempByteInt = packetBytes[e] & 0xFF;
                           sendLineRead(Integer.toString(tempByteInt));
                        }
                        Log.i(TAG, "read " + totalRead + " bytes...");
                    }
                }

mcpackin
 
Posts: 4
Joined: Mon Sep 22, 2014 9:05 pm

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by adafruit_support_rick on Tue Sep 23, 2014 8:10 am

So, the computers receive the data OK, but the Android only gets 0x80 and 0xF8? That's very strange. I don't really have any suggestions for you.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by mcpackin on Tue Sep 23, 2014 3:35 pm

Alright, I cannot figure out what could be causing this what so ever! I know the baud rate is 2400 and that there are 8 data bits , 1 stop bit and no parity format. I am completely baffled by this as well since the InputStream "Reads a single byte from this stream and returns it as an integer in the range from 0 to 255". So from what I understand each byte that is read is 8 bits so I have no idea how the InputStream could be returning only two different values...

EDIT: I am thinking the speed of the transfer could be causing a problem? But I still cannot figure out why I am only receiving only the two int values 128 and 248..

ANY help would be greatly appreciated!!

mcpackin
 
Posts: 4
Joined: Mon Sep 22, 2014 9:05 pm

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by tdicola on Tue Sep 23, 2014 4:10 pm

Yeah try changing the speed of the serial port in the sketch to 9600 baud. Unfortunately Android's bluetooth serial connection doesn't cause the automatic baud rate detection to trigger so it has to be manually set to 9600. If you're curious you can see what I did with this project to use an ez-link with Android.

tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by mcpackin on Wed Sep 24, 2014 10:14 am

Hmm.. I don't think I can change the baud rate coming from the ECU. I could possibly use a Trinket and receive the the data at a baud of 2400 and then send it through the Bluefruit to the android phone at 9600 baud? Do you think this would work?

mcpackin
 
Posts: 4
Joined: Mon Sep 22, 2014 9:05 pm

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by tdicola on Wed Sep 24, 2014 1:36 pm

Oh interesting, that's a bummer you can't change the baud. But yep, using a Trinket as a buffer to go from 2400 to 9600 baud should work.

tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by mcpackin on Wed Sep 24, 2014 7:11 pm

I was able to resolve this by using a HC-06 Bluetooth module and setting the baud rate manually to 2400.

mcpackin
 
Posts: 4
Joined: Mon Sep 22, 2014 9:05 pm

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by smessinis on Sun Sep 28, 2014 3:43 am

Im unable to get my EZ-LINK shield to connect through app inventor - While I can successfully connect via Arduino IDE, send a sketch etc. getting the shield connected through appinventor keeps giving me and "error 507: Unable to connect is the device turned on" message

smessinis
 
Posts: 1
Joined: Sun Sep 28, 2014 3:23 am

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by adafruit_support_rick on Sun Sep 28, 2014 11:34 am

No familiar with App Inventor. What kind of computer/OS are you using? Are you trying to connect to an Android?

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: BLUEFRUIT EZ-LINK ANDROID RECEIVE ISSUES

by tdicola on Sun Sep 28, 2014 5:30 pm

Unfortunately I'm not familiar with app inventor either, but if it's an Arduino sketch talking to a Bluefruit EZ-link make sure the Arduino sketch opens communication with the Bluefruit at 9600 baud. This will work around the issue that baud detection doesn't work with Android.

tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Please be positive and constructive with your questions and comments.