# Ble connect to arduino problems

**URL:** <https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764>\
**Category:** BLE / BlueTooth\
**Created:** [February 20, 2025, 8:38pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764 "2025-02-20T20:38:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 20, 2025, 8:38pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/1 "2025-02-20T20:38:02Z")

</div>

I have a problem with the connection between the arduino esp32 wroom and the thunkable app via bluetooth low energy. Does anyone have any idea why this is not working as it should. Thanks for help in advance. And if you have any working example please if you can provide it. I would need to send and receive data and connect which is key. Good day Jernej

I already got this from someone and it doesn’t work as well as it should on BlueLight it doesn’t find it at all

 ![{A9699F94-FDC8-44EC-957A-D22ABFEC8C4C}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/b/fb192f3a5f588b8839dfa61478a96dcfd79471cc.png)  
 ![{6C31FA18-9E26-4655-8452-D2574E205D20}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/e/9e15c3bd8ee4733fdffa7e0c5d96dece7f5285ba.png)

Arduino code:  
/\*  
Based on Neil Kolban example for IDF: [https://github.com/nkolban/esp32-snippets/blob/master/cpp\_utils/tests/BLE%20Tests/SampleServer.cpp](https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleServer.cpp)  
Ported to Arduino ESP32 by Evandro Copercini  
updates by chegewara  
\*/

#include \<BLEDevice.h\>  
#include \<BLEUtils.h\>  
#include \<BLEServer.h\>  
#include “DHTesp.h”  
#include

/\*\* Comfort profile \*/  
ComfortState cf;  
// See the following for generating UUIDs:  
// [https://www.uuidgenerator.net/](https://www.uuidgenerator.net/)

#define SERVICE\_UUID “4fafc201-1fb5-459e-8fcc-c5c9c331914b”  
#define CHARACTERISTIC\_UUID “beb5483e-36e1-4688-b7f5-ea07361b26a8”

BLECharacteristic \*pCharacteristic;

#define DHTpin 14 //D5 of NodeMCU is GPIO14

DHTesp dht;

void setup() {  
Serial.begin(115200);  
Serial.println(“Starting BLE work!”);  
Serial.println(“Status\tHumidity (%)\tTemperature (C)\t(F)\tHeatIndex (C)\t(F)”);  
dht.setup(DHTpin, DHTesp::DHT11); //for DHT11 Connect DHT sensor to GPIO 17  
BLEDevice::init(“esp32 Weather Station”);  
BLEServer \*pServer = BLEDevice::createServer();  
BLEService \*pService = pServer-\>createService(SERVICE\_UUID);  
pCharacteristic = pService-\>createCharacteristic(  
CHARACTERISTIC\_UUID,  
BLECharacteristic::PROPERTY\_READ |  
BLECharacteristic::PROPERTY\_WRITE  
);

pCharacteristic-\>setValue(“Hello World says Neil”);  
pService-\>start();  
// BLEAdvertising \*pAdvertising = pServer-\>getAdvertising(); // this still is working for backward compatibility  
BLEAdvertising \*pAdvertising = BLEDevice::getAdvertising();  
pAdvertising-\>addServiceUUID(SERVICE\_UUID);  
pAdvertising-\>setScanResponse(true);  
pAdvertising-\>setMinPreferred(0x06); // functions that help with iPhone connections issue  
pAdvertising-\>setMinPreferred(0x12);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_DEFAULT);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL0);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL1);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL2);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL3);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL4);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL5);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL6);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL7);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_CONN\_HDL8);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_ADV);  
BLEDevice::setPower(ESP\_PWR\_LVL\_P7, ESP\_BLE\_PWR\_TYPE\_SCAN);  
BLEDevice::startAdvertising();  
Serial.println(“Characteristic defined! Now you can read it in your phone!”);  
}

void loop() {  
delay(dht.getMinimumSamplingPeriod());

float humidity = dht.getHumidity();  
float temperature = dht.getTemperature();

Serial.print(dht.getStatusString());  
Serial.print(“\t”);  
Serial.print(humidity, 1);  
Serial.print(“\t\t”);  
Serial.print(temperature, 1);  
Serial.print(“\t\t”);  
Serial.print(dht.toFahrenheit(temperature), 1);  
Serial.print(“\t\t”);  
Serial.print(dht.computeHeatIndex(temperature, humidity, false), 1);  
Serial.print(“\t\t”);  
Serial.println(dht.computeHeatIndex(dht.toFahrenheit(temperature), humidity, true), 1);

TempAndHumidity newValues = dht.getTempAndHumidity();  
// Check if any reads failed and exit early (to try again).  
if (dht.getStatus() != 0) {  
Serial.println("DHT11 error status: " + String(dht.getStatusString()));  
}  
float heatIndex = dht.computeHeatIndex(newValues.temperature, newValues.humidity);  
float dewPoint = dht.computeDewPoint(newValues.temperature, newValues.humidity);  
float cr = dht.getComfortRatio(cf, newValues.temperature, newValues.humidity);

String comfortStatus;  
switch (cf) {  
case Comfort\_OK:  
comfortStatus = “Decent”;  
break;  
case Comfort\_TooHot:  
comfortStatus = “Too hot”;  
break;  
case Comfort\_TooCold:  
comfortStatus = “Too cold”;  
break;  
case Comfort\_TooDry:  
comfortStatus = “Too dry”;  
break;  
case Comfort\_TooHumid:  
comfortStatus = “Too humid”;  
break;  
case Comfort\_HotAndHumid:  
comfortStatus = “Hot and humid”;  
break;  
case Comfort\_HotAndDry:  
comfortStatus = “Hot and dry”;  
break;  
case Comfort\_ColdAndHumid:  
comfortStatus = “Cold and humid”;  
break;  
case Comfort\_ColdAndDry:  
comfortStatus = “Cold and dry”;  
break;  
default:  
comfortStatus = “psh, we don’t know what to call it.”;  
break;  
};

// create string  
String myString = String(“{"T":"” + String(dht.toFahrenheit(newValues.temperature)) + “","H":"” + String(newValues.humidity) + “","I":"” + String(dht.toFahrenheit(heatIndex)) + “","D":"” + String(dht.toFahrenheit(dewPoint)) + "","comfort":" " + comfortStatus + “"}”);  
Serial.println(myString);

// get length of string (with one extra character for the null terminator)  
int str\_len = myString.length() + 1;

// Prepare the character array (the buffer)  
char char\_array[str\_len];

// copy the string into char\_array  
myString.toCharArray(char\_array, str\_len);

//update the ble characteristic  
pCharacteristic-\>setValue(char\_array);

}

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 20, 2025, 8:41pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/2 "2025-02-20T20:41:19Z")

</div>

![{A5CF1A0B-6CFA-404A-B04B-ACC1FC081BFF}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/5/755090ddf20b90923bc0a3d294bd792c1976dcea.png)

I have bought an extra part if that helps  
I need to find out how it is being sent and that it connects because I haven’t found out for a long time.

---

<div class="post-metadata">

**Author:** ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)\
**Post date:** [February 20, 2025, 9:17pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/3 "2025-02-20T21:17:15Z")

</div>

@jernej.zupanc37zfze9 BLE is not a premium feature, it is available to all Creators.

The if else statement is a little off but should not have any bearing on the results not showing

 ![Screenshot 2025-02-20 at 4.16.54 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/4/644463a0588830320749f960ff7f053c34c7bab4.png)

If BlueLight is not seeing the device either, the issue is in the setup of the specific Bluethooth module.

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 20, 2025, 9:21pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/4 "2025-02-20T21:21:32Z")

</div>

I apologise, I misspoke. Bluelight sees it, it’s just that the thunkable app doesn’t detect anyone in the vicinity.

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 20, 2025, 9:22pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/5 "2025-02-20T21:22:54Z")

</div>

Made in the same way as this or copied

> [@BlueTooth Weather Station - BLE](https://community.thunkable.com/t/bluetooth-weather-station-ble/1918355):
>
> This project requires: [esp32 w/ ble](https://www.amazon.com/HiLetgo-ESP-WROOM-32-Development-Microcontroller-Integrated/dp/B0718T232Z/ref=sr_1_4?crid=2I87RJS4PR6IM&keywords=esp32+wroom&qid=1654807051&sprefix=esp32+wroom+%2Caps%2C83&sr=8-4)[arduino ide](https://www.arduino.cc/en/software)[esp extension for arduino ide](https://randomnerdtutorials.com/how-to-install-esp8266-board-arduino-ide/)[dht-11 sensor](https://www.amazon.com/Temperature-Humidity-Digital-3-3V-5V-Raspberry/dp/B07WT2HJ4F/ref=sr_1_3?crid=2OPPHSRJPWASZ&keywords=dht11&qid=1654807119&sprefix=dht11%2Caps%2C78&sr=8-3)[breadboard](https://www.amazon.com/Seamaka-Breadboards-Solderless-Distribution-Connecting/dp/B09ND3WTNY/ref=sr_1_7_sspa?crid=TY36YKUY63D8&keywords=mini+breadboard&qid=1654807139&sprefix=mini+bread+moard%2Caps%2C87&sr=8-7-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEySldTUFNTM1pYWTdYJmVuY3J5cHRlZElkPUEwNjU4NzIwMk5aUzJFNVkwSEZFUiZlbmNyeXB0ZWRBZElkPUEwOTU1MzA0MkFETUE0TDRZM0s4VyZ3aWRnZXROYW1lPXNwX210ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=) jumper wires thunkable [https://x.thunkable.com/projectPage/62a20fbda09dfa016f680c47](https://x.thunkable.com/projectPage/62a20fbda09dfa016f680c47) Once you upload the code to your esp32, connect your dht11 to power, grnd, and pin14, you’re set! restart the device, then fire up the thunkable app. connect your device and ensure the UUID’s are matching. from there you should be able to start reading directly from your device and display…

---

<div class="post-metadata">

**Author:** ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)\
**Post date:** [February 20, 2025, 9:26pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/6 "2025-02-20T21:26:13Z")

</div>

Are you testing with Thunkable Live? iOS or Android? Or is this a downloaded app?

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 20, 2025, 9:31pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/7 "2025-02-20T21:31:38Z")

</div>

Thunkable Live on Android and not downloaded

---

<div class="post-metadata">

**Author:** ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)\
**Post date:** [February 20, 2025, 9:55pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/8 "2025-02-20T21:55:21Z")

</div>

Ah, I found the issues. The incomplete if else is causing an issue, please remove that.

 ![Screenshot 2025-02-20 at 4.54.06 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/c/4cee44ed53a1142a5c36fd9b090db56e0854486e.png)

Second, this is an old project Jared created, our BLE blocks have updated since this. Can you just pull in a new Scan block from the BLE drawer?

I just tested with this combination and it is working now.

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 20, 2025, 10:07pm UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/9 "2025-02-20T22:07:10Z")

</div>

![0](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/f/dfb84a8f847d856d8aece7ad5b767ef72c7a889d.png)

When I uninstall and make it so it says this on my phone

 ![{92E0A0C8-0248-48FD-B53B-5400F178B066}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/7/97e44133b7d9ff5f563f11c65a9c177de68c132f.png)

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [February 21, 2025, 8:36am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/10 "2025-02-21T08:36:26Z")

</div>

Hi @jernej.zupanc37zfze9  
Could you please check that the location is active on your device and the app has permission to use it?

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 21, 2025, 9:11am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/11 "2025-02-21T09:11:10Z")

</div>

Location is on on your device. On the app, sorry, but I don’t know where to check. I haven’t noticed it yet. If you can please tell me where I can find it to check. Good day Jernej

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [February 21, 2025, 9:15am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/12 "2025-02-21T09:15:17Z")

</div>

On the app settings.

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 21, 2025, 9:17am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/13 "2025-02-21T09:17:27Z")

</div>

![{BDE2188B-F4AD-40B7-9DE6-EB4C1312DE0C}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/8/b886417e3c1d6141853d24c7fd28420e1703b94a.png)  
This is what you mean

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [February 21, 2025, 9:19am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/14 "2025-02-21T09:19:04Z")

</div>

No, I mean the settings of the app in your Android device

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 21, 2025, 9:25am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/15 "2025-02-21T09:25:05Z")

</div>

![{ECF53163-5FE8-4A80-9691-2726BEBB378C}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/f/4f1dd6e8a49ff1c25d47430bf532335374415966.png)  
This?

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 21, 2025, 9:26am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/16 "2025-02-21T09:26:13Z")

</div>

**App Info**

**Thunkable**

**OPEN**  **UNINSTALL**  **FORCE STOP**

**Notifications**

- 0 notifications this week

**Permissions**

- Location

**Storage & Cache**

- Used: 311 MB - Internal Storage

**Mobile Data & Wi-Fi**

- Downloaded 808 MB since Oct 31, 2024

**Usage Time**

**Battery**

- 0% usage since last full charge

**Default Opening**

- The app is allowed to open supported links

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 21, 2025, 9:48am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/17 "2025-02-21T09:48:15Z")

</div>

I sincerely apologise, but I’m not skilled in this

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [February 21, 2025, 9:59am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/18 "2025-02-21T09:59:21Z")

</div>

On the permissions, the “Nearby devices” should be added as well

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 21, 2025, 10:07am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/19 "2025-02-21T10:07:04Z")

</div>

![{CE3B69BE-811B-4E29-B43B-DE7E0DC8AA36}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/9/f9a10fd01671967c8593bce29a1cdd370ac93bf9.png)  
 ![{CBC6C271-24EA-49A6-8B4D-C21945086523}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/2/d2d3e4a9abf4ebf2041990f37f445e538320ef75.png)  
 ![{F079FFF5-3843-40C6-954E-AC8F305B47C1}](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/0/d0e46b503838516e5f68c3743b1f0258b6c3bc7c.png)

Now it tells me how to make it send the values correctly. Thank you for your help and quick response

---

<div class="post-metadata">

**Author:** ![jernej.zupanc37zfze9](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jernej.zupanc37zfze9](https://community.thunkable.com/u/jernej.zupanc37zfze9)\
**Post date:** [February 21, 2025, 10:20am UTC](https://community.thunkable.com/t/ble-connect-to-arduino-problems/3591764/20 "2025-02-21T10:20:19Z")

</div>

I’ve already figured out what’s wrong. Thank you for all your previous help. Have a nice day Jernej
