What's the best Bluetooth mode to use for streaming data? - android

I have a microcontroller collecting sensor data at a rate of about 4 Hz. I would like to send this data over Bluetooth to a remote entity. I'm thinking the serial port profile (SPP) would be best, since it emulates a physical cable. Under normal usage, it would not be unreasonable to expect the connection to be held open for 10 to 12 hours at a time.
Has anyone done any work in this field? Does anyone know the best profile to use, or any resources to use as reference? Thanks in advance.

Yup I'd use SPP/RFCOMM. That will be supported in all Bluetooth versions and all implementations (except for the very very very basic which might not support RFCOMM/SPP). There shouldn't be any problem with keeping the connection open for a long time.

Bluetooth 2.1 supports a streaming mode over a basic RFCOMM channel, if your API will let you configure it.

Related

SDK to handle bluetooth hear rate sensors with errors management

we are creating a game for android and iOS, where we want to modify the story based on relaxation/stress levels.
We are thinking about using heart rate sensors like the Polar chest sensors and similar.
I was wondering if any knows about a repo to include in our app to handle the Bluetooth part of the sensors, we don't have experience with accessing to hardware, we implemented some connections and readings but connection is unstable, sometimes it connects, another's connection is lost, sensor is not found....
Thanks in advance
take a look at the developer's page of https://www.rookmotion.com/api, it is an app already made for heart rate monitoring but also has an SDK for third-party developers

Is it possible to change the frequency of bluetooth transmission in Android? Maybe through NDK?

I know every device transmits bluetooth at a different frequency. Any way to change the frequency. I want to change the frequency of BLE specifiaclly.
Given that the radio technology used in Bluetooth Low Energy is known as frequency hopping the answer is NO not as a developer as that belongs to the BLE driver level.
Realize that the range frequencies used to communicate between devices are collectively grouped into channels and that Bluetooth can switch between channels at 1600 hops per second so the notion of a third-party app being able to modify a lower level protocol seems undesirable as simply a security and separation of concerns matter.
Update
is it possible to change it at a device level. when i add a Bluetooth component(peripheral) to the device
Without more detail as to what and how you want to change the radio, I can't say. However:
What if I'm building the device from scratch
You'll need to learn how to read a datasheet which is provided by the chip/peripheral manufacturer. The datasheet will provide detailed physical connection information and details about the wire/software protocols necessary for operation. The datasheet for a chipset is roughly the API to the hardware, generally obtainable by using your favorite search tool, so if you do have a specific modification in mind, the datasheet should inform what is possible or not.
At this point you are at a level below the types of programming questions that StackOverflow normally operates at and should look to: https://arduino.stackexchange.com/ or https://raspberrypi.stackexchange.com/ or https://electronics.stackexchange.com/

How to increase the speed of transfer of data from android to arduino in bluetooth?

I'm trying to use an android app to do the processing of a path finding algorithm for a robot using Bluetooth. But currently, it takes 1 or 2 seconds for the transfer to complete, so that there is an output in the Arduino. Is there a way to minimise this to make the transfer-output instant?
This kind of delay is causing problems such as stopping instantly when an obstacle is detected. Is there any better way of doing this?
Thanks in advance!
You didn't mention which device you are using. I assume that you connected the Bluetooth chip set to UART port(As in arduino Uno), In that case the slowest part in whole communication is the serial interface between Arduino and Bluetooth chip set. Check what baud rate you are using and can it increase further. I think default will be 9600 which is only around 960 bytes per second. Set the maximum baud rate supported by your device and the Bluetooth chip.
Simple answer: You can't, bluetooth is laggy like that. If you instead had your path finding algorithm on the arduino board itself, you could avoid the issue. You can also try adding a delay to your arduino code, because it is possible that the arduino is sending messages repeatedly without taking into account the lag that bluetooth has.
Two simple solutions worked for me:-
Increase the delay to 50 - 100 milliseconds.
Add this after the Serial.begin(9600) in setup();
Serial.setTimeout(50);
Step two is the most important. It worked for me only after I added the above code. This is not mentioned very often in many other forums that I have looked when I had the exact same problem.

Bluetooth serial communication, HC-06 module to Android mobile

I want to transfer data from an Arduino to an android mobile phone. Data will be integers which are continuously generated values from a sensor attached to Arduino . What is the most fastest approach for this ? I mean what is the best code to transfer this data without any delay? I would like to use most optimized code because in my project delays will cause errors in my android app.Please help me. Data rate will be about 1 integer per milisecond .Thanks in advance....
I have managed to create a connection to, and receive data from, a bluetooth stick reader (cattle ear tags) using the tutorial from the following Google Developers guide. Seems to me that it will keep listening full time for the messages.
https://developer.android.com/guide/topics/connectivity/bluetooth.html
It worked on >= Android 4.3, because only after this version Android is capable of receiving Low Energy Bluetooth.
well that gives me an idea, #nopasara 's comment. If I can find a way to include 2 integers per 16bits i will be able to achieve the challenge ? I think that will be a possible task with C language bit operators.....

Bluetooth Android Audio skips when transferring data over RFCOMM

Hey Guys I'm dealing with an annoying thing.
While I'm sending larger amounts of data over the RFCOMM channel and connected A2DP, the audio will skip while. I've tried a lot of different things the only sure fire way is to space out the data being sent with delays. I'm pretty sure this is a low level Android issue as it mostly happens on 2.3.X but still happens on 4.0
Has anyone seen a similar issue?
An A2DP connection can consume the majority of available bluetooth bandwidth. Once you start adding other RFCOMM packets, you are taking up space that could otherwise be used for A2DP retransmissions, so your ability to hide lost packets is decreased. Other portions of bandwidth can be lost if your device is doing periodic page or inquiry scans, so you might want to ensure that is not happening. Basically, I wouldn't have too much expectation of running A2DP and RFCOMM at the same time unless your RFCOMM traffic is extremely low.

Categories

Resources