RiRomain / Happy_Bubble_ESP32_Node

An ESP_32 based node for an Happy Bubbles presence server.
27 stars 8 forks source link

can not scan any devices #1

Open czdeee opened 6 years ago

czdeee commented 6 years ago

here is my esp32 log

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:956 load:0x40078000,len:0 load:0x40078000,len:11904 entry 0x40078a3c happy-bubbles/ble/bedroom/raw/ Connecting to WiFi.. Connecting to WiFi.. Connecting to WiFi.. Connecting to WiFi.. Connecting to WiFi.. Connecting to WiFi.. Connecting to WiFi.. Connected to the WiFi network Connecting to MQTT... connected Success sending message to topic Finished setup New loop E (14186) BT: btc_search_callback BLE observe complete. Num Resp 0

Total devices found: 0 Scan done! New loop E (24198) BT: btc_search_callback BLE observe complete. Num Resp 0

czdeee commented 6 years ago

Total devices found: 2 Scan done! New loop ---------------- Found new device ------------------Advertised Device: Name: , Address: 0d:3a:fb:f3:86:ca, manufacturer data: 4c0009060345c0a801bc Address :0d:3a:fb:f3:86:ca RSSI : -42 ManufacturerData : L Success sending message to topic: happy-bubbles/ble/bedroom2/raw/0d3afbf386ca Message: {"hostname":"living-room","mac":"0d3afbf386ca","rssi":-42,"is_scan_response":"0","type":"3","data":""} ---------------- Found new device ------------------Advertised Device: Name: , Address: 40:cb:c0:d6:60:6c, manufacturer data: 4c0010020100 Address :40:cb:c0:d6:60:6c RSSI : -41 ManufacturerData : L Success sending message to topic: happy-bubbles/ble/bedroom2/raw/40cbc0d6606c Message: {"hostname":"living-room","mac":"40cbc0d6606c","rssi":-41,"is_scan_response":"0","type":"3","data":""}

its ok.but can not scan my iPhone and my android Phone

RiRomain commented 6 years ago

Hi,

Thanks for trying it out, that's just an early version and certain thing are not working yet.

Concerning the android phone, it should be detected (only if compatible BLE), concerning iPhone, I don't know if they respected the standard.

There is also some problem with the current MQTT client (notably with mosquitto broker) that I'll try to fix as a next step.

The Bluetooth module/library seems to not initialize itself correctly sometimes and also need some fixing.

czdeee commented 6 years ago

ok,thanks for your reply. it can scan my appletv4K. my android Phone support Bluetooth4.1,seems include BLE.

czdeee commented 6 years ago

everytime i turn on my iPhone Bluetooth it can scan my iPhone,but everytime the mac address is change

RiRomain commented 6 years ago

It's call MAC randomization and you can say thanks to Apple for that... I'm not sure there is a way to change that. It's just your iPhone using another Mac address each time.

czdeee commented 6 years ago

yeah,it that mean i must be turn on my iPhone bluetooth to make sure the happy bubble correctly trace it. but the esp32 always cant scan my android phone,may be my devices problem

czdeee commented 6 years ago

i find some problem. if mqtt connected,ping the esp32 will be lost or ping count very large when i shutdown my mqtt server,the esp32 wifi back to normal

oakbrad commented 6 years ago

I am having the same problem as well, not seeing any beacons. I have several kinds here, I can see them in a beacon scanner app on my phone.

It starts up and connects to MQTT fine.

The serial monitor just loops:

Total devices found: 0
Scan done!
New loop
E (483743) BT: btc_search_callback  BLE observe complete. Num Resp 0

Total devices found: 0
Scan done!
New loop

I don't know if this has anything to do with my issue, but I did have to manually download the BLE library from arduino-esp32 when I set up the board manager. The library is there like it shold be and everything compiles fine.

Any help appreciated, the 'official' happy bubbles are out of stock :)

oakbrad commented 6 years ago

LOL never mind. I of course unplug-replug it back in just one more time and it now it's scanning fine. I did that several times though before posting.

You said the BLE doesn't initialize sometimes, seems like maybe that was my problem?

Thanks for this project, super helpful.

RiRomain commented 6 years ago

Yep, exactly this problem, need to find another Bluetooth library for the esp32 that is more reliable or tweak the current one.

oakbrad commented 6 years ago

Got it. Mine is seeing bluetooth devices when it starts up, then it seems to go on a loop with nothing found after that.

I'm also seeing my iBeacons picked up, but not with their UUID Major/Minor, ie

---------------- Found new device  ------------------Advertised Device: Name: iBeacon-8089, Address: e0:e5:cf:af:8d:7d, manufacturer data: 4c000215fda50693a4e24fb1afcfc6eb0764782527142222cd 
Address          :e0:e5:cf:af:8d:7d
RSSI             : -88
Device name      : iBeacon-8089
ManufacturerData : L
Success sending message to topic: happy-bubbles/ble/front/raw/e0e5cfaf8d7d
antibill51 commented 6 years ago

Hi, very good job ! Any news about the Bluetooth module/library bug? Thanks

RiRomain commented 6 years ago

According to some, the problem comes from the fact that the ESP32 share his antenna between the WiFi and Bluetooth module. However I haven't be able to confirm that and didn't have time to track the issue further.

oakbrad commented 6 years ago

@RiRomain You may want to take a look at the library being used by the OpenMQTTGateway project, they recently added ESP32 BLE support and it is working pretty well for me https://github.com/1technophile/OpenMQTTGateway