[Solved] Can I use BLE on iOS?

I would like to use BLE extension, because I can’t make the current one work on the iPhone:(

Hi @neuheisser, I’ve created a new topic for this as I assume you’re using #thunkable-cross?

Can you tell us a bit more about:

  1. The BLE device you’re trying to connect to
  2. The Blocks you are currently using
  3. What you’re trying to do with your app

Thanks!

Thanks for your quick response!
I’m trying to connect to ESP32, I have already uploaded the code (using Arduino IDE) that works with eBeacon app. I learned that iPhone cannot see BLE devices native, rather it needs an app for it.
eBeacon can see it, connect, and send some text that I see in Serial monitor of Arduino IDE, so I’m sure that my device is OK.
I’m actually trying to achieve this:

There you can see blocks that aren’t available with built-in BLE extension.

I’m trying to scan, or to transmit to UUID without scanning, nothing works.
I’m on iPhone 7.
That’s it, thank you :slight_smile:

Thanks! Can you send a screenshot of the blocks you are using to connect and transmit data?

Something like this.

Tried also to Scan first, but nothing comes out.

Thanks for sharing!

I don’t have an ESP32 to hand @neuheisser so debugging will probably be tricky, but a couple of things jump out from your screenshot.

When you connect to MyDevice can you use the join block to make the text on Button2 say “Connected to {{Device Id}}”

When you transmit, it looks like your UUID has a lot of trailing spaces, can you try remove those?

Tried, nothing happens.
There were spaces (you rock!), but they don’t seem to make any influence.
Still no connection :frowning:

The code actually responds whenever I connect with that other app.
I couldn’t make it react with this one.

1 Like

interested in this as well, haven’t got BLE to work either.

OK - I found out what’s wrong.
It is Thunkable Live app for iOS, it cannot connect to BLE.
Android Live app works great, it connects immediately, sends messages etc.
iOS app luckily works when you compile it, send via mail and install, but no live preview…
So that’s it, you have to fix BLE in iOS Live app…

Otherwise, these blocks work surprisingly good, really straightforward and simple. You just connect to device and send messages, nothing more… really cool. Disconnect is maybe missing and some more detailed stuff maybe, but for my purpose this can easily be enough.

23%20AM

And here’s a final update:
Live preview warns you that it’s not working on iOS, so it’s ok.
I have coded using Android live prew, but compiled version stopped working on iOS after the app got more complicated, now it doesn’t work on Android too…
SO… I think I have wasted my time, I will go back to Classic and make it only for Android… Classic has much more detailed and reliable BLE protocol, this one is much simpler, easy to use, but completely unreliable. I hope it might get improved soon.

Thanks for the feedback @neuheisser - sorry to hear that this isn’t quite ready for you yet.

We are planning updates and improvements so hopefully your input can help with this.

We recently had another user with a similar problem and their solution was to add the READ property to the TX characteristic in the UART service on their ESP32. Here’s their full message:

I programmed my ESP-32 as a server with one Service (UART service) and two characteristics RX and TX. On my RX was allowed only the property of WRITE and on my TX was allowed only the property of NOTIFY (this is done on one of the defaults examples on the ESP-32’s libraries). For some reason, this configuration works well with the iOS App but my ANDROID App couldn’t receive data from the SERVER. So, to make it work on ANDROID and iOS I added the following properties on my characteristics RX and TX: READ, WRITE, NOTIFY, INDICATE

Actually, just adding the READ property on the TX characteristics of the the UART service is enough to solve this and make it work well.

Hope this helps.

-Mark

2 Likes

BLE preview doesn’t view with iOS and it is clearly stated if you press “Live Test” button.
Everything is OK with BLE module, works great, but you have to compile the app for iOS!

2 Likes

Hello. I have no problem sending data. I’m having trouble receiving data, the timer updates every 50 ms, but I don’t see any reception. in addition it is possible to disconnect the external device connected to the ble without closing the app?thun

Hey

I’ve been trying to get the BLE receive to work for weeks now. I’ using a HM10 module and an Arduino to receive transmit the data.

I have come to conclude that the receive block is not functioning. Hopefully, that would be reviewed soon

2 Likes

I used Thinkable X BLE with Arduino Nano 33BLE. Both Sending and Receiving work ok. I verified just now. What I experienced:

  1. Scan takes a very long time, it finally scans something after I waited like forever. So now I choose to Connect to Device Name directly.
  2. Fro both Sending and Receiving, I use “String”. It is very difficult for me to figure out using specific data types, so in Arduino I used generic BLE characteristic.
  3. I have to use timer to Receive from Arduino periodically. To avoid congestion I use 100ms loop. In Thunkable side better if we can have a WHEN Received block.
  4. So far the apk works fine in Android, but not in iOS. In iOS it does not connect (like my BLE peripheral does not exist). I am still thinking what’s wrong with it. Perhaps build another simpler one to verify?

(Correction: BLE app works in iOS just now, but I am not sure of the thing that I changed. So for No 4 I will keep watching.)

2 Likes

can you share your project here?

1 Like

In Android I think it is possible to “Disconnect” without closing the App.

I simply “Connect to Device Name”, and if check if the returned “Device ID” is empty or not.
It works ok with single button to turn it On and Off.
However, it doesn’t look very good in iOS, I will check it more.

kufirre I show you a portion of simple example: polling the XYZ data from Nano 33 BLE accelerator.
A button is set to turn the polling on and off. When it is on, a timer is activated with a duration of 100ms. Each time the timer is fired, X, Y, Z data are read from the BLE device in respective characteristics:
0000FFC1-0000-1000-8000-00805F9B34FB (X)
0000FFC2-0000-1000-8000-00805F9B34FB (Y)
0000FFC3-0000-1000-8000-00805F9B34FB (Z)

Like I said, I currently convert the float data into char array string in Arduino side so that those data can be read correctly. To give you part of the codes:

void ReadAccelerationSensorData() {
float x, y, z;
char buffer_x[6], buffer_y[6], buffer_z[6];

if(IMU.accelerationAvailable()) {
IMU.readAcceleration(x, y, z);

dtostrf(x, ACCE_XYZ_LEN, FLOAT_PREC_LEN, buffer_x);
dtostrf(y, ACCE_XYZ_LEN, FLOAT_PREC_LEN, buffer_y);
dtostrf(z, ACCE_XYZ_LEN, FLOAT_PREC_LEN, buffer_z);

characteristicAcceX.writeValue(buffer_x);
characteristicAcceY.writeValue(buffer_y);
characteristicAcceZ.writeValue(buffer_z);

}
}

I did not try on HM-10 with Thinkable so I cannot identity the actual difference. Hope it helps.

2 Likes

to connect and disconnect the Android BLE system, with the same “connect” command, connect and disconnect the device, with IOS connect it and just do not disconnect even if you call the command.

To receive the HM-10 it appears to me that it uses the same “characteristic” for both receiving and sending