Receiving Multiple data from bluetooth

this is my blocks so when i receive the data from Bluetooth it doesn't organized as I do it in my arduino code ? so where's the problem here specially in timer blocks

Are you receiving text from the sketch over Bluetooth if you run a Bluetooth terminal app?

yes here it's a test data it's not organized
bluetooth.txt (1.8 KB)

How would it look if were "organized"?

the lines like that

this is file from my data logger module I used in this project. the sensor's readings store it in sd card then send this file through Bluetooth module to the app

Your problem might be with classic Bluetooth's message size limits.

See this thread ...

There is also the issue of timing.
Do you allow time in your sending code for the receiving end to catch up with the sender?

yea the default time 1 sec

The receiver should poll twice as often as the sender, to avoid data loss.

how to do this ??

To read faster than the sender sends, have the sender delay() a bigger number than the AI2 Clock Timer Milliseconds.

It's an inverse relationship, delay vs speed.

look this part of the code i use chunk size 59
and small delay 100 ms
and the app timer is 1000ms

Start by changing the app timer from 1000 to 50.

That would read twice as often as you write.

it's not working and has also become worse than before.....
I read something about delimiter when I receive data from Bluetooth Does that help?
and could you check whether my timer block of the receiving method is right or wrong?

and in my case i heard about BLE Module. is this better than the classic one?

I went searching the board for posts by people who had actually done file transfers from Arduino to AI2 over BlueTooth.

I found:

This is an entirely different approach, sending the entire file character by character in a loop, and using a distinct character value that isn't going to be in the file as a completion delimiter. This changes the structure of the receiving app (at that same post) to gulping down the entire buffer and hanging until that delimiter byte arrives at the end of the transfer, at which time the full buffer text is received to allow it to be written to a file in one gulp.
There are no chunks in the sending sketch.

The author has posted many Bluetooth samples, so I imagine he knows what he is doing.

Regarding BLE, further down in that thread there is a link to an informed discussion of BLE based data transfer:

I will continue searching for line by line transfer examples.

There is an informed discussion of transfer speed at

1 Like