Android App talking to the Freematics v2

Inquiry and support for Freematics products
gdpwork
Posts: 15
Joined: Sat Jun 21, 2014 9:48 am

Android App talking to the Freematics v2

Post by gdpwork »

Hi, I'd like to create an Android app which can talk to the Freematics V2 OBD II adapter. Has anyone tried that?
I know how to create a bluetooth connection from Android, but then, how can I get OBD data, GPS positions, data fro accelerometers, etc directly from the adapter and/or from the SD Card over bluetooth?
Thanks in advance!!
stanley
Site Admin
Posts: 1026
Joined: Sat Mar 01, 2014 3:15 am

Re: Android App talking to the Freematics v2

Post by stanley »

Take a look in the sample data logger sketch for Freematics OBD-II adapter. It's very easy to let your phone get all those data.
https://github.com/stanleyhuangyc/Freem ... datalogger
orpheus88
Posts: 9
Joined: Mon May 05, 2014 9:13 pm

Re: Android App talking to the Freematics v2

Post by orpheus88 »

Yeah just enable data streaming in the configuration file and than you can use a Bluetooth Terminal App to see what's transmitted and with that info you can think of an app to process it all.
stanley
Site Admin
Posts: 1026
Joined: Sat Mar 01, 2014 3:15 am

Re: Android App talking to the Freematics v2

Post by stanley »

Yes, just make sure the baud rate matches. ;-)
gdpwork
Posts: 15
Joined: Sat Jun 21, 2014 9:48 am

Re: Android App talking to the Freematics v2

Post by gdpwork »

Stanley,
I've downloaded the project https://github.com/pires/android-obd-reader which is a reader for Android. Is works perfect on Android Studio with the ELM327 OBD-II reader connected to the Freematics OBD-II Emulator using 500K, 11-bit and ISO 14230).
When I try it with the Freematics OBD-II reader , it doesn't work, I've debug it and I found that in the method readRawData(InputStream in) of the class ObdCommand the following is showing just squares for res variable in the watch dialog of Android Studio, where the ELM327 shows readable letters, Do you happen to know why or what can be wrong? Same protocol is being used for both.

// read until '>' arrives
while ((char) (b = (byte) in.read()) != '>')
res.append((char) b);

Thanks in advance!
gdpwork
Posts: 15
Joined: Sat Jun 21, 2014 9:48 am

Re: Android App talking to the Freematics v2

Post by gdpwork »

Same configuration was used, baud rate, protocol, etc
stanley
Site Admin
Posts: 1026
Joined: Sat Mar 01, 2014 3:15 am

Re: Android App talking to the Freematics v2

Post by stanley »

Please be very aware that Freematics OBD-II adapter is NOT a ELM327 bluetooth reader.
gdpwork
Posts: 15
Joined: Sat Jun 21, 2014 9:48 am

Re: Android App talking to the Freematics v2

Post by gdpwork »

Ok, I understand now that the Freematics outputs binary and not strings as ELM327. I'll leave how to emulate the ELM327 with Freematics for others:

The stock firmware outputs data in binary form. If you want it work as an ELM327, please download the following sketch.
https://github.com/stanleyhuangyc/Freem ... /elm327emu

Anyways, I don't get quite well, how to interact with the Feematics from Android and I'll explain why:
From Android Studio, I'm opening a connection using Bluetooth, now, What I'm not understanding is:
1) I have a connection established
2) I have the socket object listening (which will be fine if using ELM327, but I'm not)

I know the responses are binary for Freematics, but, How can I request something to it? Should I create some kind of freematics object in Android side so I can call its methods like:

freematics.initGPS()? Should I import any library into the Android project?
And How I can read it?

Since you have an iOS app already done, It would be great if you can post just a really simple example of how to connect, request 1 thing and read the response, in iOS or Android, that will unblock me and anyone else having the same problem.

I didn't find that kind of information here: http://freematics.com/pages/products/fr ... d-adapter/

Thanks in advance!
linigers
Posts: 7
Joined: Wed Apr 22, 2015 9:30 pm

Re: Android App talking to the Freematics v2

Post by linigers »

Hi,
did anybody manage to get a connection to an Android device? I would like to get some PIDs (for example PID_RPM, PID_SPEED) and send them to an Android device.

Thanks in advance.
stanley
Site Admin
Posts: 1026
Joined: Sat Mar 01, 2014 3:15 am

Re: Android App talking to the Freematics v2

Post by stanley »

For just testing, you can use a android serial terminal app.
Post Reply