Can you change the Baud rate of the Android BLE block
1 view (last 30 days)
Show older comments
I am trying to receive a 256 samples per second signal from a HM10 bluetooth device using the custom characteristic of the HM10. I have successfully sampled a 1hz sine wave that is not distorted at that sample rate. However when I try to sample a 128Hz sine wave it is all over the place (which is the signal I actually need for my project). The custom characteristic of the HM10 sends a maximum of 20 characters. Im assuming one of the issues is that the 9600 baud rate is not high enough and I need 57600 to get the whole signal ie 20(characters) x 8 (bits) x 256 (samples per second)...please correct if Im wrong. I can change the baud on the HM10 easily enough but does anyone know how can I match it with the simulink driven android device? ie change the baud for the android BLE block to 57600
0 Comments
Accepted Answer
Sruthi Yenugula
on 2 Nov 2018
Hi Matthew,
Maximum data sent through BLE characteristic is 20 bytes. Android BLE receive blocks can receive the characteristic for every 0.1 second, if the sample time parameter of the BLE Receive block is set to 0.1. You can set the sample time according to your needs. Two things you control in BLE Receive BLE block is Sample time and Data Size(it depends on peripheral/central device i.e sender data size ).
1 Comment
li li
on 11 Aug 2021
Edited: li li
on 11 Aug 2021
Hi Sruthi :
- I used to send 7 bytes data to the mobile by (STM32F407 through BLE4.0 module,Baud rate=115200) every 0.001 second;
- BLE Receive block's sample time set to 0.001, data size set to 10;
- and also log the receive data by To Workspace block which sample time set to 0.001 too;
but the result :
- the receive data logged in MAT-files seems wrong,The data is not stored in the correct position, the frame header often appears in the 3rd or 4th bit value.The data is completely useless.
- when i reduce transmission frequency to 7 bytes per 0.02 second , the data stored correct, but always missing log some frame data.
my Q :
- Why do the above two results occur?
- What is the highest sending frequency of the slave device can be used?
- What is the appropriate sampling time and the data size of the BLE Receive block?
- Can To Workspace block be freely to control the start and stop of the recording data?
Thanks.
More Answers (0)
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!