Transfering Data via BT2.1

Inquiry and support for Freematics products
Post Reply
Andi
Posts: 3
Joined: Fri Apr 03, 2015 2:02 am

Transfering Data via BT2.1

Post by Andi »

Hi,

my company recently bought a data logger and the task to make it work was given to me. Actually I am quite new to this topic.

My task is to establish a connection via BT 2.1 and read data (Gyro, GPS and Speed) somehow like in the iOS app. However I don't know where to start.
It would be very helpfull if someone could tell me maybe which files are needed for BT connection or what I have to do for a connection between Logger and Computer.

Thanks in advice.
haydent
Posts: 14
Joined: Fri Apr 03, 2015 2:10 pm

Re: Transfering Data via BT2.1

Post by haydent »

you could start with a arduino bluetooth serial terminal app for your phone, this will let you send and recieve data to the logger. let me know if you still want more info.
Andi
Posts: 3
Joined: Fri Apr 03, 2015 2:02 am

Re: Transfering Data via BT2.1

Post by Andi »

Maybe my problem starts already here. I am using this basic code to receive some date via bluetooth:

int counter =0;

void setup() {
Serial.begin(38400);
delay(50);
}

void loop() {
counter++;
Serial.print("Arduino counter: ");
Serial.println(counter);
delay(500);
}

But nothing happens at all. Am I doing something wrong?
haydent
Posts: 14
Joined: Fri Apr 03, 2015 2:10 pm

Re: Transfering Data via BT2.1

Post by haydent »

Ok in arduino, Serial is hardware serial port 0
The logger unit only has 1 hardware port and uses an additional software port.

The hardware one is connected to the internal OBD interface chip, and the software one is connected to the Bluetooth module.

so Serial.begin() would connect to the OBD
http://arduino.cc/en/reference/serial

for debugging/data/readouts you want to use the software serial:
http://arduino.cc/en/Reference/softwareSerial

and in the datalogger sketch it uses

Code: Select all

SoftwareSerial SerialInfo(A2, A3);

to initiate the software serial 'object'

so then once that has been used, you can address in like:

Code: Select all

SerialInfo.begin(38400);


so doing it that way you should be able to see your prints to your bluetooth terminal
linigers
Posts: 7
Joined: Wed Apr 22, 2015 9:30 pm

Re: Transfering Data via BT2.1

Post by linigers »

Did this work for anybody? I want to use a bluetooth serial terminal app on android to send and receive data to the logger, but did not manage to get a connection.
haydent
Posts: 14
Joined: Fri Apr 03, 2015 2:10 pm

Re: Transfering Data via BT2.1

Post by haydent »

linigers wrote:Did this work for anybody? I want to use a bluetooth serial terminal app on android to send and receive data to the logger, but did not manage to get a connection.


it works for me, you will need:

#define ENABLE_DATA_OUT 0
#define STREAM_BAUDRATE 38400 //assuming 2.1 bt
#define VERBOSE 1

then you should see debugging text, to send to it you will need to add code that checks the software serial port connected to the bt module for new data and does with it what you want.
linigers
Posts: 7
Joined: Wed Apr 22, 2015 9:30 pm

Re: Transfering Data via BT2.1

Post by linigers »

Thank you! Do you know by chance how it is working with the BLE version? I got a Samsung Galaxy Note 3 which is BLE able.
haydent
Posts: 14
Joined: Fri Apr 03, 2015 2:10 pm

Re: Transfering Data via BT2.1

Post by haydent »

well assuming you have the logger model with ble instead of 2.1 then you would just change the baud rate i specified
Andi
Posts: 3
Joined: Fri Apr 03, 2015 2:02 am

Re: Transfering Data via BT2.1

Post by Andi »

haydent wrote:Ok in arduino, Serial is hardware serial port 0
The logger unit only has 1 hardware port and uses an additional software port.

The hardware one is connected to the internal OBD interface chip, and the software one is connected to the Bluetooth module.

so Serial.begin() would connect to the OBD
http://arduino.cc/en/reference/serial

for debugging/data/readouts you want to use the software serial:
http://arduino.cc/en/Reference/softwareSerial

and in the datalogger sketch it uses

Code: Select all

SoftwareSerial SerialInfo(A2, A3);

to initiate the software serial 'object'

so then once that has been used, you can address in like:

Code: Select all

SerialInfo.begin(38400);


so doing it that way you should be able to see your prints to your bluetooth terminal


This finally works for me. Thanks a lot!


Now I need some special data from the device. Not only GPS and Gyro data but also the temperature of the Gyro sensor as well as the accuracy of the GPS. Is there a way to access this information or even to get the raw data?
haydent
Posts: 14
Joined: Fri Apr 03, 2015 2:10 pm

Re: Transfering Data via BT2.1

Post by haydent »

i dont know specifically but if it is available you could find out how from the datasheets for the sensor/modules in there, just google it
Post Reply