Sending data from Phone to arduino via BLE

Can data be sent from a smart phone to nano 33 BLE via BLE? Are there any forums/tutorials I could follow for such a sketch?

Depends how much data you want to send.
My paid pfodApp will send numbers/text from sliders/text input screens.
The free pfodDesigner will generate the Arduino sketch for you to display the menu you design, all the code is in the Arduino sketch.
See Arduino NANO 33 Made Easy for example sketches. might be another alternative.

So, for my specific use case, the data will consist of a TinyML model. Swift/ios has apis for connecting to BLE devices, and I'm certain android does too. If I setup an mobile application on either platform to communicate with a nano 33 BLE, can I transmit the model to the peripheral device and if it provides, can I transfer the model back to a mobile phone?

In that case neither of my suggestions are appropiate :frowning:

That doesn't mean it is infeasible, yea?

out of my experience.

Did you try the examples that come with the ArduinoBLE library?
They have all you need to get started. You will need to do some packaging and error handling on the application layer. The typical use case for BLE does not require every packet to be received. If a packet is lost for a temperature sensor the data will not update for one interval and no harm will be done in most cases.
By creating smart characteristics this robustness can be applied to many other use cases but not in your case. If part of the model is missing it will not work.
By adding a byte or two to your characteristic you can include a packet counter. This will allow you to detect if any packets are missing. You can then re-transmit the missing data.

Yea I thought of that too, As a second layer of protection against packet loss, I decided to transmit an "Acknowledging" packet when a packet is received. I'm assuming this will slow down the process?

Yes, using a whole packet for acknowledge after each packet send, will decrease your bandwidth significantly. Adding a packet counter will cost you almost nothing.

Understood, But if I have an acknowledge packet, I have the benefit of retransmitting the lost packet, correct? Whereas a counter although the seemingly better choice will have to wait for the entire transmission to complete to see whether it received the packet or not. Or I could have something that "meets in between", i.e. a hybrid approach where I segment the packets into "sections" with each section having a set number of packets. Prior to transmitting a section, I could check if the counter of the previous section is equal to the section packet count pre transmission

What phone do you have (like iOS or Android) if Android, then you can use Serial Bluetooth Terminal on the play store. If iOS, then you can use Bluetooth for Arduino or Dabble on the App store

@geniusified , I'm currently building the POC for iOS. But I have run a demo based on WebBLE, and it seems to do the job

I suspect it will be faster and simpler if you just check the packet counter and re-transmit everything in case a packet is missing. When you find that errors happen too often, you can implement the transmit of individual packets.
From a user experience point of view, transmitting the model in let’s say in 10 seconds most of the time with an occasional second transmit will be better than a more reliable transfer that always takes 20-30 seconds.

1 Like

Now that you said it, It does!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.